[PATCH] Input: touchscreen: mc13783_ts.c: Convert to platform driver

Subsystems: input (keyboard, mouse, joystick, touchscreen) drivers, the rest

STALE5036d

5 messages, 2 authors, 2013-01-07 · open the first message on its own page

[PATCH] Input: touchscreen: mc13783_ts.c: Convert to platform driver

From: Fabio Estevam <festevam@gmail.com>
Date: 2013-01-07 20:33:13

From: Fabio Estevam <redacted>

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

Signed-off-by: Fabio Estevam <redacted>
---
 drivers/input/touchscreen/mc13783_ts.c |   13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)
diff --git a/drivers/input/touchscreen/mc13783_ts.c b/drivers/input/touchscreen/mc13783_ts.c
index 02103b6..e881c25 100644
--- a/drivers/input/touchscreen/mc13783_ts.c
+++ b/drivers/input/touchscreen/mc13783_ts.c
@@ -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 <s.hauer@pengutronix.de>");
-- 
1.7.9.5

Re: [PATCH] Input: touchscreen: mc13783_ts.c: Convert to platform driver

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: 2013-01-07 20:50:15

Hi Fabio,

On Mon, Jan 07, 2013 at 06:32:57PM -0200, Fabio Estevam wrote:
quoted hunk
From: Fabio Estevam <redacted>

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

Signed-off-by: Fabio Estevam <redacted>
---
 drivers/input/touchscreen/mc13783_ts.c |   13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)
diff --git a/drivers/input/touchscreen/mc13783_ts.c b/drivers/input/touchscreen/mc13783_ts.c
index 02103b6..e881c25 100644
--- a/drivers/input/touchscreen/mc13783_ts.c
+++ b/drivers/input/touchscreen/mc13783_ts.c
@@ -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);
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.

-- 
Dmitry

Re: [PATCH] Input: touchscreen: mc13783_ts.c: Convert to platform driver

From: Fabio Estevam <festevam@gmail.com>
Date: 2013-01-07 20:55:48

Hi Dmitry,

On Mon, Jan 7, 2013 at 6:50 PM, Dmitry Torokhov
[off-list ref] wrote:
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?

Re: [PATCH] Input: touchscreen: mc13783_ts.c: Convert to platform driver

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: 2013-01-07 20:59:31

On Mon, Jan 07, 2013 at 06:55:48PM -0200, Fabio Estevam wrote:
Hi Dmitry,

On Mon, Jan 7, 2013 at 6:50 PM, Dmitry Torokhov
[off-list ref] wrote:
quoted
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.

-- 
Dmitry

Re: [PATCH] Input: touchscreen: mc13783_ts.c: Convert to platform driver

From: Fabio Estevam <festevam@gmail.com>
Date: 2013-01-07 21:01:04

On Mon, Jan 7, 2013 at 6:59 PM, Dmitry Torokhov
[off-list ref] wrote:
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help