public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] power_supply: da9052-battery: Add missing platform_set_drvdata
@ 2012-01-11  7:43 Axel Lin
  2012-01-11  7:44 ` [PATCH 2/3] power_supply: da9052-battery: Fix a memory leak when unload the module Axel Lin
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Axel Lin @ 2012-01-11  7:43 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ashish Jangam, Anton Vorontsov, David Dajun Chen

Add missing platform_set_drvdata in da9052_bat_probe.
Otherwise, calling platform_get_drvdata in da9052_bat_remove returns NULL.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/power/da9052-battery.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/power/da9052-battery.c b/drivers/power/da9052-battery.c
index e8ea47a..07d5b36 100644
--- a/drivers/power/da9052-battery.c
+++ b/drivers/power/da9052-battery.c
@@ -612,6 +612,7 @@ static s32 __devinit da9052_bat_probe(struct platform_device *pdev)
 	 if (ret)
 		goto err;
 
+	platform_set_drvdata(pdev, bat);
 	return 0;
 
 err:
-- 
1.7.5.4




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

* [PATCH 2/3] power_supply: da9052-battery: Fix a memory leak when unload the module
  2012-01-11  7:43 [PATCH 1/3] power_supply: da9052-battery: Add missing platform_set_drvdata Axel Lin
@ 2012-01-11  7:44 ` Axel Lin
  2012-01-11  7:45 ` [PATCH 3/3] power_supply: da9052-battery: Convert to use module_platform_driver Axel Lin
  2012-03-15 16:52 ` [PATCH 1/3] power_supply: da9052-battery: Add missing platform_set_drvdata Anton Vorontsov
  2 siblings, 0 replies; 4+ messages in thread
From: Axel Lin @ 2012-01-11  7:44 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ashish Jangam, Anton Vorontsov, David Dajun Chen

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/power/da9052-battery.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/power/da9052-battery.c b/drivers/power/da9052-battery.c
index 07d5b36..daf52a4 100644
--- a/drivers/power/da9052-battery.c
+++ b/drivers/power/da9052-battery.c
@@ -634,6 +634,7 @@ static int __devexit da9052_bat_remove(struct platform_device *pdev)
 		free_irq(bat->da9052->irq_base + irq, bat);
 	}
 	power_supply_unregister(&bat->psy);
+	kfree(bat);
 
 	return 0;
 }
-- 
1.7.5.4




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

* [PATCH 3/3] power_supply: da9052-battery: Convert to use module_platform_driver
  2012-01-11  7:43 [PATCH 1/3] power_supply: da9052-battery: Add missing platform_set_drvdata Axel Lin
  2012-01-11  7:44 ` [PATCH 2/3] power_supply: da9052-battery: Fix a memory leak when unload the module Axel Lin
@ 2012-01-11  7:45 ` Axel Lin
  2012-03-15 16:52 ` [PATCH 1/3] power_supply: da9052-battery: Add missing platform_set_drvdata Anton Vorontsov
  2 siblings, 0 replies; 4+ messages in thread
From: Axel Lin @ 2012-01-11  7:45 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ashish Jangam, Anton Vorontsov, David Dajun Chen

Use the module_platform_driver() macro which makes the code smaller and a bit
simpler.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/power/da9052-battery.c |   12 +-----------
 1 files changed, 1 insertions(+), 11 deletions(-)

diff --git a/drivers/power/da9052-battery.c b/drivers/power/da9052-battery.c
index daf52a4..d648ba9 100644
--- a/drivers/power/da9052-battery.c
+++ b/drivers/power/da9052-battery.c
@@ -648,17 +648,7 @@ static struct platform_driver da9052_bat_driver = {
 	},
 };
 
-static int __init da9052_bat_init(void)
-{
-	return platform_driver_register(&da9052_bat_driver);
-}
-module_init(da9052_bat_init);
-
-static void __exit da9052_bat_exit(void)
-{
-	platform_driver_unregister(&da9052_bat_driver);
-}
-module_exit(da9052_bat_exit);
+module_platform_driver(da9052_bat_driver);
 
 MODULE_DESCRIPTION("DA9052 BAT Device Driver");
 MODULE_AUTHOR("David Dajun Chen <dchen@diasemi.com>");
-- 
1.7.5.4




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

* Re: [PATCH 1/3] power_supply: da9052-battery: Add missing platform_set_drvdata
  2012-01-11  7:43 [PATCH 1/3] power_supply: da9052-battery: Add missing platform_set_drvdata Axel Lin
  2012-01-11  7:44 ` [PATCH 2/3] power_supply: da9052-battery: Fix a memory leak when unload the module Axel Lin
  2012-01-11  7:45 ` [PATCH 3/3] power_supply: da9052-battery: Convert to use module_platform_driver Axel Lin
@ 2012-03-15 16:52 ` Anton Vorontsov
  2 siblings, 0 replies; 4+ messages in thread
From: Anton Vorontsov @ 2012-03-15 16:52 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, Ashish Jangam, David Dajun Chen

On Wed, Jan 11, 2012 at 03:43:44PM +0800, Axel Lin wrote:
> Add missing platform_set_drvdata in da9052_bat_probe.
> Otherwise, calling platform_get_drvdata in da9052_bat_remove returns NULL.
> 
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
> ---

All three applied, thanks!

-- 
Anton Vorontsov
Email: cbouatmailru@gmail.com

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

end of thread, other threads:[~2012-03-15 16:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-11  7:43 [PATCH 1/3] power_supply: da9052-battery: Add missing platform_set_drvdata Axel Lin
2012-01-11  7:44 ` [PATCH 2/3] power_supply: da9052-battery: Fix a memory leak when unload the module Axel Lin
2012-01-11  7:45 ` [PATCH 3/3] power_supply: da9052-battery: Convert to use module_platform_driver Axel Lin
2012-03-15 16:52 ` [PATCH 1/3] power_supply: da9052-battery: Add missing platform_set_drvdata Anton Vorontsov

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