[PATCH 2/5] mtd: nand: Propagate mtd_device_unregister() return value in tear down
Richard Weinberger
richard at nod.at
Thu Jul 7 11:29:24 PDT 2016
Boris,
Am 06.07.2016 um 15:34 schrieb Boris Brezillon:
>> /**
>> - * nand_release - [NAND Interface] Free resources held by the NAND device
>> + * __nand_release - [NAND Interface] Free resources held by the NAND device
>> * @mtd: MTD device structure
>> */
>> -void nand_release(struct mtd_info *mtd)
>> +int __nand_release(struct mtd_info *mtd)
>
> Can we find a better name? nand_release_safe()?
Sure. Let's pick nand_release_safe().
>> {
>> + int ret;
>> struct nand_chip *chip = mtd_to_nand(mtd);
>>
>> + ret = mtd_device_unregister(mtd);
>> + if (ret)
>> + return ret;
>> +
>
> The question is, should we unregister the MTD device in nand_release().
> It feels a bit odd to have nand_scan_xxx() functions only doing the
> nand_chip initialization and letting the NAND controller driver
> register the MTD device, and have nand_release() unregister the MTD
> device for us.
>
> Maybe we should export a nand_cleanup() function that would just
> release nand_chip resources and let NAND controller drivers that
> really care about mtd_device_unregister() return code call it
> themselves before calling nand_cleanup() (instead of calling
> nand_release()).
You mean renaming nand_release() to nand_cleanup() and the driver
has to issue mtd_device_unregister() itself before it is allowed to
do nand_cleanup(). Yes, that is also an option.
The only downside is that we have to touch a lot of drivers then.
But the conversion should be almost trivial.
Thanks,
//richard
More information about the linux-mtd
mailing list