Message ID | 20220707061441.193869-2-u.kleine-koenig@pengutronix.de (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | [1/3] powerpc/platforms/83xx/suspend: Reorder to get rid of a forward declaration | expand |
Le 07/07/2022 à 08:14, Uwe Kleine-König a écrit : > Returning an error in .remove() doesn't prevent a driver from being > unloaded. On unbind this only results in an error message, but the > device is remove anyhow. > > I guess the author's idea of just returning -EPERM in .remove() was to > prevent unbinding a device. To achieve that set the suppress_bind_attrs > driver property and drop the useless .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> Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu> > --- > arch/powerpc/platforms/83xx/suspend.c | 7 +------ > 1 file changed, 1 insertion(+), 6 deletions(-) > > diff --git a/arch/powerpc/platforms/83xx/suspend.c b/arch/powerpc/platforms/83xx/suspend.c > index 30b7700a2c98..309f42ab63d4 100644 > --- a/arch/powerpc/platforms/83xx/suspend.c > +++ b/arch/powerpc/platforms/83xx/suspend.c > @@ -421,18 +421,13 @@ static int pmc_probe(struct platform_device *ofdev) > return ret; > } > > -static int pmc_remove(struct platform_device *ofdev) > -{ > - return -EPERM; > -}; > - > static struct platform_driver pmc_driver = { > .driver = { > .name = "mpc83xx-pmc", > .of_match_table = pmc_match, > + .suppress_bind_attrs = true, > }, > .probe = pmc_probe, > - .remove = pmc_remove > }; > > builtin_platform_driver(pmc_driver);
On Thu, 2022-07-07 at 08:14 +0200, Uwe Kleine-König wrote: > Returning an error in .remove() doesn't prevent a driver from being > unloaded. On unbind this only results in an error message, but the > device is remove anyhow. > > I guess the author's idea of just returning -EPERM in .remove() was to > prevent unbinding a device. To achieve that set the suppress_bind_attrs > driver property and drop the useless .remove callback. I don't remember if I thought it would prevent removal, or if it was just the only thing I could do to signal that removing it would be a bad idea (albeit of relatively little consequence since it can't be built as a module). suppress_bind_attrs didn't exist back then. :-) In any case, Acked-by: Scott Wood <oss@buserror.net> -Scott
diff --git a/arch/powerpc/platforms/83xx/suspend.c b/arch/powerpc/platforms/83xx/suspend.c index 30b7700a2c98..309f42ab63d4 100644 --- a/arch/powerpc/platforms/83xx/suspend.c +++ b/arch/powerpc/platforms/83xx/suspend.c @@ -421,18 +421,13 @@ static int pmc_probe(struct platform_device *ofdev) return ret; } -static int pmc_remove(struct platform_device *ofdev) -{ - return -EPERM; -}; - static struct platform_driver pmc_driver = { .driver = { .name = "mpc83xx-pmc", .of_match_table = pmc_match, + .suppress_bind_attrs = true, }, .probe = pmc_probe, - .remove = pmc_remove }; builtin_platform_driver(pmc_driver);
Returning an error in .remove() doesn't prevent a driver from being unloaded. On unbind this only results in an error message, but the device is remove anyhow. I guess the author's idea of just returning -EPERM in .remove() was to prevent unbinding a device. To achieve that set the suppress_bind_attrs driver property and drop the useless .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> --- arch/powerpc/platforms/83xx/suspend.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)