Re: [RFC PATCH 0/5] mtd: rawnand: Simplify the locking

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Boris,

Boris Brezillon <boris.brezillon@xxxxxxxxxxx> wrote on Tue, 20 Nov 2018
11:57:15 +0100:

> Hello,
> 
> The nand_get_device()/nand_release_device() logic looks complex for no
> obvious reasons. I might be wrong, but I think the spinlock+waitqueue
> approach can be replaced by regular mutexes: one to serialize accesses
> to the NAND chip (and protect the suspended field), another one to
> serialize accesses to the controller.
> 
> We also get rid of the ->state field which was not really useful except
> for detecting when the NAND chip is suspended (some drivers were using
> it to determine the timeout value, but always taking the max timeout
> sounds like a good solution too, since it's a timeout, not a delay).
> This ->state field is replaced by a ->suspended field which is
> protected by the chip lock. So no state machine anymore, just 3 states:
> 
> 1/ NAND is idle
> 2/ NAND is being accessed (we don't care about the access type)
> 3/ NAND is suspended
> 
> Patches 1 to 4 are preparing things for the chip->state, controller->wq
> and controller->lock removal by patching all drivers that were
> accessing those fields directly.
> 
> Patch 5 is doing the actual locking changes.
> 
> Note that even if we don't rework the locking, I think patches 1 to 4
> are worth applying.
> 
> Regards,
> 
> Boris

Looks good to me, applied on nand/next.


Thanks,
Miquèl

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux