diff options
author | Axel Lin <axel.lin@gmail.com> | 2012-03-01 20:28:44 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-03-11 16:48:48 -0400 |
commit | b21bcd1ada026cd90243311e89dd8d999fe0a227 (patch) | |
tree | dc8d6e9fee685738020ceb585144bc1d1df707a8 | |
parent | 48ee1160a44b6f404f5553a6fce8447507982311 (diff) |
regulator: Add a pointer to aat2870_data in struct aat2870_regulator
The reason we add *pdev in struct aat2870_regulator is to use it
to get a pointer to struct aat2870_data.
Save a pointer to struct aat2870_data instead of pdev in struct
aat2870_regulator, this change makes the intention more clear.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Jin Park <jinyoungp@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r-- | drivers/regulator/aat2870-regulator.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/regulator/aat2870-regulator.c b/drivers/regulator/aat2870-regulator.c index 685ad43b0749..9ed5c5d84e12 100644 --- a/drivers/regulator/aat2870-regulator.c +++ b/drivers/regulator/aat2870-regulator.c | |||
@@ -31,7 +31,7 @@ | |||
31 | #include <linux/mfd/aat2870.h> | 31 | #include <linux/mfd/aat2870.h> |
32 | 32 | ||
33 | struct aat2870_regulator { | 33 | struct aat2870_regulator { |
34 | struct platform_device *pdev; | 34 | struct aat2870_data *aat2870; |
35 | struct regulator_desc desc; | 35 | struct regulator_desc desc; |
36 | 36 | ||
37 | const int *voltages; /* uV */ | 37 | const int *voltages; /* uV */ |
@@ -60,7 +60,7 @@ static int aat2870_ldo_set_voltage_sel(struct regulator_dev *rdev, | |||
60 | unsigned selector) | 60 | unsigned selector) |
61 | { | 61 | { |
62 | struct aat2870_regulator *ri = rdev_get_drvdata(rdev); | 62 | struct aat2870_regulator *ri = rdev_get_drvdata(rdev); |
63 | struct aat2870_data *aat2870 = dev_get_drvdata(ri->pdev->dev.parent); | 63 | struct aat2870_data *aat2870 = ri->aat2870; |
64 | 64 | ||
65 | return aat2870->update(aat2870, ri->voltage_addr, ri->voltage_mask, | 65 | return aat2870->update(aat2870, ri->voltage_addr, ri->voltage_mask, |
66 | selector << ri->voltage_shift); | 66 | selector << ri->voltage_shift); |
@@ -69,7 +69,7 @@ static int aat2870_ldo_set_voltage_sel(struct regulator_dev *rdev, | |||
69 | static int aat2870_ldo_get_voltage_sel(struct regulator_dev *rdev) | 69 | static int aat2870_ldo_get_voltage_sel(struct regulator_dev *rdev) |
70 | { | 70 | { |
71 | struct aat2870_regulator *ri = rdev_get_drvdata(rdev); | 71 | struct aat2870_regulator *ri = rdev_get_drvdata(rdev); |
72 | struct aat2870_data *aat2870 = dev_get_drvdata(ri->pdev->dev.parent); | 72 | struct aat2870_data *aat2870 = ri->aat2870; |
73 | u8 val; | 73 | u8 val; |
74 | int ret; | 74 | int ret; |
75 | 75 | ||
@@ -83,7 +83,7 @@ static int aat2870_ldo_get_voltage_sel(struct regulator_dev *rdev) | |||
83 | static int aat2870_ldo_enable(struct regulator_dev *rdev) | 83 | static int aat2870_ldo_enable(struct regulator_dev *rdev) |
84 | { | 84 | { |
85 | struct aat2870_regulator *ri = rdev_get_drvdata(rdev); | 85 | struct aat2870_regulator *ri = rdev_get_drvdata(rdev); |
86 | struct aat2870_data *aat2870 = dev_get_drvdata(ri->pdev->dev.parent); | 86 | struct aat2870_data *aat2870 = ri->aat2870; |
87 | 87 | ||
88 | return aat2870->update(aat2870, ri->enable_addr, ri->enable_mask, | 88 | return aat2870->update(aat2870, ri->enable_addr, ri->enable_mask, |
89 | ri->enable_mask); | 89 | ri->enable_mask); |
@@ -92,7 +92,7 @@ static int aat2870_ldo_enable(struct regulator_dev *rdev) | |||
92 | static int aat2870_ldo_disable(struct regulator_dev *rdev) | 92 | static int aat2870_ldo_disable(struct regulator_dev *rdev) |
93 | { | 93 | { |
94 | struct aat2870_regulator *ri = rdev_get_drvdata(rdev); | 94 | struct aat2870_regulator *ri = rdev_get_drvdata(rdev); |
95 | struct aat2870_data *aat2870 = dev_get_drvdata(ri->pdev->dev.parent); | 95 | struct aat2870_data *aat2870 = ri->aat2870; |
96 | 96 | ||
97 | return aat2870->update(aat2870, ri->enable_addr, ri->enable_mask, 0); | 97 | return aat2870->update(aat2870, ri->enable_addr, ri->enable_mask, 0); |
98 | } | 98 | } |
@@ -100,7 +100,7 @@ static int aat2870_ldo_disable(struct regulator_dev *rdev) | |||
100 | static int aat2870_ldo_is_enabled(struct regulator_dev *rdev) | 100 | static int aat2870_ldo_is_enabled(struct regulator_dev *rdev) |
101 | { | 101 | { |
102 | struct aat2870_regulator *ri = rdev_get_drvdata(rdev); | 102 | struct aat2870_regulator *ri = rdev_get_drvdata(rdev); |
103 | struct aat2870_data *aat2870 = dev_get_drvdata(ri->pdev->dev.parent); | 103 | struct aat2870_data *aat2870 = ri->aat2870; |
104 | u8 val; | 104 | u8 val; |
105 | int ret; | 105 | int ret; |
106 | 106 | ||
@@ -185,7 +185,7 @@ static int aat2870_regulator_probe(struct platform_device *pdev) | |||
185 | dev_err(&pdev->dev, "Invalid device ID, %d\n", pdev->id); | 185 | dev_err(&pdev->dev, "Invalid device ID, %d\n", pdev->id); |
186 | return -EINVAL; | 186 | return -EINVAL; |
187 | } | 187 | } |
188 | ri->pdev = pdev; | 188 | ri->aat2870 = dev_get_drvdata(pdev->dev.parent); |
189 | 189 | ||
190 | rdev = regulator_register(&ri->desc, &pdev->dev, | 190 | rdev = regulator_register(&ri->desc, &pdev->dev, |
191 | pdev->dev.platform_data, ri, NULL); | 191 | pdev->dev.platform_data, ri, NULL); |