Skip to contentSkip to conversation

regulator: tps6507x - add missing platform_set_drvdata in tps6507x_pmic_probe

PATCH Superseded Axel Lin 2 participants 2 messages Aug 9, 2010 Voltage and current regulator framework

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 regulator: tps6507x - add missing platform_set_drvdata in tps6507x_pmic_probe

We should call platform_set_drvdata() before calling platform_get_drvdata().

---
 drivers/regulator/tps6507x-regulator.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/regulator/tps6507x-regulator.c +2 -0
index 8152d65..fbe21f7 100644
@@ -614,6 +614,7 @@ int tps6507x_pmic_probe(struct platform_device *pdev)
 	}
 
 	tps6507x_dev->pmic = tps;
+	platform_set_drvdata(pdev, tps6507x_dev);
 
 	return 0;
 
@@ -640,6 +641,7 @@ static int __devexit tps6507x_pmic_remove(struct platform_device *pdev)
 	for (i = 0; i < TPS6507X_NUM_REGULATOR; i++)
 		regulator_unregister(tps->rdev[i]);
 
+	platform_set_drvdata(pdev, NULL);
 	kfree(tps);
 
 	return 0;
Signature · 1 line
1.5.4.3
#1 lore raw
Quoted 20 lines · Axel Lin

We should call platform_set_drvdata() before calling platform_get_drvdata().

---
drivers/regulator/tps6507x-regulator.c | 2 ++

1 files changed, 2 insertions(+), 0 deletions(-)
drivers/regulator/tps6507x-regulator.c +1 -0
index 8152d65..fbe21f7 100644
@@ -614,6 +614,7 @@ int tps6507x_pmic_probe(struct platform_device *pdev)
 	}
 
 	tps6507x_dev->pmic = tps;
+	platform_set_drvdata(pdev, tps6507x_dev);
 
 	return 0;
 

drivers/regulator/tps6507x-regulator.c static int __devexit tps6507x_pmic_remove(struct platform_device *pdev) · line 645

Quoted 5 lines
drivers/regulator/tps6507x-regulator.c +1 -0
@@ -640,6 +641,7 @@ static int __devexit tps6507x_pmic_remove(struct platform_device *pdev)
 	for (i = 0; i < TPS6507X_NUM_REGULATOR; i++)
 		regulator_unregister(tps->rdev[i]);
 
+	platform_set_drvdata(pdev, NULL);
 	kfree(tps);

This is not needed - we're unbinding the driver so should no longer be looking at the driver data.

Quoted 7 lines
drivers/regulator/tps6507x-regulator.c +0 -0
 	return 0;
Signature · 1 line
1.5.4.3