Skip to contentSkip to conversation

Input: touchscreen: mc13783_ts.c: Convert to platform driver

PATCH New Fabio Estevam 1 participant 1 message Jan 7, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Input: touchscreen: mc13783_ts.c: Convert to platform driver

From: Fabio Estevam <[email protected]>

Using module_platform_driver() can make the code smaller and cleaner.

---
Changes since v1:
- Remove __init from probe function in order to avoid a section mismatch

 drivers/input/touchscreen/mc13783_ts.c |   15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)
drivers/input/touchscreen/mc13783_ts.c +3 -12
index 02103b6..9c2f74b 100644
@@ -168,7 +168,7 @@ static void mc13783_ts_close(struct input_dev *dev)
 	cancel_delayed_work_sync(&priv->work);
 }
 
-static int __init mc13783_ts_probe(struct platform_device *pdev)
+static int mc13783_ts_probe(struct platform_device *pdev)
 {
 	struct mc13783_ts_priv *priv;
 	struct input_dev *idev;
@@ -243,6 +243,7 @@ static int mc13783_ts_remove(struct platform_device *pdev)
 }
 
 static struct platform_driver mc13783_ts_driver = {
+	.probe		= mc13783_ts_probe,
 	.remove		= mc13783_ts_remove,
 	.driver		= {
 		.owner	= THIS_MODULE,
@@ -250,17 +251,7 @@ static struct platform_driver mc13783_ts_driver = {
 	},
 };
 
-static int __init mc13783_ts_init(void)
-{
-	return platform_driver_probe(&mc13783_ts_driver, &mc13783_ts_probe);
-}
-module_init(mc13783_ts_init);
-
-static void __exit mc13783_ts_exit(void)
-{
-	platform_driver_unregister(&mc13783_ts_driver);
-}
-module_exit(mc13783_ts_exit);
+module_platform_driver(mc13783_ts_driver);
 
 MODULE_DESCRIPTION("MC13783 input touchscreen driver");
 MODULE_AUTHOR("Sascha Hauer <[email protected]>");
Signature · 1 line
1.7.9.5