>I can only suggest samples, common model u have to slowly go through
>file by file.   But I am not sure what kind of "common" model u are
>looking for - commonality based on what attributes?   In the kernel
>source's drivers subdirectory:
>

Thanks for your help. Is this mail looks OK? This reply should be transmit by 
pure text format, 
but I'm not sure it is OK in you machine.

"Common model", I mean, is the common way to protect the access to registers, 
using all kinds of 
synchronization primitives, in ioctl level or other lower levels.

In our habitual saying, we need this sync-primitives when accessing shared 
resource in multi-execute-threads,
such as in system call context of several process, or interrupt context. 

Commonly speaking, the shared resource is some global data structures, but in 
my driver, there is only 
one ioctl cmd for reading or writing of registers. The calles to this ioctl cmd 
are comes from several process, or
from interrupt handler maybe. So I think the only ioctl cmd itself may be 
treated as a shared resource in some degree, 
is it true? 


>Another option is that you spin lock the access to the registers in kernel 
>space.
>In this way, performance may be better than lock the entire ioctl.

Yeah, that's good, I'll try it.

Maybe, there isn't such common protect strategies in such circumstance, but 
anyway, thanks you two,  Peter, and Jeffrey, thanks for your help.



Reply via email to