Messages in this thread | | | Subject | Re: A general question on SMP-safe driver code. | From | Alan Cox <> | Date | Sat, 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/
| |