Re: [PATCH 01/10] usb-serial: URB write locking macros.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 Hi Arjan,

On Tue, 06 Dec 2005 13:24:03 +0100
Arjan van de Ven <[email protected]> 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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux