power_supply: da9052-battery: Add missing platform_set_drvdata
PATCH 1/3 power_supply: da9052-battery: Add missing platform_set_drvdata
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 <[email protected]>
--- drivers/power/da9052-battery.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/power/da9052-battery.c +1 -0
@@ -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:
Signature · 1 line
1.7.5.4
PATCH 2/3 power_supply: da9052-battery: Fix a memory leak when unload the module
Signed-off-by Axel Lin <[email protected]>
--- drivers/power/da9052-battery.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/power/da9052-battery.c +1 -0
@@ -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 ; }
Signature · 1 line
1.7.5.4
PATCH 3/3 power_supply: da9052-battery: Convert to use module_platform_driver
In reply to Axel LinUse the module_platform_driver() macro which makes the code smaller and a bit simpler.
Signed-off-by Axel Lin <[email protected]>
--- drivers/power/da9052-battery.c | 12 +----------- 1 files changed, 1 insertions(+), 11 deletions(-)
drivers/power/da9052-battery.c +1 -11
@@ -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 <[email protected]>" );
Signature · 1 line
1.7.5.4
Quoted 5 lines · Axel Lin
Add missing
platform_set_drvdatainda9052_bat_probe. Otherwise, callingplatform_get_drvdatainda9052_bat_removereturns NULL.Signed-off-by Axel Lin <[email protected]>---
All three applied, thanks!
Signature · 2 lines
Anton Vorontsov Email: [email protected]