mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: Jim Nelson <james4765@verizon.net>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: A general question on SMP-safe driver code.
Date: Sat, 25 Dec 2004 12:23:24 +0000	[thread overview]
Message-ID: <1103977401.22646.9.camel@localhost.localdomain> (raw)
In-Reply-To: <41CC9F2A.9080905@verizon.net>

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 ?


      parent reply	other threads:[~2004-12-25 13:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-24 22:58 Jim Nelson
2004-12-24 23:28 ` Linus Torvalds
2004-12-25 12:23 ` Alan Cox [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1103977401.22646.9.camel@localhost.localdomain \
    --to=alan@lxorguk.ukuu.org.uk \
    --cc=james4765@verizon.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome