Skip to contentSkip to conversation

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

PATCH Superseded Fabio Estevam 2 participants 5 messages Jan 7, 2013

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 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.

---
 drivers/input/touchscreen/mc13783_ts.c |   13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)
drivers/input/touchscreen/mc13783_ts.c +2 -11
index 02103b6..e881c25 100644
@@ -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
maintainer
#1 lore raw

Hi Fabio,

Quoted 27 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

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

---
 drivers/input/touchscreen/mc13783_ts.c |   13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)
drivers/input/touchscreen/mc13783_ts.c +1 -2
index 02103b6..e881c25 100644
@@ -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)
-{

drivers/input/touchscreen/mc13783_ts.c static struct platform_driver mc13783_ts_driver = { · line 254

Quoted 10 lines
drivers/input/touchscreen/mc13783_ts.c +1 -9
-	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);

This is not equivalent transformation. Did you intend to change the behavior? If you this should be mentioned (and reasoned) in the patch description.

Thanks.

Signature · 1 line
Dmitry
#2 lore raw

Hi Dmitry,

Quoted 3 lines · Dmitry Torokhov

This is not equivalent transformation. Did you intend to change the behavior? If you this should be mentioned (and reasoned) in the patch description.

Sorry, do not understand why the behavior changes? Can you please explain?

maintainer
#3 lore raw
Quoted 10 lines · Fabio Estevam

Hi Dmitry,

Quoted 3 lines · Dmitry Torokhov

This is not equivalent transformation. Did you intend to change the behavior? If you this should be mentioned (and reasoned) in the patch description.

Sorry, do not understand why the behavior changes? Can you please explain?

module_platform_driver() internally uses platform_driver_register() whereas the original code used platform_driver_probe(). These 2 behave differently.

Signature · 1 line
Dmitry
#4 lore raw
Quoted 3 lines · Dmitry Torokhov

module_platform_driver() internally uses platform_driver_register() whereas the original code used platform_driver_probe(). These 2 behave differently.

Ok, got it. Please discard it.