lkml.org 
[lkml]   [2005]   [Dec]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 01/10] usb-serial: URB write locking macros.

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
-
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-12-06 13:40    [W:0.036 / U:0.752 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site