diff mbox series

[3/3] media: meson-ir-tx: Drop usage of platform_driver_probe()

Message ID 20231026101816.2460464-8-u.kleine-koenig@pengutronix.de (mailing list archive)
State New, archived
Headers show
Series media: meson-ir-tx: Some cleanups and simplifications and a bug report | expand

Commit Message

Uwe Kleine-König Oct. 26, 2023, 10:18 a.m. UTC
The benefit of platform_driver_probe() here is only that the probe
function can be discarded after the driver is loaded. For an ARCH=arm
allmodconfig that's 952 bytes, for an allnoconfig + IR_MESON_TX=y it's
only 452 bytes. The downside is that the driver isn't dynamically
bindable and unbindable.

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 didn't benefit
as much as it could as of v6.6-rc1 as meson_irtx_remove() could have
been marked with __exit.)

The advantages are not that relevant any more today, so convert this
driver to an ordinary platform driver.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/media/rc/meson-ir-tx.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/drivers/media/rc/meson-ir-tx.c b/drivers/media/rc/meson-ir-tx.c
index bd85361d561f..fded2c256f2a 100644
--- a/drivers/media/rc/meson-ir-tx.c
+++ b/drivers/media/rc/meson-ir-tx.c
@@ -305,7 +305,7 @@  static int meson_irtx_mod_clock_probe(struct meson_irtx *ir,
 	return 0;
 }
 
-static int __init meson_irtx_probe(struct platform_device *pdev)
+static int meson_irtx_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct meson_irtx *ir;
@@ -375,13 +375,13 @@  static const struct of_device_id meson_irtx_dt_match[] = {
 MODULE_DEVICE_TABLE(of, meson_irtx_dt_match);
 
 static struct platform_driver meson_irtx_pd = {
+	.probe = meson_irtx_probe,
 	.driver = {
 		.name = DRIVER_NAME,
 		.of_match_table = meson_irtx_dt_match,
 	},
 };
-
-module_platform_driver_probe(meson_irtx_pd, meson_irtx_probe);
+module_platform_driver(meson_irtx_pd);
 
 MODULE_DESCRIPTION("Meson IR TX driver");
 MODULE_AUTHOR("Viktor Prutyanov <viktor.prutyanov@phystech.edu>");