aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLee Jones <lee.jones@linaro.org>2015-06-05 14:42:45 -0400
committerMark Brown <broonie@kernel.org>2015-06-08 14:18:19 -0400
commitb6f55e74d2babc0f6495c1e3fb12761388baa56f (patch)
tree1f346c44a3aafccef95da3ccb6b8e7a6283c95d6
parentb787f68c36d49bb1d9236f403813641efa74a031 (diff)
regulator: pwm-regulator: Remove unnecessary descriptor attribute from ddata
The Regulator Device keeps a full copy of it's own, which can be easily accessed. Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--drivers/regulator/pwm-regulator.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/drivers/regulator/pwm-regulator.c b/drivers/regulator/pwm-regulator.c
index 253833ae35f3..a79b5bcfec1d 100644
--- a/drivers/regulator/pwm-regulator.c
+++ b/drivers/regulator/pwm-regulator.c
@@ -21,7 +21,6 @@
21#include <linux/pwm.h> 21#include <linux/pwm.h>
22 22
23struct pwm_regulator_data { 23struct pwm_regulator_data {
24 struct regulator_desc desc;
25 struct pwm_voltages *duty_cycle_table; 24 struct pwm_voltages *duty_cycle_table;
26 struct pwm_device *pwm; 25 struct pwm_device *pwm;
27 bool enabled; 26 bool enabled;
@@ -78,7 +77,7 @@ static int pwm_regulator_list_voltage(struct regulator_dev *dev,
78{ 77{
79 struct pwm_regulator_data *drvdata = rdev_get_drvdata(dev); 78 struct pwm_regulator_data *drvdata = rdev_get_drvdata(dev);
80 79
81 if (selector >= drvdata->desc.n_voltages) 80 if (selector >= dev->desc->n_voltages)
82 return -EINVAL; 81 return -EINVAL;
83 82
84 return drvdata->duty_cycle_table[selector].uV; 83 return drvdata->duty_cycle_table[selector].uV;
@@ -91,7 +90,7 @@ static struct regulator_ops pwm_regulator_voltage_ops = {
91 .map_voltage = regulator_map_voltage_iterate, 90 .map_voltage = regulator_map_voltage_iterate,
92}; 91};
93 92
94static const struct regulator_desc pwm_regulator_desc = { 93static struct regulator_desc pwm_regulator_desc = {
95 .name = "pwm-regulator", 94 .name = "pwm-regulator",
96 .ops = &pwm_regulator_voltage_ops, 95 .ops = &pwm_regulator_voltage_ops,
97 .type = REGULATOR_VOLTAGE, 96 .type = REGULATOR_VOLTAGE,
@@ -117,8 +116,6 @@ static int pwm_regulator_probe(struct platform_device *pdev)
117 if (!drvdata) 116 if (!drvdata)
118 return -ENOMEM; 117 return -ENOMEM;
119 118
120 memcpy(&drvdata->desc, &pwm_regulator_desc, sizeof(pwm_regulator_desc));
121
122 /* determine the number of voltage-table */ 119 /* determine the number of voltage-table */
123 prop = of_find_property(np, "voltage-table", &length); 120 prop = of_find_property(np, "voltage-table", &length);
124 if (!prop) { 121 if (!prop) {
@@ -133,7 +130,7 @@ static int pwm_regulator_probe(struct platform_device *pdev)
133 return -EINVAL; 130 return -EINVAL;
134 } 131 }
135 132
136 drvdata->desc.n_voltages = length / sizeof(*drvdata->duty_cycle_table); 133 pwm_regulator_desc.n_voltages = length / sizeof(*drvdata->duty_cycle_table);
137 134
138 drvdata->duty_cycle_table = devm_kzalloc(&pdev->dev, 135 drvdata->duty_cycle_table = devm_kzalloc(&pdev->dev,
139 length, GFP_KERNEL); 136 length, GFP_KERNEL);
@@ -150,7 +147,7 @@ static int pwm_regulator_probe(struct platform_device *pdev)
150 } 147 }
151 148
152 config.init_data = of_get_regulator_init_data(&pdev->dev, np, 149 config.init_data = of_get_regulator_init_data(&pdev->dev, np,
153 &drvdata->desc); 150 &pwm_regulator_desc);
154 if (!config.init_data) 151 if (!config.init_data)
155 return -ENOMEM; 152 return -ENOMEM;
156 153
@@ -165,10 +162,10 @@ static int pwm_regulator_probe(struct platform_device *pdev)
165 } 162 }
166 163
167 regulator = devm_regulator_register(&pdev->dev, 164 regulator = devm_regulator_register(&pdev->dev,
168 &drvdata->desc, &config); 165 &pwm_regulator_desc, &config);
169 if (IS_ERR(regulator)) { 166 if (IS_ERR(regulator)) {
170 dev_err(&pdev->dev, "Failed to register regulator %s\n", 167 dev_err(&pdev->dev, "Failed to register regulator %s\n",
171 drvdata->desc.name); 168 pwm_regulator_desc.name);
172 return PTR_ERR(regulator); 169 return PTR_ERR(regulator);
173 } 170 }
174 171