Re: spinlock/cli/sti and unrelated modules

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




--- Bernd Petrovitsch <bernd@xxxxxxxxx> wrote:

> On Tue, 2005-08-23 at 17:58 -0700, john bogus wrote:
> [...]
> > and should be replaced by the spinlock interface
> > 
> >         spinlock_t mr_lock = SPIN_LOCK_UNLOCKED;
> >         unsigned long flags;                   
> >         spin_lock_irqsave(&mr_lock, flags);    
> >         /* critical section ... */             
> >         spin_unlock_irqrestore(&mr_lock, flags)
> > 
> > 
> > but I am working with a few different drivers
> (some of
> > which I didn't write). They are using gpio ports
> on a
> > embedded arm processor. My critial code would set
> a
> > single bit in a port (the other modules use other
> bits
> > in the same port) i.e.:
> >         outl(inl(XXXX_PORT) | XXXX_MASK,
> XXXX_PORT); 
> > 
> > If I use the spinlocks, the spinlock_t mr_lock is
> not
> > availble in all the modules.... so do I have a
> locking
>   ^^^^^^^^
> What exactly you mean with this?
> Do you get compiler errors about unknown variables?
> 
> > problem? how should I code this ?
> 
> You probably forget to put an 'extern' declaration
> in a .h file.
> 
> 	Bernd
> -- 
> Firmix Software GmbH                  
> http://www.firmix.at/
> mobil: +43 664 4416156                 fax: +43 1
> 7890849-55
>           Embedded Linux Development and Services
> 
> 
sorry not the best explanation.

Yes, I know that I can make the variable global and
use it for spinlocks from other modules.  With the
cli/sti there is no reference to a global variable, so
loadable modules can  be completly independent (none
need to be aware of this global spinlock variable). 
As I do not have control over all of these other
modules, this is my prefered mode of operation.




		
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux