* [PATCH 00/14] mtd: Fix platform remove callbacks to always return 0
@ 2022-06-03 21:07 Uwe Kleine-König
2022-06-03 21:07 ` [PATCH 10/14] mtd: rawnand: tegra: Don't skip cleanup after mtd_device_unregister() failed Uwe Kleine-König
2022-06-06 13:18 ` [PATCH 00/14] mtd: Fix platform remove callbacks to always return 0 Miquel Raynal
0 siblings, 2 replies; 6+ messages in thread
From: Uwe Kleine-König @ 2022-06-03 21:07 UTC (permalink / raw)
To: Vignesh Raghavendra, Miquel Raynal, Richard Weinberger,
Tudor Ambarus, Pratyush Yadav, Joel Stanley, Michael Ellerman,
Nicolas Ferre, Alexandre Belloni, Claudiu Beznea, Stefan Agner,
Lucas Stach, Thierry Reding, Jonathan Hunter, Liang Yang,
Neil Armstrong, Kevin Hilman
Cc: kernel, linux-mtd, Michael Walle, Andrew Jeffery,
linux-arm-kernel, linux-aspeed, Benjamin Herrenschmidt,
Paul Mackerras, linuxppc-dev, linux-tegra, Jerome Brunet,
Martin Blumenstingl, linux-amlogic
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.
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
--
2.36.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 10/14] mtd: rawnand: tegra: 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 ` 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
1 sibling, 1 reply; 6+ messages in thread
From: Uwe Kleine-König @ 2022-06-03 21:07 UTC (permalink / raw)
To: Stefan Agner, Lucas Stach, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra, Thierry Reding, Jonathan Hunter
Cc: kernel, linux-mtd, linux-tegra
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.
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/tegra_nand.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/mtd/nand/raw/tegra_nand.c b/drivers/mtd/nand/raw/tegra_nand.c
index b36e5260ae27..e12f9f580a15 100644
--- a/drivers/mtd/nand/raw/tegra_nand.c
+++ b/drivers/mtd/nand/raw/tegra_nand.c
@@ -1223,11 +1223,8 @@ static int tegra_nand_remove(struct platform_device *pdev)
struct tegra_nand_controller *ctrl = platform_get_drvdata(pdev);
struct nand_chip *chip = ctrl->chip;
struct mtd_info *mtd = nand_to_mtd(chip);
- int ret;
- ret = mtd_device_unregister(mtd);
- if (ret)
- return ret;
+ WARN_ON(mtd_device_unregister(mtd));
nand_cleanup(chip);
--
2.36.1
^ permalink raw reply related [flat|nested] 6+ 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
2022-06-03 21:07 ` [PATCH 10/14] mtd: rawnand: tegra: Don't skip cleanup after mtd_device_unregister() failed Uwe Kleine-König
@ 2022-06-06 13:18 ` Miquel Raynal
2022-06-07 9:32 ` Pratyush Yadav
1 sibling, 1 reply; 6+ messages in thread
From: Miquel Raynal @ 2022-06-06 13:18 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Vignesh Raghavendra, Richard Weinberger, Tudor Ambarus,
Pratyush Yadav, Joel Stanley, Michael Ellerman, Nicolas Ferre,
Alexandre Belloni, Claudiu Beznea, Stefan Agner, Lucas Stach,
Thierry Reding, Jonathan Hunter, Liang Yang, Neil Armstrong,
Kevin Hilman, kernel, linux-mtd, Michael Walle, Andrew Jeffery,
linux-arm-kernel, linux-aspeed, Benjamin Herrenschmidt,
Paul Mackerras, linuxppc-dev, linux-tegra, Jerome Brunet,
Martin Blumenstingl, linux-amlogic
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
^ permalink raw reply [flat|nested] 6+ 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; 6+ messages in thread
From: Pratyush Yadav @ 2022-06-07 9:32 UTC (permalink / raw)
To: Miquel Raynal
Cc: Uwe Kleine-König, Vignesh Raghavendra, Richard Weinberger,
Tudor Ambarus, Joel Stanley, Michael Ellerman, Nicolas Ferre,
Alexandre Belloni, Claudiu Beznea, Stefan Agner, Lucas Stach,
Thierry Reding, Jonathan Hunter, Liang Yang, Neil Armstrong,
Kevin Hilman, kernel, linux-mtd, Michael Walle, Andrew Jeffery,
linux-arm-kernel, linux-aspeed, Benjamin Herrenschmidt,
Paul Mackerras, linuxppc-dev, linux-tegra, Jerome Brunet,
Martin Blumenstingl, linux-amlogic
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.
^ permalink raw reply [flat|nested] 6+ 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; 6+ messages in thread
From: Miquel Raynal @ 2022-06-07 10:47 UTC (permalink / raw)
To: Pratyush Yadav
Cc: Uwe Kleine-König, Vignesh Raghavendra, Richard Weinberger,
Tudor Ambarus, Joel Stanley, Michael Ellerman, Nicolas Ferre,
Alexandre Belloni, Claudiu Beznea, Stefan Agner, Lucas Stach,
Thierry Reding, Jonathan Hunter, Liang Yang, Neil Armstrong,
Kevin Hilman, kernel, linux-mtd, Michael Walle, Andrew Jeffery,
linux-arm-kernel, linux-aspeed, Benjamin Herrenschmidt,
Paul Mackerras, linuxppc-dev, linux-tegra, Jerome Brunet,
Martin Blumenstingl, linux-amlogic
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 10/14] mtd: rawnand: tegra: Don't skip cleanup after mtd_device_unregister() failed
2022-06-03 21:07 ` [PATCH 10/14] mtd: rawnand: tegra: Don't skip cleanup after mtd_device_unregister() failed Uwe Kleine-König
@ 2022-06-09 13:09 ` Miquel Raynal
0 siblings, 0 replies; 6+ messages in thread
From: Miquel Raynal @ 2022-06-09 13:09 UTC (permalink / raw)
To: Uwe Kleine-König, Stefan Agner, Lucas Stach, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra, Thierry Reding,
Jonathan Hunter
Cc: kernel, linux-mtd, linux-tegra
On Fri, 2022-06-03 at 21:07:54 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.
>
> 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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-06-09 13:09 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 10/14] mtd: rawnand: tegra: Don't skip cleanup after mtd_device_unregister() failed 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
2022-06-07 9:32 ` Pratyush Yadav
2022-06-07 10:47 ` Miquel Raynal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox