public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ds2781_battery: convert to module_platform_driver
@ 2012-07-30 10:44 Devendra Naga
  2012-08-23  2:49 ` Anton Vorontsov
  0 siblings, 1 reply; 2+ messages in thread
From: Devendra Naga @ 2012-07-30 10:44 UTC (permalink / raw)
  To: Renata Sayakhova, Anton Vorontsov, David Woodhouse, linux-kernel
  Cc: Devendra Naga

module_platform_driver can be used to replace the
platform_driver register and unregister functions,
with the calls to module_init and module_exit,

i.e. all the code that is doing like the below

static int __init mymod_init(void)
{
	return platform_driver_register(&drv_operations);
}

static void __exit mymod_exit(void)
{
	platform_driver_unregister(&drv_operations);
}

module_init(mymod_init);
module_exit(mymod_exit);

can be replaced with
module_platform_driver(drv_operations)...

Signed-off-by: Devendra Naga <develkernel412222@gmail.com>
---
 drivers/power/ds2781_battery.c |   14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/drivers/power/ds2781_battery.c b/drivers/power/ds2781_battery.c
index 7a1ff4e..8f84ab7 100644
--- a/drivers/power/ds2781_battery.c
+++ b/drivers/power/ds2781_battery.c
@@ -835,19 +835,7 @@ static struct platform_driver ds2781_battery_driver = {
 	.remove   = __devexit_p(ds2781_battery_remove),
 };
 
-static int __init ds2781_battery_init(void)
-{
-	return platform_driver_register(&ds2781_battery_driver);
-}
-
-static void __exit ds2781_battery_exit(void)
-{
-	platform_driver_unregister(&ds2781_battery_driver);
-}
-
-module_init(ds2781_battery_init);
-module_exit(ds2781_battery_exit);
-
+module_platform_driver(ds2781_battery_driver);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Renata Sayakhova <renata@oktetlabs.ru>");
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/2] ds2781_battery: convert to module_platform_driver
  2012-07-30 10:44 [PATCH 1/2] ds2781_battery: convert to module_platform_driver Devendra Naga
@ 2012-08-23  2:49 ` Anton Vorontsov
  0 siblings, 0 replies; 2+ messages in thread
From: Anton Vorontsov @ 2012-08-23  2:49 UTC (permalink / raw)
  To: Devendra Naga; +Cc: Renata Sayakhova, David Woodhouse, linux-kernel

On Mon, Jul 30, 2012 at 04:29:10PM +0545, Devendra Naga wrote:
> module_platform_driver can be used to replace the
> platform_driver register and unregister functions,
> with the calls to module_init and module_exit,
> 
> i.e. all the code that is doing like the below
> 
> static int __init mymod_init(void)
> {
> 	return platform_driver_register(&drv_operations);
> }
> 
> static void __exit mymod_exit(void)
> {
> 	platform_driver_unregister(&drv_operations);
> }
> 
> module_init(mymod_init);
> module_exit(mymod_exit);
> 
> can be replaced with
> module_platform_driver(drv_operations)...
> 
> Signed-off-by: Devendra Naga <develkernel412222@gmail.com>

Nice! Both patches applied, thank you!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-08-23  2:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-30 10:44 [PATCH 1/2] ds2781_battery: convert to module_platform_driver Devendra Naga
2012-08-23  2:49 ` Anton Vorontsov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox