lkml.org 
[lkml]   [2004]   [Dec]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: A general question on SMP-safe driver code.
From
Date
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    [W:0.052 / U:0.264 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site