Re: [PATCH] w1: Introduce a slave mutex for serializing IO.

From: Evgeniy Polyakov
Date: Tue May 01 2012 - 17:40:11 EST


On Wed, Apr 25, 2012 at 12:49:14PM +1000, NeilBrown (neilb@xxxxxxx) wrote:
> w1 devices need a mutex to serial IO.
> Most use master->mutex.
>
> However that is used for other purposes and they can conflict.
>
> In particular master->mutex is held while w1_attach_slave_device is
> called.
>
> For bq27000, this registers a 'powersupply' device which tries to
> read the current status. The attempt to read will cause a deadlock on
> master->mutex.
>
> So create a new per-slave mutex and use that for serializing IO for
> bq27000.

How will this protect against master doing search for example?
It performs a number of read/write operations which are not allowed to
be interrupted by outside read.

--
Evgeniy Polyakov
--
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/