[PATCH v4 2/2] mtd: mediatek: driver for MTK Smart Device Gen1 NAND
Jorge Ramirez
jorge.ramirez-ortiz at linaro.org
Tue May 10 07:45:31 PDT 2016
On 05/10/2016 08:13 AM, Boris Brezillon wrote:
>> +struct mtk_ecc {
>> >+ struct device *dev;
>> >+ void __iomem *regs;
>> >+ struct clk *clk;
>> >+
>> >+ struct completion done;
>> >+ struct semaphore sem;
> You tried to explain me why you decided to go for a semaphore instead of
> a mutex, but I don't remember. Could you explain it again?
> If that's all about being interruptible, then you can use
Just for flexibility, no other reason really.
Neither the mutex nor the semaphore are actually needed in this driver.
Not knowing how things are going to evolve in the upper layers of MTD I
didn't feel comfortable taking a lock in a function and unlocking the
mutex in a different function (which is the way this driver operates).
with that in mind I opted for a semaphore since it can always be
unlocked -if needed be- by a different thread.
More information about the Linux-mediatek
mailing list