public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Brownell <david-b@pacbell.net>
To: Peter Zijlstra <peterz@infradead.org>
Cc: linux-usb-devel@lists.sourceforge.net, Greg KH <greg@kroah.com>,
	Alan Stern <stern@rowland.harvard.edu>,
	Oliver Neukum <oneukum@suse.de>, Ingo Molnar <mingo@elte.hu>,
	Stephen Hemminger <shemminger@linux-foundation.org>,
	linux-kernel@vger.kernel.org, apw <apw@shadowen.org>
Subject: Re: [linux-usb-devel] device struct bloat
Date: Mon, 5 Nov 2007 17:38:34 -0800	[thread overview]
Message-ID: <200711051738.35080.david-b@pacbell.net> (raw)
In-Reply-To: <20071105224929.GA30521@kroah.com>

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;


  reply	other threads:[~2007-11-06  1:38 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-03 19:48 device struct bloat Stephen Hemminger
2007-11-03 23:14 ` Greg KH
2007-11-04 20:29 ` Peter Zijlstra
2007-11-05  3:58   ` Greg KH
2007-11-05 10:46     ` Peter Zijlstra
2007-11-05 10:57       ` Peter Zijlstra
2007-11-05 22:33         ` Stefan Richter
2007-11-05 22:49         ` Greg KH
2007-11-06  1:38           ` David Brownell [this message]
2007-11-06  9:43             ` [linux-usb-devel] " Peter Zijlstra
2007-11-06  9:48           ` Peter Zijlstra
2007-11-06 15:36           ` Alan Stern
2007-11-06 15:58             ` Peter Zijlstra
2007-11-06 16:32               ` Alan Stern
2007-11-06 17:19                 ` Peter Zijlstra
2007-11-06 18:05                   ` Alan Stern
2007-11-06 18:57                     ` Peter Zijlstra
2007-11-07 16:42                       ` Alan Stern

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=200711051738.35080.david-b@pacbell.net \
    --to=david-b@pacbell.net \
    --cc=apw@shadowen.org \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb-devel@lists.sourceforge.net \
    --cc=mingo@elte.hu \
    --cc=oneukum@suse.de \
    --cc=peterz@infradead.org \
    --cc=shemminger@linux-foundation.org \
    --cc=stern@rowland.harvard.edu \
    /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