diff mbox series

[v2] hwrng: mxc-rnga: Drop usage of platform_driver_probe()

Message ID 20240324161227.239718-2-u.kleine-koenig@pengutronix.de (mailing list archive)
State New, archived
Headers show
Series [v2] hwrng: mxc-rnga: Drop usage of platform_driver_probe() | expand

Commit Message

Uwe Kleine-König March 24, 2024, 4:12 p.m. UTC
There are considerations to drop platform_driver_probe() as a concept
that isn't relevant any more today. It comes with an added complexity
that makes many users hold it wrong. (E.g. this driver should have mark
the driver struct with __refdata.)

Convert the driver to the more usual module_platform_driver().

This fixes a W=1 build warning:

	WARNING: modpost: drivers/char/hw_random/mxc-rnga: section mismatch in reference: mxc_rnga_driver+0x10 (section: .data) -> mxc_rnga_remove (section: .exit.text)

with CONFIG_HW_RANDOM_MXC_RNGA=m.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
Hello,

while I indeed fixed the mentioned warning in (implicit) v1, I
introduced another one because I failed to drop __init from
mxc_rnga_probe. :-\

This is fixed here.

Best regards
Uwe

 drivers/char/hw_random/mxc-rnga.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)


base-commit: 70293240c5ce675a67bfc48f419b093023b862b3

Comments

Herbert Xu March 28, 2024, 10:58 a.m. UTC | #1
On Sun, Mar 24, 2024 at 05:12:26PM +0100, Uwe Kleine-König wrote:
> There are considerations to drop platform_driver_probe() as a concept
> that isn't relevant any more today. It comes with an added complexity
> that makes many users hold it wrong. (E.g. this driver should have mark
> the driver struct with __refdata.)
> 
> Convert the driver to the more usual module_platform_driver().
> 
> This fixes a W=1 build warning:
> 
> 	WARNING: modpost: drivers/char/hw_random/mxc-rnga: section mismatch in reference: mxc_rnga_driver+0x10 (section: .data) -> mxc_rnga_remove (section: .exit.text)
> 
> with CONFIG_HW_RANDOM_MXC_RNGA=m.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> Hello,
> 
> while I indeed fixed the mentioned warning in (implicit) v1, I
> introduced another one because I failed to drop __init from
> mxc_rnga_probe. :-\
> 
> This is fixed here.
> 
> Best regards
> Uwe
> 
>  drivers/char/hw_random/mxc-rnga.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)

Patch applied.  Thanks.
diff mbox series

Patch

diff --git a/drivers/char/hw_random/mxc-rnga.c b/drivers/char/hw_random/mxc-rnga.c
index 07ec000e4cd7..94ee18a1120a 100644
--- a/drivers/char/hw_random/mxc-rnga.c
+++ b/drivers/char/hw_random/mxc-rnga.c
@@ -131,7 +131,7 @@  static void mxc_rnga_cleanup(struct hwrng *rng)
 	__raw_writel(ctrl & ~RNGA_CONTROL_GO, mxc_rng->mem + RNGA_CONTROL);
 }
 
-static int __init mxc_rnga_probe(struct platform_device *pdev)
+static int mxc_rnga_probe(struct platform_device *pdev)
 {
 	int err;
 	struct mxc_rng *mxc_rng;
@@ -176,7 +176,7 @@  static int __init mxc_rnga_probe(struct platform_device *pdev)
 	return err;
 }
 
-static void __exit mxc_rnga_remove(struct platform_device *pdev)
+static void mxc_rnga_remove(struct platform_device *pdev)
 {
 	struct mxc_rng *mxc_rng = platform_get_drvdata(pdev);
 
@@ -197,10 +197,11 @@  static struct platform_driver mxc_rnga_driver = {
 		.name = "mxc_rnga",
 		.of_match_table = mxc_rnga_of_match,
 	},
-	.remove_new = __exit_p(mxc_rnga_remove),
+	.probe = mxc_rnga_probe,
+	.remove_new = mxc_rnga_remove,
 };
 
-module_platform_driver_probe(mxc_rnga_driver, mxc_rnga_probe);
+module_platform_driver(mxc_rnga_driver);
 
 MODULE_AUTHOR("Freescale Semiconductor, Inc.");
 MODULE_DESCRIPTION("H/W RNGA driver for i.MX");