diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-11-12 06:39:21 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-11-12 06:39:21 -0500 |
commit | 708b8eae0fd532af73ea8350e6dcc10255ff7376 (patch) | |
tree | f336436934fd79bc91aff7112a9beb10bc4e839f /drivers/regulator/da903x.c | |
parent | d98d38f2014ab79f28c126ff175d034891f7aefc (diff) | |
parent | f21f237cf55494c3a4209de323281a3b0528da10 (diff) |
Merge branch 'linus' into core/locking
Diffstat (limited to 'drivers/regulator/da903x.c')
-rw-r--r-- | drivers/regulator/da903x.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/drivers/regulator/da903x.c b/drivers/regulator/da903x.c index 3688e339db87..773b29cec8be 100644 --- a/drivers/regulator/da903x.c +++ b/drivers/regulator/da903x.c | |||
@@ -79,6 +79,11 @@ struct da903x_regulator_info { | |||
79 | int enable_bit; | 79 | int enable_bit; |
80 | }; | 80 | }; |
81 | 81 | ||
82 | static inline struct device *to_da903x_dev(struct regulator_dev *rdev) | ||
83 | { | ||
84 | return rdev_get_dev(rdev)->parent->parent; | ||
85 | } | ||
86 | |||
82 | static inline int check_range(struct da903x_regulator_info *info, | 87 | static inline int check_range(struct da903x_regulator_info *info, |
83 | int min_uV, int max_uV) | 88 | int min_uV, int max_uV) |
84 | { | 89 | { |
@@ -93,7 +98,7 @@ static int da903x_set_ldo_voltage(struct regulator_dev *rdev, | |||
93 | int min_uV, int max_uV) | 98 | int min_uV, int max_uV) |
94 | { | 99 | { |
95 | struct da903x_regulator_info *info = rdev_get_drvdata(rdev); | 100 | struct da903x_regulator_info *info = rdev_get_drvdata(rdev); |
96 | struct device *da9034_dev = rdev_get_dev(rdev)->parent; | 101 | struct device *da9034_dev = to_da903x_dev(rdev); |
97 | uint8_t val, mask; | 102 | uint8_t val, mask; |
98 | 103 | ||
99 | if (check_range(info, min_uV, max_uV)) { | 104 | if (check_range(info, min_uV, max_uV)) { |
@@ -111,7 +116,7 @@ static int da903x_set_ldo_voltage(struct regulator_dev *rdev, | |||
111 | static int da903x_get_voltage(struct regulator_dev *rdev) | 116 | static int da903x_get_voltage(struct regulator_dev *rdev) |
112 | { | 117 | { |
113 | struct da903x_regulator_info *info = rdev_get_drvdata(rdev); | 118 | struct da903x_regulator_info *info = rdev_get_drvdata(rdev); |
114 | struct device *da9034_dev = rdev_get_dev(rdev)->parent; | 119 | struct device *da9034_dev = to_da903x_dev(rdev); |
115 | uint8_t val, mask; | 120 | uint8_t val, mask; |
116 | int ret; | 121 | int ret; |
117 | 122 | ||
@@ -128,7 +133,7 @@ static int da903x_get_voltage(struct regulator_dev *rdev) | |||
128 | static int da903x_enable(struct regulator_dev *rdev) | 133 | static int da903x_enable(struct regulator_dev *rdev) |
129 | { | 134 | { |
130 | struct da903x_regulator_info *info = rdev_get_drvdata(rdev); | 135 | struct da903x_regulator_info *info = rdev_get_drvdata(rdev); |
131 | struct device *da9034_dev = rdev_get_dev(rdev)->parent; | 136 | struct device *da9034_dev = to_da903x_dev(rdev); |
132 | 137 | ||
133 | return da903x_set_bits(da9034_dev, info->enable_reg, | 138 | return da903x_set_bits(da9034_dev, info->enable_reg, |
134 | 1 << info->enable_bit); | 139 | 1 << info->enable_bit); |
@@ -137,7 +142,7 @@ static int da903x_enable(struct regulator_dev *rdev) | |||
137 | static int da903x_disable(struct regulator_dev *rdev) | 142 | static int da903x_disable(struct regulator_dev *rdev) |
138 | { | 143 | { |
139 | struct da903x_regulator_info *info = rdev_get_drvdata(rdev); | 144 | struct da903x_regulator_info *info = rdev_get_drvdata(rdev); |
140 | struct device *da9034_dev = rdev_get_dev(rdev)->parent; | 145 | struct device *da9034_dev = to_da903x_dev(rdev); |
141 | 146 | ||
142 | return da903x_clr_bits(da9034_dev, info->enable_reg, | 147 | return da903x_clr_bits(da9034_dev, info->enable_reg, |
143 | 1 << info->enable_bit); | 148 | 1 << info->enable_bit); |
@@ -146,7 +151,7 @@ static int da903x_disable(struct regulator_dev *rdev) | |||
146 | static int da903x_is_enabled(struct regulator_dev *rdev) | 151 | static int da903x_is_enabled(struct regulator_dev *rdev) |
147 | { | 152 | { |
148 | struct da903x_regulator_info *info = rdev_get_drvdata(rdev); | 153 | struct da903x_regulator_info *info = rdev_get_drvdata(rdev); |
149 | struct device *da9034_dev = rdev_get_dev(rdev)->parent; | 154 | struct device *da9034_dev = to_da903x_dev(rdev); |
150 | uint8_t reg_val; | 155 | uint8_t reg_val; |
151 | int ret; | 156 | int ret; |
152 | 157 | ||
@@ -162,7 +167,7 @@ static int da9030_set_ldo1_15_voltage(struct regulator_dev *rdev, | |||
162 | int min_uV, int max_uV) | 167 | int min_uV, int max_uV) |
163 | { | 168 | { |
164 | struct da903x_regulator_info *info = rdev_get_drvdata(rdev); | 169 | struct da903x_regulator_info *info = rdev_get_drvdata(rdev); |
165 | struct device *da903x_dev = rdev_get_dev(rdev)->parent; | 170 | struct device *da903x_dev = to_da903x_dev(rdev); |
166 | uint8_t val, mask; | 171 | uint8_t val, mask; |
167 | int ret; | 172 | int ret; |
168 | 173 | ||
@@ -189,7 +194,7 @@ static int da9030_set_ldo14_voltage(struct regulator_dev *rdev, | |||
189 | int min_uV, int max_uV) | 194 | int min_uV, int max_uV) |
190 | { | 195 | { |
191 | struct da903x_regulator_info *info = rdev_get_drvdata(rdev); | 196 | struct da903x_regulator_info *info = rdev_get_drvdata(rdev); |
192 | struct device *da903x_dev = rdev_get_dev(rdev)->parent; | 197 | struct device *da903x_dev = to_da903x_dev(rdev); |
193 | uint8_t val, mask; | 198 | uint8_t val, mask; |
194 | int thresh; | 199 | int thresh; |
195 | 200 | ||
@@ -215,7 +220,7 @@ static int da9030_set_ldo14_voltage(struct regulator_dev *rdev, | |||
215 | static int da9030_get_ldo14_voltage(struct regulator_dev *rdev) | 220 | static int da9030_get_ldo14_voltage(struct regulator_dev *rdev) |
216 | { | 221 | { |
217 | struct da903x_regulator_info *info = rdev_get_drvdata(rdev); | 222 | struct da903x_regulator_info *info = rdev_get_drvdata(rdev); |
218 | struct device *da903x_dev = rdev_get_dev(rdev)->parent; | 223 | struct device *da903x_dev = to_da903x_dev(rdev); |
219 | uint8_t val, mask; | 224 | uint8_t val, mask; |
220 | int ret; | 225 | int ret; |
221 | 226 | ||
@@ -238,7 +243,7 @@ static int da9034_set_dvc_voltage(struct regulator_dev *rdev, | |||
238 | int min_uV, int max_uV) | 243 | int min_uV, int max_uV) |
239 | { | 244 | { |
240 | struct da903x_regulator_info *info = rdev_get_drvdata(rdev); | 245 | struct da903x_regulator_info *info = rdev_get_drvdata(rdev); |
241 | struct device *da9034_dev = rdev_get_dev(rdev)->parent; | 246 | struct device *da9034_dev = to_da903x_dev(rdev); |
242 | uint8_t val, mask; | 247 | uint8_t val, mask; |
243 | int ret; | 248 | int ret; |
244 | 249 | ||
@@ -264,7 +269,7 @@ static int da9034_set_ldo12_voltage(struct regulator_dev *rdev, | |||
264 | int min_uV, int max_uV) | 269 | int min_uV, int max_uV) |
265 | { | 270 | { |
266 | struct da903x_regulator_info *info = rdev_get_drvdata(rdev); | 271 | struct da903x_regulator_info *info = rdev_get_drvdata(rdev); |
267 | struct device *da9034_dev = rdev_get_dev(rdev)->parent; | 272 | struct device *da9034_dev = to_da903x_dev(rdev); |
268 | uint8_t val, mask; | 273 | uint8_t val, mask; |
269 | 274 | ||
270 | if (check_range(info, min_uV, max_uV)) { | 275 | if (check_range(info, min_uV, max_uV)) { |
@@ -283,7 +288,7 @@ static int da9034_set_ldo12_voltage(struct regulator_dev *rdev, | |||
283 | static int da9034_get_ldo12_voltage(struct regulator_dev *rdev) | 288 | static int da9034_get_ldo12_voltage(struct regulator_dev *rdev) |
284 | { | 289 | { |
285 | struct da903x_regulator_info *info = rdev_get_drvdata(rdev); | 290 | struct da903x_regulator_info *info = rdev_get_drvdata(rdev); |
286 | struct device *da9034_dev = rdev_get_dev(rdev)->parent; | 291 | struct device *da9034_dev = to_da903x_dev(rdev); |
287 | uint8_t val, mask; | 292 | uint8_t val, mask; |
288 | int ret; | 293 | int ret; |
289 | 294 | ||
@@ -466,7 +471,7 @@ static int __devinit da903x_regulator_probe(struct platform_device *pdev) | |||
466 | if (ri->desc.id == DA9030_ID_LDO1 || ri->desc.id == DA9030_ID_LDO15) | 471 | if (ri->desc.id == DA9030_ID_LDO1 || ri->desc.id == DA9030_ID_LDO15) |
467 | ri->desc.ops = &da9030_regulator_ldo1_15_ops; | 472 | ri->desc.ops = &da9030_regulator_ldo1_15_ops; |
468 | 473 | ||
469 | rdev = regulator_register(&ri->desc, pdev->dev.parent, ri); | 474 | rdev = regulator_register(&ri->desc, &pdev->dev, ri); |
470 | if (IS_ERR(rdev)) { | 475 | if (IS_ERR(rdev)) { |
471 | dev_err(&pdev->dev, "failed to register regulator %s\n", | 476 | dev_err(&pdev->dev, "failed to register regulator %s\n", |
472 | ri->desc.name); | 477 | ri->desc.name); |