Re: device struct bloat
David Brownell <[email protected]>
| Newsgroups | gmane.linux.usb.devel,gmane.linux.kernel |
|---|---|
| Message-ID | <[email protected]> |
On Monday 05 November 2007, Greg KH wrote:
> --- linux-2.6-2.orig/drivers/spi/spi.c
> +++ linux-2.6-2/drivers/spi/spi.c
It'd be quicker to end up in the right hands if you had
split this big and random patch according to subsystem...
There's already a patch in the MM queue that removes
the SPI-private semaphore. Except that it's missing
the bug noted below.
The class semaphore removal would be a different issue.
> @@ -613,7 +613,7 @@ int spi_write_then_read(struct spi_devic
> }
>
> /* ... unless someone else is using the pre-allocated buffer */
> - if (down_trylock(&lock)) {
> + if (mutex_trylock(&lock)) {
According to its kerneldoc, mutex_trylock() follows the
spinlock model not the semaphore model. So the sense of
this test is incorrect ... as will be any similar changes
in other parts of this patch:
* NOTE: this function follows the spin_trylock() convention, so
* it is negated to the down_trylock() return values! Be careful
* about this when converting semaphore users to mutexes.
So the patch in the MM queue says "if (!mutex_trylock(...)) {
> local_buf = kmalloc(SPI_BUFSIZ, GFP_KERNEL);
> if (!local_buf)
> return -ENOMEM;
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel