Re: [REPOST PATCH] spi: Unlock a spinlock before calling into thecontroller driver.

From: Mark Brown
Date: Mon Apr 01 2013 - 09:24:15 EST


On Wed, Mar 13, 2013 at 11:17:40AM -0700, Doug Anderson wrote:
> From: Bryan Freed <bfreed@xxxxxxxxxxxx>
>
> spi_pump_messages() calls into a controller driver with
> unprepare_transfer_hardware() which is documented as "This may sleep".
> As in the prepare_transfer_hardware() call below, we should release the
> queue_lock spinlock before making the call.
> Rework the logic a bit to hold queue_lock to protect the 'busy' flag,
> then release it to call unprepare_transfer_hardware().

Applied, thanks. However...

> spin_unlock_irqrestore(&master->queue_lock, flags);
> + if (master->unprepare_transfer_hardware &&
> + master->unprepare_transfer_hardware(master))
> + dev_err(&master->dev,
> + "failed to unprepare transfer hardware\n");

...it'd be nicer to pay attention to and log the error code if we fail
to unprepare.

Attachment: signature.asc
Description: Digital signature