diff mbox

[8/8] Input: atmel-wm97xx: Use module_platform_driver_probe macro

Message ID 1362453827-18129-8-git-send-email-sachin.kamat@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Sachin Kamat March 5, 2013, 3:23 a.m. UTC
module_platform_driver_probe() eliminates the boilerplate and simplifies
the code.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 drivers/input/touchscreen/atmel-wm97xx.c |   12 +-----------
 1 files changed, 1 insertions(+), 11 deletions(-)

Comments

Mark Brown March 5, 2013, 3:36 a.m. UTC | #1
On Tue, Mar 05, 2013 at 08:53:47AM +0530, Sachin Kamat wrote:
> module_platform_driver_probe() eliminates the boilerplate and simplifies
> the code.

Is there really any great reason to use this as opposed to
module_platform_driver()?  I know the existing code does this, it's not
clear to me that that's a good idea either.
Sachin Kamat March 5, 2013, 3:47 a.m. UTC | #2
On 5 March 2013 09:06, Mark Brown <broonie@opensource.wolfsonmicro.com> wrote:
> On Tue, Mar 05, 2013 at 08:53:47AM +0530, Sachin Kamat wrote:
>> module_platform_driver_probe() eliminates the boilerplate and simplifies
>> the code.
>
> Is there really any great reason to use this as opposed to
> module_platform_driver()?

Since the init function returns platform_driver_probe() instead of
platform_driver_register(), I have used module_platform_driver_probe()
macro.

>I know the existing code does this, it's not
> clear to me that that's a good idea either.

However, if your question is why return platform_driver_probe() at all
instead of platform_driver_register() in the first place, then I am
sorry I do not have much idea about it.
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Mark Brown March 5, 2013, 3:51 a.m. UTC | #3
On Tue, Mar 05, 2013 at 09:17:27AM +0530, Sachin Kamat wrote:
> On 5 March 2013 09:06, Mark Brown <broonie@opensource.wolfsonmicro.com> wrote:

> >I know the existing code does this, it's not
> > clear to me that that's a good idea either.

> However, if your question is why return platform_driver_probe() at all
> instead of platform_driver_register() in the first place, then I am
> sorry I do not have much idea about it.

Yes, I'm questioning if this is the right cleanup to do.
diff mbox

Patch

diff --git a/drivers/input/touchscreen/atmel-wm97xx.c b/drivers/input/touchscreen/atmel-wm97xx.c
index c5c2dbb..2c1e46b 100644
--- a/drivers/input/touchscreen/atmel-wm97xx.c
+++ b/drivers/input/touchscreen/atmel-wm97xx.c
@@ -432,17 +432,7 @@  static struct platform_driver atmel_wm97xx_driver = {
 	},
 };
 
-static int __init atmel_wm97xx_init(void)
-{
-	return platform_driver_probe(&atmel_wm97xx_driver, atmel_wm97xx_probe);
-}
-module_init(atmel_wm97xx_init);
-
-static void __exit atmel_wm97xx_exit(void)
-{
-	platform_driver_unregister(&atmel_wm97xx_driver);
-}
-module_exit(atmel_wm97xx_exit);
+module_platform_driver_probe(atmel_wm97xx_driver, atmel_wm97xx_probe);
 
 MODULE_AUTHOR("Hans-Christian Egtvedt <egtvedt@samfundet.no>");
 MODULE_DESCRIPTION("wm97xx continuous touch driver for Atmel AT91 and AVR32");