Re: [PATCH] spi: Unlock a spinlock before calling into the controller driver.

From: Linus Walleij
Date: Mon Jun 25 2012 - 14:56:23 EST


On Tue, Jun 26, 2012 at 1:07 AM, Doug Anderson <dianders@xxxxxxxxxxxx> wrote:

> Specifically there should be only one instance of spi_pump_messages()
> running at a time per master.  That's because it's a kthread work
> function.  ...so we can't possibly get a prepare in the middle of the
> unprepare when prepare is called because the only caller to
> prepare/unprepare is spi_pump_messages().

Yes that's how the message pump is designed.

> I can't comment on whether it's better to do something like add a
> workqueue (which might be more obvious / less fragile) or just to add
> a comment.  I will let others comment on that.  :)

The message pump initially used a workqueue, but was converted
to a kthread because we needed to push the queue to run as
realtime for some important low-latency workloads across
SPI. The code is basically a tweaked workqueue if you dive down
in the implementation.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/