lkml.org 
[lkml]   [2004]   [Dec]   [25]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: A general question on SMP-safe driver code.
FromAlan Cox <>
DateSat, 25 Dec 2004 12:23:24 +0000
On Gwe, 2004-12-24 at 22:58, Jim Nelson wrote:
> Looking at a few older drivers, I'm trying to figure out the best ways to handle 
> some locking.  Using drivers/char/esp.c as an example (since it's the one I'm 
> trying to grok right now), here is one example:

> ;
> 	serial_out(info, UART_ESI_CMD1, ESI_GET_TX_AVAIL);
> 	spin_unlock_irq(&info->esp_lock);
> 
> 	while ((serial_in(info, UART_ESI_STAT1) != 0x03) ||
> 		(serial_in(info, UART_ESI_STAT2) != 0xff)) {

You need to guard these as well in the locks. It might actually look a
lot cleaner to have functions esp_send_command(info, a, b) and the like
which do the locking internally ?

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

\
 
 \ /
  Last update: 2005-03-22 14:09    [from the cache]
©2003-2008