diff mbox series

powerpc/52xx: Mark gpt driver as not removable

Message ID 20220612213400.159257-1-u.kleine-koenig@pengutronix.de (mailing list archive)
State Accepted
Headers show
Series powerpc/52xx: Mark gpt driver as not removable | expand

Checks

Context Check Description
snowpatch_ozlabs/github-powerpc_ppctests success Successfully ran 10 jobs.
snowpatch_ozlabs/github-powerpc_selftests success Successfully ran 10 jobs.
snowpatch_ozlabs/github-powerpc_sparse success Successfully ran 4 jobs.
snowpatch_ozlabs/github-powerpc_clang success Successfully ran 7 jobs.
snowpatch_ozlabs/github-powerpc_kernel_qemu success Successfully ran 23 jobs.

Commit Message

Uwe Kleine-König June 12, 2022, 9:34 p.m. UTC
Returning an error code (here -EBUSY) from a remove callback doesn't
prevent the driver from being unloaded. The only effect is that an error
message is emitted and the driver is removed anyhow.

So instead drop the remove function (which is equivalent to returning zero)
and set the suppress_bind_attrs property to make it impossible to unload
the driver via sysfs.

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/52xx/mpc52xx_gpt.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)


base-commit: f2906aa863381afb0015a9eb7fefad885d4e5a56

Comments

Christophe Leroy July 7, 2022, 8:50 a.m. UTC | #1
Le 12/06/2022 à 23:34, Uwe Kleine-König a écrit :
> Returning an error code (here -EBUSY) from a remove callback doesn't
> prevent the driver from being unloaded. The only effect is that an error
> message is emitted and the driver is removed anyhow.
> 
> So instead drop the remove function (which is equivalent to returning zero)
> and set the suppress_bind_attrs property to make it impossible to unload
> the driver via sysfs.
> 
> 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/52xx/mpc52xx_gpt.c | 7 +------
>   1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c
> index 968f5b727273..b2c24cab4b1e 100644
> --- a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c
> +++ b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c
> @@ -755,11 +755,6 @@ static int mpc52xx_gpt_probe(struct platform_device *ofdev)
>   	return 0;
>   }
>   
> -static int mpc52xx_gpt_remove(struct platform_device *ofdev)
> -{
> -	return -EBUSY;
> -}
> -
>   static const struct of_device_id mpc52xx_gpt_match[] = {
>   	{ .compatible = "fsl,mpc5200-gpt", },
>   
> @@ -772,10 +767,10 @@ static const struct of_device_id mpc52xx_gpt_match[] = {
>   static struct platform_driver mpc52xx_gpt_driver = {
>   	.driver = {
>   		.name = "mpc52xx-gpt",
> +		.suppress_bind_attrs = true,
>   		.of_match_table = mpc52xx_gpt_match,
>   	},
>   	.probe = mpc52xx_gpt_probe,
> -	.remove = mpc52xx_gpt_remove,
>   };
>   
>   static int __init mpc52xx_gpt_init(void)
> 
> base-commit: f2906aa863381afb0015a9eb7fefad885d4e5a56
Uwe Kleine-König July 14, 2022, 9:37 p.m. UTC | #2
hello,

On Sun, Jun 12, 2022 at 11:34:00PM +0200, Uwe Kleine-König wrote:
> Returning an error code (here -EBUSY) from a remove callback doesn't
> prevent the driver from being unloaded. The only effect is that an error
> message is emitted and the driver is removed anyhow.
> 
> So instead drop the remove function (which is equivalent to returning zero)
> and set the suppress_bind_attrs property to make it impossible to unload
> the driver via sysfs.
> 
> This is a preparation for making platform remove callbacks return void.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

This patch recived a (positive) review, but it's not included in next
nor got it any maintainer feedback. Did it fell through the cracks?

Best regards
Uwe
Michael Ellerman July 29, 2022, 1:01 p.m. UTC | #3
On Sun, 12 Jun 2022 23:34:00 +0200, Uwe Kleine-König wrote:
> Returning an error code (here -EBUSY) from a remove callback doesn't
> prevent the driver from being unloaded. The only effect is that an error
> message is emitted and the driver is removed anyhow.
> 
> So instead drop the remove function (which is equivalent to returning zero)
> and set the suppress_bind_attrs property to make it impossible to unload
> the driver via sysfs.
> 
> [...]

Applied to powerpc/next.

[1/1] powerpc/52xx: Mark gpt driver as not removable
      https://git.kernel.org/powerpc/c/1978c48495171165453a7c90d1345c1d8d776d02

cheers
diff mbox series

Patch

diff --git a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c
index 968f5b727273..b2c24cab4b1e 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c
@@ -755,11 +755,6 @@  static int mpc52xx_gpt_probe(struct platform_device *ofdev)
 	return 0;
 }
 
-static int mpc52xx_gpt_remove(struct platform_device *ofdev)
-{
-	return -EBUSY;
-}
-
 static const struct of_device_id mpc52xx_gpt_match[] = {
 	{ .compatible = "fsl,mpc5200-gpt", },
 
@@ -772,10 +767,10 @@  static const struct of_device_id mpc52xx_gpt_match[] = {
 static struct platform_driver mpc52xx_gpt_driver = {
 	.driver = {
 		.name = "mpc52xx-gpt",
+		.suppress_bind_attrs = true,
 		.of_match_table = mpc52xx_gpt_match,
 	},
 	.probe = mpc52xx_gpt_probe,
-	.remove = mpc52xx_gpt_remove,
 };
 
 static int __init mpc52xx_gpt_init(void)