[PATCH] mtd: cfi_cmdset_0002: Support Persistent Protection Bits (PPB) locking
Artem Bityutskiy
dedekind1 at gmail.com
Tue Dec 11 02:00:44 EST 2012
On Fri, 2012-12-07 at 08:22 +0100, Stefan Roese wrote:
> + /*
> + * Wait for some time as unlocking of all sectors takes quite long
> + */
> + timeo = jiffies + (2 * HZ); /* 2s max (un)locking */
Please, use msecs_to_jiffies() instead.
> + for (;;) {
> + if (chip_ready(map, adr))
> + break;
> +
> + if (time_after(jiffies, timeo)) {
> + printk(KERN_ERR "Waiting for chip to be ready timed out.\n");
> + ret = -EIO;
> + break;
> + }
> + mutex_unlock(&chip->mutex);
> + cfi_udelay(1);
> + mutex_lock(&chip->mutex);
> + }
Would you please educate me a bit and explain what is protected by
'chip->mutex' and by 'get_chip()'.
Why you need to drop the mutex here?
Why is it not an ABBA deadlock to do this:
Task 1: In the loop above, has chip locked, doing
mutex_lock(&chip->mutex);
Task 2: done mutex_lock(&chip->mutex), now doing
ret = get_chip(map, chip, adr + chip->start, FL_LOCKING);
--
Best Regards,
Artem Bityutskiy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ozlabs.org/pipermail/devicetree-discuss/attachments/20121210/ce073373/attachment.sig>
More information about the devicetree-discuss
mailing list