Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/platforms/83xx/suspend: Prevent unloading the 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>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Acked-by: Scott Wood <oss@buserror.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220707061441.193869-2-u.kleine-koenig@pengutronix.de

authored by

Uwe Kleine-König and committed by
Michael Ellerman
ccc1439b fde345e4

+1 -6
+1 -6
arch/powerpc/platforms/83xx/suspend.c
··· 421 421 return ret; 422 422 } 423 423 424 - static int pmc_remove(struct platform_device *ofdev) 425 - { 426 - return -EPERM; 427 - }; 428 - 429 424 static struct platform_driver pmc_driver = { 430 425 .driver = { 431 426 .name = "mpc83xx-pmc", 432 427 .of_match_table = pmc_match, 428 + .suppress_bind_attrs = true, 433 429 }, 434 430 .probe = pmc_probe, 435 - .remove = pmc_remove 436 431 }; 437 432 438 433 builtin_platform_driver(pmc_driver);