* [PATCH 02/14] mtd: spi-nor: aspeed-smc: Make aspeed_smc_unregister() return void
2022-06-03 21:07 [PATCH 00/14] mtd: Fix platform remove callbacks to always return 0 Uwe Kleine-König
@ 2022-06-03 21:07 ` Uwe Kleine-König
2022-06-07 9:28 ` Pratyush Yadav
2022-06-03 21:07 ` [PATCH 08/14] mtd: rawnand: atmel: Warn about failure to unregister mtd device Uwe Kleine-König
` (3 subsequent siblings)
4 siblings, 1 reply; 15+ messages in thread
From: Uwe Kleine-König @ 2022-06-03 21:07 UTC (permalink / raw)
To: Tudor Ambarus, Pratyush Yadav, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra, Joel Stanley
Cc: kernel, Michael Walle, Andrew Jeffery, linux-mtd,
linux-arm-kernel, linux-aspeed
The function returns zero unconditionally, so simplify to make it
obvious there is no error to handle in the callers.
This is a preparation for making platform remove callbacks return void.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/mtd/spi-nor/controllers/aspeed-smc.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/mtd/spi-nor/controllers/aspeed-smc.c b/drivers/mtd/spi-nor/controllers/aspeed-smc.c
index acfe010f9dd7..bd149104533a 100644
--- a/drivers/mtd/spi-nor/controllers/aspeed-smc.c
+++ b/drivers/mtd/spi-nor/controllers/aspeed-smc.c
@@ -399,7 +399,7 @@ static ssize_t aspeed_smc_write_user(struct spi_nor *nor, loff_t to,
return len;
}
-static int aspeed_smc_unregister(struct aspeed_smc_controller *controller)
+static void aspeed_smc_unregister(struct aspeed_smc_controller *controller)
{
struct aspeed_smc_chip *chip;
int n;
@@ -409,13 +409,13 @@ static int aspeed_smc_unregister(struct aspeed_smc_controller *controller)
if (chip)
mtd_device_unregister(&chip->nor.mtd);
}
-
- return 0;
}
static int aspeed_smc_remove(struct platform_device *dev)
{
- return aspeed_smc_unregister(platform_get_drvdata(dev));
+ aspeed_smc_unregister(platform_get_drvdata(dev));
+
+ return 0;
}
static const struct of_device_id aspeed_smc_matches[] = {
--
2.36.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 15+ messages in thread* Re: [PATCH 02/14] mtd: spi-nor: aspeed-smc: Make aspeed_smc_unregister() return void
2022-06-03 21:07 ` [PATCH 02/14] mtd: spi-nor: aspeed-smc: Make aspeed_smc_unregister() return void Uwe Kleine-König
@ 2022-06-07 9:28 ` Pratyush Yadav
2022-06-07 9:54 ` Cédric Le Goater
0 siblings, 1 reply; 15+ messages in thread
From: Pratyush Yadav @ 2022-06-07 9:28 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Tudor Ambarus, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra, Joel Stanley, kernel, Michael Walle,
Andrew Jeffery, Cédric Le Goater, linux-mtd,
linux-arm-kernel, linux-aspeed
Hi Uwe,
On 03/06/22 11:07PM, Uwe Kleine-König wrote:
> The function returns zero unconditionally, so simplify to make it
> obvious there is no error to handle in the callers.
>
> This is a preparation for making platform remove callbacks return void.
Cedric recently ported the driver to SPI MEM and it has now hit the
linux-next tree [0]. This driver is planned to be removed. Can you
please check if the new driver has this issue, and fix it there?
[0] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit?id=9c63b846e6df43e5b3d31263f7db545f32deeda3
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> drivers/mtd/spi-nor/controllers/aspeed-smc.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mtd/spi-nor/controllers/aspeed-smc.c b/drivers/mtd/spi-nor/controllers/aspeed-smc.c
> index acfe010f9dd7..bd149104533a 100644
> --- a/drivers/mtd/spi-nor/controllers/aspeed-smc.c
> +++ b/drivers/mtd/spi-nor/controllers/aspeed-smc.c
> @@ -399,7 +399,7 @@ static ssize_t aspeed_smc_write_user(struct spi_nor *nor, loff_t to,
> return len;
> }
>
> -static int aspeed_smc_unregister(struct aspeed_smc_controller *controller)
> +static void aspeed_smc_unregister(struct aspeed_smc_controller *controller)
> {
> struct aspeed_smc_chip *chip;
> int n;
> @@ -409,13 +409,13 @@ static int aspeed_smc_unregister(struct aspeed_smc_controller *controller)
> if (chip)
> mtd_device_unregister(&chip->nor.mtd);
> }
> -
> - return 0;
> }
>
> static int aspeed_smc_remove(struct platform_device *dev)
> {
> - return aspeed_smc_unregister(platform_get_drvdata(dev));
> + aspeed_smc_unregister(platform_get_drvdata(dev));
> +
> + return 0;
> }
>
> static const struct of_device_id aspeed_smc_matches[] = {
> --
> 2.36.1
>
--
Regards,
Pratyush Yadav
Texas Instruments Inc.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 15+ messages in thread* Re: [PATCH 02/14] mtd: spi-nor: aspeed-smc: Make aspeed_smc_unregister() return void
2022-06-07 9:28 ` Pratyush Yadav
@ 2022-06-07 9:54 ` Cédric Le Goater
0 siblings, 0 replies; 15+ messages in thread
From: Cédric Le Goater @ 2022-06-07 9:54 UTC (permalink / raw)
To: Pratyush Yadav, Uwe Kleine-König
Cc: Tudor Ambarus, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra, Joel Stanley, kernel, Michael Walle,
Andrew Jeffery, linux-mtd, linux-arm-kernel, linux-aspeed
Hello,
On 6/7/22 11:28, Pratyush Yadav wrote:
> Hi Uwe,
>
> On 03/06/22 11:07PM, Uwe Kleine-König wrote:
>> The function returns zero unconditionally, so simplify to make it
>> obvious there is no error to handle in the callers.
>>
>> This is a preparation for making platform remove callbacks return void.
>
> Cedric recently ported the driver to SPI MEM and it has now hit the
> linux-next tree [0]. This driver is planned to be removed. Can you
> please check if the new driver has this issue, and fix it there?
>
> [0] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit?id=9c63b846e6df43e5b3d31263f7db545f32deeda3
It is merged in -rc1 now :
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/spi/spi-aspeed-smc.c
I think aspeed_spi_remove() does what you want there.
Thanks,
C.
>>
>> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
>> ---
>> drivers/mtd/spi-nor/controllers/aspeed-smc.c | 8 ++++----
>> 1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/mtd/spi-nor/controllers/aspeed-smc.c b/drivers/mtd/spi-nor/controllers/aspeed-smc.c
>> index acfe010f9dd7..bd149104533a 100644
>> --- a/drivers/mtd/spi-nor/controllers/aspeed-smc.c
>> +++ b/drivers/mtd/spi-nor/controllers/aspeed-smc.c
>> @@ -399,7 +399,7 @@ static ssize_t aspeed_smc_write_user(struct spi_nor *nor, loff_t to,
>> return len;
>> }
>>
>> -static int aspeed_smc_unregister(struct aspeed_smc_controller *controller)
>> +static void aspeed_smc_unregister(struct aspeed_smc_controller *controller)
>> {
>> struct aspeed_smc_chip *chip;
>> int n;
>> @@ -409,13 +409,13 @@ static int aspeed_smc_unregister(struct aspeed_smc_controller *controller)
>> if (chip)
>> mtd_device_unregister(&chip->nor.mtd);
>> }
>> -
>> - return 0;
>> }
>>
>> static int aspeed_smc_remove(struct platform_device *dev)
>> {
>> - return aspeed_smc_unregister(platform_get_drvdata(dev));
>> + aspeed_smc_unregister(platform_get_drvdata(dev));
>> +
>> + return 0;
>> }
>>
>> static const struct of_device_id aspeed_smc_matches[] = {
>> --
>> 2.36.1
>>
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 08/14] mtd: rawnand: atmel: Warn about failure to unregister mtd device
2022-06-03 21:07 [PATCH 00/14] mtd: Fix platform remove callbacks to always return 0 Uwe Kleine-König
2022-06-03 21:07 ` [PATCH 02/14] mtd: spi-nor: aspeed-smc: Make aspeed_smc_unregister() return void Uwe Kleine-König
@ 2022-06-03 21:07 ` Uwe Kleine-König
2022-06-06 13:16 ` Miquel Raynal
2022-06-03 21:07 ` [PATCH 11/14] mtd: rawnand: meson: Don't skip cleanup after mtd_device_unregister() failed Uwe Kleine-König
` (2 subsequent siblings)
4 siblings, 1 reply; 15+ messages in thread
From: Uwe Kleine-König @ 2022-06-03 21:07 UTC (permalink / raw)
To: Tudor Ambarus, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra, Nicolas Ferre, Alexandre Belloni,
Claudiu Beznea
Cc: kernel, linux-mtd, linux-arm-kernel
The Linux device core doesn't intend remove callbacks to fail. If an
error code is returned the device is removed anyhow. So wail loudly if
the atmel specific remove callback fails and return 0 anyhow to suppress
the generic (and little helpful) error message by the device core.
Also check the remove callback to actually exist before calling it. That
might happen if nc->caps->ops points to atmel_nand_controller_ops.
This is a preparation for making platform remove callbacks return void.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/mtd/nand/raw/atmel/nand-controller.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/nand/raw/atmel/nand-controller.c b/drivers/mtd/nand/raw/atmel/nand-controller.c
index 6ef14442c71a..bc6ee694f4e2 100644
--- a/drivers/mtd/nand/raw/atmel/nand-controller.c
+++ b/drivers/mtd/nand/raw/atmel/nand-controller.c
@@ -2629,7 +2629,10 @@ static int atmel_nand_controller_remove(struct platform_device *pdev)
{
struct atmel_nand_controller *nc = platform_get_drvdata(pdev);
- return nc->caps->ops->remove(nc);
+ if (nc->caps->ops->remove)
+ WARN_ON(nc->caps->ops->remove(nc));
+
+ return 0;
}
static __maybe_unused int atmel_nand_controller_resume(struct device *dev)
--
2.36.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 15+ messages in thread* Re: [PATCH 08/14] mtd: rawnand: atmel: Warn about failure to unregister mtd device
2022-06-03 21:07 ` [PATCH 08/14] mtd: rawnand: atmel: Warn about failure to unregister mtd device Uwe Kleine-König
@ 2022-06-06 13:16 ` Miquel Raynal
2022-06-06 19:37 ` Uwe Kleine-König
0 siblings, 1 reply; 15+ messages in thread
From: Miquel Raynal @ 2022-06-06 13:16 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Alexandre Belloni, Vignesh Raghavendra, Tudor Ambarus,
Richard Weinberger, linux-mtd, kernel, Claudiu Beznea,
linux-arm-kernel
Hi Uwe,
u.kleine-koenig@pengutronix.de wrote on Fri, 3 Jun 2022 23:07:52 +0200:
> The Linux device core doesn't intend remove callbacks to fail. If an
> error code is returned the device is removed anyhow. So wail loudly if
> the atmel specific remove callback fails and return 0 anyhow to suppress
> the generic (and little helpful) error message by the device core.
>
> Also check the remove callback to actually exist before calling it. That
> might happen if nc->caps->ops points to atmel_nand_controller_ops.
I believe you got mislead by grepping the code because there is:
* struct nand_controller_ops atmel_nand_controller_ops
-> this is a NAND-wide controller ops structure
* struct atmel_nand_controller_ops atmel_<smtg>_nc_ops
-> this is a driver specific structure to provide different
registration helpers.
The latter always provide a probe and a remove implementation, so I
believe the addition if the "if (nc->caps->ops->remove)" check is not
relevant, unless I missed something.
> This is a preparation for making platform remove callbacks return void.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> drivers/mtd/nand/raw/atmel/nand-controller.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/nand/raw/atmel/nand-controller.c b/drivers/mtd/nand/raw/atmel/nand-controller.c
> index 6ef14442c71a..bc6ee694f4e2 100644
> --- a/drivers/mtd/nand/raw/atmel/nand-controller.c
> +++ b/drivers/mtd/nand/raw/atmel/nand-controller.c
> @@ -2629,7 +2629,10 @@ static int atmel_nand_controller_remove(struct platform_device *pdev)
> {
> struct atmel_nand_controller *nc = platform_get_drvdata(pdev);
>
> - return nc->caps->ops->remove(nc);
> + if (nc->caps->ops->remove)
> + WARN_ON(nc->caps->ops->remove(nc));
> +
> + return 0;
> }
>
> static __maybe_unused int atmel_nand_controller_resume(struct device *dev)
Thanks,
Miquèl
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 15+ messages in thread* Re: [PATCH 08/14] mtd: rawnand: atmel: Warn about failure to unregister mtd device
2022-06-06 13:16 ` Miquel Raynal
@ 2022-06-06 19:37 ` Uwe Kleine-König
2022-06-07 6:14 ` Miquel Raynal
0 siblings, 1 reply; 15+ messages in thread
From: Uwe Kleine-König @ 2022-06-06 19:37 UTC (permalink / raw)
To: Miquel Raynal
Cc: Alexandre Belloni, Vignesh Raghavendra, Tudor Ambarus,
Richard Weinberger, linux-mtd, kernel, Claudiu Beznea,
linux-arm-kernel
[-- Attachment #1.1: Type: text/plain, Size: 1591 bytes --]
On Mon, Jun 06, 2022 at 03:16:20PM +0200, Miquel Raynal wrote:
> Hi Uwe,
>
> u.kleine-koenig@pengutronix.de wrote on Fri, 3 Jun 2022 23:07:52 +0200:
>
> > The Linux device core doesn't intend remove callbacks to fail. If an
> > error code is returned the device is removed anyhow. So wail loudly if
> > the atmel specific remove callback fails and return 0 anyhow to suppress
> > the generic (and little helpful) error message by the device core.
> >
> > Also check the remove callback to actually exist before calling it. That
> > might happen if nc->caps->ops points to atmel_nand_controller_ops.
>
> I believe you got mislead by grepping the code because there is:
>
> * struct nand_controller_ops atmel_nand_controller_ops
> -> this is a NAND-wide controller ops structure
>
> * struct atmel_nand_controller_ops atmel_<smtg>_nc_ops
> -> this is a driver specific structure to provide different
> registration helpers.
>
> The latter always provide a probe and a remove implementation, so I
> believe the addition if the "if (nc->caps->ops->remove)" check is not
> relevant, unless I missed something.
You're right. I assume it's easiest for you if I send a v2 with all 14
patches? If you consider this a waste of bytes, please advise. The
patches are independant, so it would work if you pick up 1-7 + 9-14,
too. Then I'd resend a fixed patch 8 individually.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 08/14] mtd: rawnand: atmel: Warn about failure to unregister mtd device
2022-06-06 19:37 ` Uwe Kleine-König
@ 2022-06-07 6:14 ` Miquel Raynal
0 siblings, 0 replies; 15+ messages in thread
From: Miquel Raynal @ 2022-06-07 6:14 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Alexandre Belloni, Vignesh Raghavendra, Tudor Ambarus,
Richard Weinberger, linux-mtd, kernel, Claudiu Beznea,
linux-arm-kernel
Hi Uwe,
u.kleine-koenig@pengutronix.de wrote on Mon, 6 Jun 2022 21:37:21 +0200:
> On Mon, Jun 06, 2022 at 03:16:20PM +0200, Miquel Raynal wrote:
> > Hi Uwe,
> >
> > u.kleine-koenig@pengutronix.de wrote on Fri, 3 Jun 2022 23:07:52 +0200:
> >
> > > The Linux device core doesn't intend remove callbacks to fail. If an
> > > error code is returned the device is removed anyhow. So wail loudly if
> > > the atmel specific remove callback fails and return 0 anyhow to suppress
> > > the generic (and little helpful) error message by the device core.
> > >
> > > Also check the remove callback to actually exist before calling it. That
> > > might happen if nc->caps->ops points to atmel_nand_controller_ops.
> >
> > I believe you got mislead by grepping the code because there is:
> >
> > * struct nand_controller_ops atmel_nand_controller_ops
> > -> this is a NAND-wide controller ops structure
> >
> > * struct atmel_nand_controller_ops atmel_<smtg>_nc_ops
> > -> this is a driver specific structure to provide different
> > registration helpers.
> >
> > The latter always provide a probe and a remove implementation, so I
> > believe the addition if the "if (nc->caps->ops->remove)" check is not
> > relevant, unless I missed something.
>
> You're right. I assume it's easiest for you if I send a v2 with all 14
> patches? If you consider this a waste of bytes, please advise. The
> patches are independant, so it would work if you pick up 1-7 + 9-14,
> too. Then I'd resend a fixed patch 8 individually.
Please just resend patch 8, I'll handle it.
>
> Best regards
> Uwe
>
Thanks,
Miquèl
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 11/14] mtd: rawnand: meson: Don't skip cleanup after mtd_device_unregister() failed
2022-06-03 21:07 [PATCH 00/14] mtd: Fix platform remove callbacks to always return 0 Uwe Kleine-König
2022-06-03 21:07 ` [PATCH 02/14] mtd: spi-nor: aspeed-smc: Make aspeed_smc_unregister() return void Uwe Kleine-König
2022-06-03 21:07 ` [PATCH 08/14] mtd: rawnand: atmel: Warn about failure to unregister mtd device Uwe Kleine-König
@ 2022-06-03 21:07 ` Uwe Kleine-König
2022-06-09 13:09 ` Miquel Raynal
2022-06-03 21:07 ` [PATCH 12/14] mtd: rawnand: meson: Drop cleaning platform data in .remove() Uwe Kleine-König
2022-06-06 13:18 ` [PATCH 00/14] mtd: Fix platform remove callbacks to always return 0 Miquel Raynal
4 siblings, 1 reply; 15+ messages in thread
From: Uwe Kleine-König @ 2022-06-03 21:07 UTC (permalink / raw)
To: Liang Yang, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra, Neil Armstrong, Kevin Hilman
Cc: kernel, Jerome Brunet, Martin Blumenstingl, linux-mtd,
linux-arm-kernel, linux-amlogic
If mtd_device_unregister() fails (which it doesn't when used correctly),
the resources bound by the nand chip should be freed anyhow as returning
an error value doesn't prevent the device getting unbound.
Instead use WARN_ON on the return value similar to how other drivers do
it. Then meson_nfc_nand_chip_cleanup() returns 0 unconditionally and can
be changed to return void which allows further simplification in the
remove callback.
This is a preparation for making platform remove callbacks return void.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/mtd/nand/raw/meson_nand.c | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c
index ac3be92872d0..748e115b0bb7 100644
--- a/drivers/mtd/nand/raw/meson_nand.c
+++ b/drivers/mtd/nand/raw/meson_nand.c
@@ -1293,26 +1293,21 @@ meson_nfc_nand_chip_init(struct device *dev,
return 0;
}
-static int meson_nfc_nand_chip_cleanup(struct meson_nfc *nfc)
+static void meson_nfc_nand_chip_cleanup(struct meson_nfc *nfc)
{
struct meson_nfc_nand_chip *meson_chip;
struct mtd_info *mtd;
- int ret;
while (!list_empty(&nfc->chips)) {
meson_chip = list_first_entry(&nfc->chips,
struct meson_nfc_nand_chip, node);
mtd = nand_to_mtd(&meson_chip->nand);
- ret = mtd_device_unregister(mtd);
- if (ret)
- return ret;
+ WARN_ON(mtd_device_unregister(mtd));
meson_nfc_free_buffer(&meson_chip->nand);
nand_cleanup(&meson_chip->nand);
list_del(&meson_chip->node);
}
-
- return 0;
}
static int meson_nfc_nand_chips_init(struct device *dev,
@@ -1445,11 +1440,8 @@ static int meson_nfc_probe(struct platform_device *pdev)
static int meson_nfc_remove(struct platform_device *pdev)
{
struct meson_nfc *nfc = platform_get_drvdata(pdev);
- int ret;
- ret = meson_nfc_nand_chip_cleanup(nfc);
- if (ret)
- return ret;
+ meson_nfc_nand_chip_cleanup(nfc);
meson_nfc_disable_clk(nfc);
--
2.36.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 15+ messages in thread* Re: [PATCH 11/14] mtd: rawnand: meson: Don't skip cleanup after mtd_device_unregister() failed
2022-06-03 21:07 ` [PATCH 11/14] mtd: rawnand: meson: Don't skip cleanup after mtd_device_unregister() failed Uwe Kleine-König
@ 2022-06-09 13:09 ` Miquel Raynal
0 siblings, 0 replies; 15+ messages in thread
From: Miquel Raynal @ 2022-06-09 13:09 UTC (permalink / raw)
To: Uwe Kleine-König, Liang Yang, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra, Neil Armstrong,
Kevin Hilman
Cc: kernel, Jerome Brunet, Martin Blumenstingl, linux-mtd,
linux-arm-kernel, linux-amlogic
On Fri, 2022-06-03 at 21:07:55 UTC, =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= wrote:
> If mtd_device_unregister() fails (which it doesn't when used correctly),
> the resources bound by the nand chip should be freed anyhow as returning
> an error value doesn't prevent the device getting unbound.
>
> Instead use WARN_ON on the return value similar to how other drivers do
> it. Then meson_nfc_nand_chip_cleanup() returns 0 unconditionally and can
> be changed to return void which allows further simplification in the
> remove callback.
>
> This is a preparation for making platform remove callbacks return void.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks.
Miquel
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 12/14] mtd: rawnand: meson: Drop cleaning platform data in .remove()
2022-06-03 21:07 [PATCH 00/14] mtd: Fix platform remove callbacks to always return 0 Uwe Kleine-König
` (2 preceding siblings ...)
2022-06-03 21:07 ` [PATCH 11/14] mtd: rawnand: meson: Don't skip cleanup after mtd_device_unregister() failed Uwe Kleine-König
@ 2022-06-03 21:07 ` Uwe Kleine-König
2022-06-09 13:09 ` Miquel Raynal
2022-06-06 13:18 ` [PATCH 00/14] mtd: Fix platform remove callbacks to always return 0 Miquel Raynal
4 siblings, 1 reply; 15+ messages in thread
From: Uwe Kleine-König @ 2022-06-03 21:07 UTC (permalink / raw)
To: Liang Yang, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra, Neil Armstrong, Kevin Hilman
Cc: kernel, Jerome Brunet, Martin Blumenstingl, linux-mtd,
linux-arm-kernel, linux-amlogic
The driver core cares for unsetting platform data (see
device_unbind_cleanup()) on remove.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/mtd/nand/raw/meson_nand.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c
index 748e115b0bb7..4e6d1a6a19c7 100644
--- a/drivers/mtd/nand/raw/meson_nand.c
+++ b/drivers/mtd/nand/raw/meson_nand.c
@@ -1445,8 +1445,6 @@ static int meson_nfc_remove(struct platform_device *pdev)
meson_nfc_disable_clk(nfc);
- platform_set_drvdata(pdev, NULL);
-
return 0;
}
--
2.36.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 15+ messages in thread* Re: [PATCH 12/14] mtd: rawnand: meson: Drop cleaning platform data in .remove()
2022-06-03 21:07 ` [PATCH 12/14] mtd: rawnand: meson: Drop cleaning platform data in .remove() Uwe Kleine-König
@ 2022-06-09 13:09 ` Miquel Raynal
0 siblings, 0 replies; 15+ messages in thread
From: Miquel Raynal @ 2022-06-09 13:09 UTC (permalink / raw)
To: Uwe Kleine-König, Liang Yang, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra, Neil Armstrong,
Kevin Hilman
Cc: kernel, Jerome Brunet, Martin Blumenstingl, linux-mtd,
linux-arm-kernel, linux-amlogic
On Fri, 2022-06-03 at 21:07:56 UTC, =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= wrote:
> The driver core cares for unsetting platform data (see
> device_unbind_cleanup()) on remove.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks.
Miquel
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 00/14] mtd: Fix platform remove callbacks to always return 0
2022-06-03 21:07 [PATCH 00/14] mtd: Fix platform remove callbacks to always return 0 Uwe Kleine-König
` (3 preceding siblings ...)
2022-06-03 21:07 ` [PATCH 12/14] mtd: rawnand: meson: Drop cleaning platform data in .remove() Uwe Kleine-König
@ 2022-06-06 13:18 ` Miquel Raynal
2022-06-07 9:32 ` Pratyush Yadav
4 siblings, 1 reply; 15+ messages in thread
From: Miquel Raynal @ 2022-06-06 13:18 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Alexandre Belloni, Lucas Stach, Vignesh Raghavendra, linux-aspeed,
Neil Armstrong, Benjamin Herrenschmidt, Stefan Agner,
Thierry Reding, linux-mtd, Jerome Brunet, Michael Ellerman,
Jonathan Hunter, Joel Stanley, Kevin Hilman, Tudor Ambarus,
Martin Blumenstingl, linux-tegra, linux-amlogic, linux-arm-kernel,
Andrew Jeffery, Pratyush Yadav, Michael Walle, Liang Yang, kernel,
Richard Weinberger, Paul Mackerras, linuxppc-dev, Claudiu Beznea
Hi Folks,
u.kleine-koenig@pengutronix.de wrote on Fri, 3 Jun 2022 23:07:44 +0200:
> Hello,
>
> this series prepares to make platform remove callbacks return void.
> Therefor first update them to always return 0. The rationale is that the
> Linux device model doesn't handle failures on remove and if a remove
> callback returns an error, it just emits a quite generic error message
> and still removes the device.
Tudor, Pratyush, Richard, Vignesh,
The series looks good to me (besides the atmel patch), I think it's
best to take it directly through mtd/next instead of going through all
the different internal branches, please let me know if you disagree
with the idea.
Cheers,
Miquèl
>
> Best regards
> Uwe
>
> Uwe Kleine-König (14):
> mtd: hyperbus: Make hyperbus_unregister_device() return void
> mtd: spi-nor: aspeed-smc: Make aspeed_smc_unregister() return void
> mtd: powernv_flash: Warn about failure to unregister mtd device
> mtd: st-spi_fsm: Warn about failure to unregister mtd device
> mtd: lpddr2_nvm: Warn about failure to unregister mtd device
> mtd: spear_smi: Don't skip cleanup after mtd_device_unregister()
> failed
> mtd: spear_smi: Drop if with an always false condition
> mtd: rawnand: atmel: Warn about failure to unregister mtd device
> mtd: rawnand: omap2: Suppress error message after WARN in .remove()
> mtd: rawnand: tegra: Don't skip cleanup after mtd_device_unregister()
> failed
> mtd: rawnand: meson: Don't skip cleanup after mtd_device_unregister()
> failed
> mtd: rawnand: meson: Drop cleaning platform data in .remove()
> mtd: physmap: Don't skip cleanup after mtd_device_unregister() failed
> mtd: physmap: Drop if with an always false condition
>
> drivers/mtd/devices/powernv_flash.c | 4 +++-
> drivers/mtd/devices/spear_smi.c | 10 ++--------
> drivers/mtd/devices/st_spi_fsm.c | 4 +++-
> drivers/mtd/hyperbus/hbmc-am654.c | 6 +++---
> drivers/mtd/hyperbus/hyperbus-core.c | 8 ++------
> drivers/mtd/hyperbus/rpc-if.c | 5 +++--
> drivers/mtd/lpddr/lpddr2_nvm.c | 4 +++-
> drivers/mtd/maps/physmap-core.c | 13 +++----------
> drivers/mtd/nand/raw/atmel/nand-controller.c | 5 ++++-
> drivers/mtd/nand/raw/meson_nand.c | 16 +++-------------
> drivers/mtd/nand/raw/omap2.c | 6 ++----
> drivers/mtd/nand/raw/tegra_nand.c | 5 +----
> drivers/mtd/spi-nor/controllers/aspeed-smc.c | 8 ++++----
> include/linux/mtd/hyperbus.h | 4 +---
> 14 files changed, 37 insertions(+), 61 deletions(-)
>
> base-commit: 4b0986a3613c92f4ec1bdc7f60ec66fea135991f
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 15+ messages in thread* Re: [PATCH 00/14] mtd: Fix platform remove callbacks to always return 0
2022-06-06 13:18 ` [PATCH 00/14] mtd: Fix platform remove callbacks to always return 0 Miquel Raynal
@ 2022-06-07 9:32 ` Pratyush Yadav
2022-06-07 10:47 ` Miquel Raynal
0 siblings, 1 reply; 15+ messages in thread
From: Pratyush Yadav @ 2022-06-07 9:32 UTC (permalink / raw)
To: Miquel Raynal
Cc: Alexandre Belloni, Lucas Stach, Vignesh Raghavendra, linux-aspeed,
Neil Armstrong, Benjamin Herrenschmidt, Stefan Agner,
Thierry Reding, linux-mtd, Jerome Brunet, Michael Ellerman,
Jonathan Hunter, Joel Stanley, Uwe Kleine-König,
Kevin Hilman, Tudor Ambarus, Martin Blumenstingl, linux-tegra,
linux-amlogic, linux-arm-kernel, Andrew Jeffery, Michael Walle,
Liang Yang, kernel, Richard Weinberger, Paul Mackerras,
linuxppc-dev, Claudiu Beznea
Hi Miquel,
On 06/06/22 03:18PM, Miquel Raynal wrote:
> Hi Folks,
>
> u.kleine-koenig@pengutronix.de wrote on Fri, 3 Jun 2022 23:07:44 +0200:
>
> > Hello,
> >
> > this series prepares to make platform remove callbacks return void.
> > Therefor first update them to always return 0. The rationale is that the
> > Linux device model doesn't handle failures on remove and if a remove
> > callback returns an error, it just emits a quite generic error message
> > and still removes the device.
>
> Tudor, Pratyush, Richard, Vignesh,
>
> The series looks good to me (besides the atmel patch), I think it's
> best to take it directly through mtd/next instead of going through all
> the different internal branches, please let me know if you disagree
> with the idea.
Patch 2 does not look good to me. It modifies the aspeed-smc driver in
drivers/mtd/spi-nor/controllers/ but the driver has been moved to
drivers/spi/ in Mark's next branch [0]. The patch would likely conflict
with that.
[0] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit?id=9c63b846e6df43e5b3d31263f7db545f32deeda3
>
> Cheers,
> Miquèl
>
> >
> > Best regards
> > Uwe
> >
> > Uwe Kleine-König (14):
> > mtd: hyperbus: Make hyperbus_unregister_device() return void
> > mtd: spi-nor: aspeed-smc: Make aspeed_smc_unregister() return void
> > mtd: powernv_flash: Warn about failure to unregister mtd device
> > mtd: st-spi_fsm: Warn about failure to unregister mtd device
> > mtd: lpddr2_nvm: Warn about failure to unregister mtd device
> > mtd: spear_smi: Don't skip cleanup after mtd_device_unregister()
> > failed
> > mtd: spear_smi: Drop if with an always false condition
> > mtd: rawnand: atmel: Warn about failure to unregister mtd device
> > mtd: rawnand: omap2: Suppress error message after WARN in .remove()
> > mtd: rawnand: tegra: Don't skip cleanup after mtd_device_unregister()
> > failed
> > mtd: rawnand: meson: Don't skip cleanup after mtd_device_unregister()
> > failed
> > mtd: rawnand: meson: Drop cleaning platform data in .remove()
> > mtd: physmap: Don't skip cleanup after mtd_device_unregister() failed
> > mtd: physmap: Drop if with an always false condition
> >
> > drivers/mtd/devices/powernv_flash.c | 4 +++-
> > drivers/mtd/devices/spear_smi.c | 10 ++--------
> > drivers/mtd/devices/st_spi_fsm.c | 4 +++-
> > drivers/mtd/hyperbus/hbmc-am654.c | 6 +++---
> > drivers/mtd/hyperbus/hyperbus-core.c | 8 ++------
> > drivers/mtd/hyperbus/rpc-if.c | 5 +++--
> > drivers/mtd/lpddr/lpddr2_nvm.c | 4 +++-
> > drivers/mtd/maps/physmap-core.c | 13 +++----------
> > drivers/mtd/nand/raw/atmel/nand-controller.c | 5 ++++-
> > drivers/mtd/nand/raw/meson_nand.c | 16 +++-------------
> > drivers/mtd/nand/raw/omap2.c | 6 ++----
> > drivers/mtd/nand/raw/tegra_nand.c | 5 +----
> > drivers/mtd/spi-nor/controllers/aspeed-smc.c | 8 ++++----
> > include/linux/mtd/hyperbus.h | 4 +---
> > 14 files changed, 37 insertions(+), 61 deletions(-)
> >
> > base-commit: 4b0986a3613c92f4ec1bdc7f60ec66fea135991f
>
--
Regards,
Pratyush Yadav
Texas Instruments Inc.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 00/14] mtd: Fix platform remove callbacks to always return 0
2022-06-07 9:32 ` Pratyush Yadav
@ 2022-06-07 10:47 ` Miquel Raynal
0 siblings, 0 replies; 15+ messages in thread
From: Miquel Raynal @ 2022-06-07 10:47 UTC (permalink / raw)
To: Pratyush Yadav
Cc: Alexandre Belloni, Lucas Stach, Vignesh Raghavendra, linux-aspeed,
Neil Armstrong, Benjamin Herrenschmidt, Stefan Agner,
Thierry Reding, linux-mtd, Jerome Brunet, Michael Ellerman,
Jonathan Hunter, Joel Stanley, Uwe Kleine-König,
Kevin Hilman, Tudor Ambarus, Martin Blumenstingl, linux-tegra,
linux-amlogic, linux-arm-kernel, Andrew Jeffery, Michael Walle,
Liang Yang, kernel, Richard Weinberger, Paul Mackerras,
linuxppc-dev, Claudiu Beznea
Hi Pratyush, Uwe,
p.yadav@ti.com wrote on Tue, 7 Jun 2022 15:02:36 +0530:
> Hi Miquel,
>
> On 06/06/22 03:18PM, Miquel Raynal wrote:
> > Hi Folks,
> >
> > u.kleine-koenig@pengutronix.de wrote on Fri, 3 Jun 2022 23:07:44 +0200:
> >
> > > Hello,
> > >
> > > this series prepares to make platform remove callbacks return void.
> > > Therefor first update them to always return 0. The rationale is that the
> > > Linux device model doesn't handle failures on remove and if a remove
> > > callback returns an error, it just emits a quite generic error message
> > > and still removes the device.
> >
> > Tudor, Pratyush, Richard, Vignesh,
> >
> > The series looks good to me (besides the atmel patch), I think it's
> > best to take it directly through mtd/next instead of going through all
> > the different internal branches, please let me know if you disagree
> > with the idea.
>
> Patch 2 does not look good to me. It modifies the aspeed-smc driver in
> drivers/mtd/spi-nor/controllers/ but the driver has been moved to
> drivers/spi/ in Mark's next branch [0]. The patch would likely conflict
> with that.
>
> [0] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit?id=9c63b846e6df43e5b3d31263f7db545f32deeda3
Right, I believe Uwe is sending per-subsystems series so now that he is
aware we can safely drop patch 2.
Thanks,
Miquèl
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 15+ messages in thread