lkml.org 
[lkml]   [1999]   [Dec]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectHelp with SMP aware modules.
Hello,

I'm porting a driver for a DAC board from 2.0 to 2.2. Since I'm learning
kernel programming as I do this, I have some questions about how to make
this driver SMP aware.

After reading this article,
http://news.tucows.com/ext2/99/11/articles/ext2112919991.shtml, I was
left wondering about when to use the spinlocks.

A piece of code like this:

for (i=0;i<count;i++)
outb(*buf++, addr);

should be protected in all SMP instances? As in:

spin_lock(&lock);
for (i=0;i<count;i++)
outb(*buf++, addr);
spin_unlock(&lock);

How about:

for (i=0;i<count;i++)
*dest++ = inb(addr);

should a spinlock be placed here too?

Thanks.
--
Rafael Herrera
Laboratory for Computational Neuroscience
University of Pittsburgh
http://www.neuronet.pitt.edu/~raffo

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:55    [W:0.027 / U:0.420 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site