From: David Brownell <david-b@pacbell.net>
To: Chris Lesiak <chris.lesiak@licor.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] spi subsystem: destroy the spi_bitbang workqueue only after the spi master is unregistered
Date: Thu, 8 Mar 2007 22:19:32 -0800 [thread overview]
Message-ID: <200703082219.33296.david-b@pacbell.net> (raw)
In-Reply-To: <45EF4F32.2050601@licor.com>
On Wednesday 07 March 2007 3:48 pm, Chris Lesiak wrote:
> From: Chris Lesiak <chris.lesiak@licor.com>
>
> This patch fixes a bug in the cleanup of an spi_bitbang bus.
It's nearly right, but see below.
> @@ -505,28 +499,10 @@ EXPORT_SYMBOL_GPL(spi_bitbang_start);
> */
> int spi_bitbang_stop(struct spi_bitbang *bitbang)
> {
> - unsigned limit = 500;
> -
> - spin_lock_irq(&bitbang->lock);
> - bitbang->shutdown = 0;
> - while (!list_empty(&bitbang->queue) && limit--) {
> - spin_unlock_irq(&bitbang->lock);
> -
> - dev_dbg(bitbang->master->cdev.dev, "wait for queue\n");
> - msleep(10);
> -
> - spin_lock_irq(&bitbang->lock);
> - }
You completely removed an odious busy-wait, which is good ...
> - spin_unlock_irq(&bitbang->lock);
> - if (!list_empty(&bitbang->queue)) {
> - dev_err(bitbang->master->cdev.dev, "queue didn't empty\n");
> - return -EBUSY;
> - }
> + spi_unregister_master(bitbang->master);
... but right here there should be a WARN_ON(!list_empty(...)) to
flag the corresponding bogosity: that somehow a request never
completed.
>
> destroy_workqueue(bitbang->workqueue);
>
> - spi_unregister_master(bitbang->master);
> -
> return 0;
> }
> EXPORT_SYMBOL_GPL(spi_bitbang_stop);
>
>
next prev parent reply other threads:[~2007-03-09 6:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <45EEE34A.6070009@licor.com>
[not found] ` <200703071031.39997.david-b@pacbell.net>
2007-03-07 23:48 ` [PATCH] spi subsystem: destroy the spi_bitbang workqueue only after the spi master is unregistered Chris Lesiak
2007-03-09 6:19 ` David Brownell [this message]
2007-03-09 17:32 ` Chris Lesiak
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=200703082219.33296.david-b@pacbell.net \
--to=david-b@pacbell.net \
--cc=chris.lesiak@licor.com \
--cc=linux-kernel@vger.kernel.org \
/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