mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Luiz Fernando Capitulino <lcapitulino@mandriva.com.br>
To: Arjan van de Ven <arjan@infradead.org>
Cc: gregkh@suse.de, linux-kernel@vger.kernel.org,
	linux-usb-devel@lists.sourceforge.net, ehabkost@mandriva.com
Subject: Re: [PATCH 01/10] usb-serial: URB write locking macros.
Date: Tue, 6 Dec 2005 10:37:29 -0200	[thread overview]
Message-ID: <20051206103729.6c4ee2b7.lcapitulino@mandriva.com.br> (raw)
In-Reply-To: <1133871843.4836.15.camel@laptopd505.fenrus.org>


 Hi Arjan,

On Tue, 06 Dec 2005 13:24:03 +0100
Arjan van de Ven <arjan@infradead.org> wrote:

| On Tue, 2005-12-06 at 09:57 -0200, Luiz Fernando Capitulino wrote:
| >  Introduces URB write locking macros.
| 
| ugh.. WHY ?

 Because is easier to read/understand:

	if (usb_serial_write_urb_lock(port)) {
		dbg("%s - already writing", __FUNCTION__);
		return 0;
	}

 than:

	if (!atomic_add_unless(&port->write_urb_busy, 1, 1)) {
		dbg("%s - already writing", __FUNCTION__);
		return 0;
	}

 IMHO.

 Of course I'm only ilustrating the 'lock' scenario, but you will have other
atomic functions spread in the driver.

 Looks better to have some macros to make clear what you're doing.

-- 
Luiz Fernando N. Capitulino

  reply	other threads:[~2005-12-06 12:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-06 11:57 Luiz Fernando Capitulino
2005-12-06 12:24 ` Arjan van de Ven
2005-12-06 12:37   ` Luiz Fernando Capitulino [this message]
2005-12-06 12:46   ` Eduardo Pereira Habkost
2005-12-06 12:35 ` [linux-usb-devel] " Oliver Neukum

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=20051206103729.6c4ee2b7.lcapitulino@mandriva.com.br \
    --to=lcapitulino@mandriva.com.br \
    --cc=arjan@infradead.org \
    --cc=ehabkost@mandriva.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb-devel@lists.sourceforge.net \
    /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

all inboxes | Powered by JetHome®