From: Daniel Walker <dwalker@mvista.com>
To: Grant Likely <grant.likely@secretlab.ca>
Cc: dbrownell@users.sourceforge.net, linux-kernel@vger.kernel.org,
linuxppc-dev@ozlabs.org, spi-devel-general@lists.sourceforge.net,
akpm@linux-foundation.org
Subject: Re: [PATCH v3 4/4] powerpc/mpc5200: Add mpc5200-spi (non-PSC) device driver
Date: Sat, 26 Jul 2008 00:47:39 -0400 [thread overview]
Message-ID: <1217047659.3970.14.camel@localhost.localdomain> (raw)
In-Reply-To: <fa686aa40807251945t26a1656ep7a57ca71faa096c4@mail.gmail.com>
On Fri, 2008-07-25 at 22:45 -0400, Grant Likely wrote:
> On Fri, Jul 25, 2008 at 2:19 PM, Daniel Walker <dwalker@mvista.com> wrote:
> > On Fri, 2008-07-25 at 03:33 -0400, Grant Likely wrote:
> >
> >> + if (status && (irq != NO_IRQ))
> >> + dev_err(&ms->master->dev, "spurious irq, status=0x%.2x\n",
> >> + status);
> >> +
> >> + /* Check if there is another transfer waiting */
> >> + if (list_empty(&ms->queue))
> >> + return FSM_STOP;
> >
> > I don't think doing list_empty outside the critical section is totally
> > safe.. You might want to move it down inside the spin_lock() section.
>
> This should be fine. This is the only place where items are dequeued,
> and it will only ever be called from the ISR or the work queue. The
> work queue and IRQ will never be active at the same time (I'll add a
> comment to the fact). It also looks like list_empty is perfectly safe
> to call without the protection of a spin lock (but somebody correct me
> if I'm out to lunch). It doesn't dereference any of the pointers in
> the list_head structure.
The list_empty wouldn't crash, but the result isn't necessarily
accurate.
> >
> >> + /* Get the next message */
> >> + spin_lock(&ms->lock);
> >
> > The part that's a little confusing here is that the interrupt can
> > actually activate the workqueue .. So I'm wondering if maybe you could
> > have this interrupt driven any workqueue driven at the same time? If you
> > could then you would need the above to be
> > spin_lock_irq/spin_lock_irqsave ..
>
> Ditto here, since the irq and workqueue are not enabled at the same
> time there is no worry about collision.
Why are you waking up the work queue from inside the irq handler? You
might also want to break out the handling from inside the irq handler
and call that from the workqueue, instead of re-calling the irq handler
function from the workqueue.. It's a little confusing from a context
perspective.
Daniel
next prev parent reply other threads:[~2008-07-26 4:49 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-25 7:33 [PATCH v3 0/4 REPOST] OF infrastructure for SPI devices Grant Likely
2008-07-25 7:33 ` [PATCH v3 1/4] of: adapt of_find_i2c_driver() to be usable by SPI also Grant Likely
2008-07-25 15:40 ` Jon Smirl
2008-07-25 16:21 ` Grant Likely
2008-07-25 17:02 ` Jon Smirl
2008-07-25 18:52 ` Grant Likely
2008-07-25 7:33 ` [PATCH v3 2/4] spi: split up spi_new_device() to allow two stage registration Grant Likely
2008-07-25 19:00 ` David Brownell
2008-07-25 19:34 ` Grant Likely
2008-07-25 7:33 ` [PATCH v3 3/4] spi: Add OF binding support for SPI busses Grant Likely
2008-07-25 7:33 ` [PATCH v3 4/4] powerpc/mpc5200: Add mpc5200-spi (non-PSC) device driver Grant Likely
2008-07-25 18:19 ` Daniel Walker
2008-07-26 2:45 ` Grant Likely
2008-07-26 4:47 ` Daniel Walker [this message]
2008-07-26 5:20 ` Grant Likely
2008-07-27 21:41 ` David Brownell
2008-07-25 14:46 ` [PATCH v3 0/4 REPOST] OF infrastructure for SPI devices Jon Smirl
2008-08-02 22:46 ` Jon Smirl
2008-07-27 21:49 ` David Brownell
2008-07-28 16:39 ` Grant Likely
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=1217047659.3970.14.camel@localhost.localdomain \
--to=dwalker@mvista.com \
--cc=akpm@linux-foundation.org \
--cc=dbrownell@users.sourceforge.net \
--cc=grant.likely@secretlab.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=spi-devel-general@lists.sourceforge.net \
/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;
as well as URLs for NNTP newsgroup(s).