diff options
-rw-r--r-- | drivers/input/touchscreen/wm97xx-core.c | 2 | ||||
-rw-r--r-- | drivers/power/supply/wm97xx_battery.c | 25 |
2 files changed, 11 insertions, 16 deletions
diff --git a/drivers/input/touchscreen/wm97xx-core.c b/drivers/input/touchscreen/wm97xx-core.c index 90d6be3c26cc..83cf11312fd9 100644 --- a/drivers/input/touchscreen/wm97xx-core.c +++ b/drivers/input/touchscreen/wm97xx-core.c | |||
@@ -682,7 +682,7 @@ static int wm97xx_probe(struct device *dev) | |||
682 | } | 682 | } |
683 | platform_set_drvdata(wm->battery_dev, wm); | 683 | platform_set_drvdata(wm->battery_dev, wm); |
684 | wm->battery_dev->dev.parent = dev; | 684 | wm->battery_dev->dev.parent = dev; |
685 | wm->battery_dev->dev.platform_data = pdata; | 685 | wm->battery_dev->dev.platform_data = pdata->batt_pdata; |
686 | ret = platform_device_add(wm->battery_dev); | 686 | ret = platform_device_add(wm->battery_dev); |
687 | if (ret < 0) | 687 | if (ret < 0) |
688 | goto batt_reg_err; | 688 | goto batt_reg_err; |
diff --git a/drivers/power/supply/wm97xx_battery.c b/drivers/power/supply/wm97xx_battery.c index 6285626d142a..e3edb31ac880 100644 --- a/drivers/power/supply/wm97xx_battery.c +++ b/drivers/power/supply/wm97xx_battery.c | |||
@@ -30,8 +30,7 @@ static enum power_supply_property *prop; | |||
30 | 30 | ||
31 | static unsigned long wm97xx_read_bat(struct power_supply *bat_ps) | 31 | static unsigned long wm97xx_read_bat(struct power_supply *bat_ps) |
32 | { | 32 | { |
33 | struct wm97xx_pdata *wmdata = bat_ps->dev.parent->platform_data; | 33 | struct wm97xx_batt_pdata *pdata = power_supply_get_drvdata(bat_ps); |
34 | struct wm97xx_batt_pdata *pdata = wmdata->batt_pdata; | ||
35 | 34 | ||
36 | return wm97xx_read_aux_adc(dev_get_drvdata(bat_ps->dev.parent), | 35 | return wm97xx_read_aux_adc(dev_get_drvdata(bat_ps->dev.parent), |
37 | pdata->batt_aux) * pdata->batt_mult / | 36 | pdata->batt_aux) * pdata->batt_mult / |
@@ -40,8 +39,7 @@ static unsigned long wm97xx_read_bat(struct power_supply *bat_ps) | |||
40 | 39 | ||
41 | static unsigned long wm97xx_read_temp(struct power_supply *bat_ps) | 40 | static unsigned long wm97xx_read_temp(struct power_supply *bat_ps) |
42 | { | 41 | { |
43 | struct wm97xx_pdata *wmdata = bat_ps->dev.parent->platform_data; | 42 | struct wm97xx_batt_pdata *pdata = power_supply_get_drvdata(bat_ps); |
44 | struct wm97xx_batt_pdata *pdata = wmdata->batt_pdata; | ||
45 | 43 | ||
46 | return wm97xx_read_aux_adc(dev_get_drvdata(bat_ps->dev.parent), | 44 | return wm97xx_read_aux_adc(dev_get_drvdata(bat_ps->dev.parent), |
47 | pdata->temp_aux) * pdata->temp_mult / | 45 | pdata->temp_aux) * pdata->temp_mult / |
@@ -52,8 +50,7 @@ static int wm97xx_bat_get_property(struct power_supply *bat_ps, | |||
52 | enum power_supply_property psp, | 50 | enum power_supply_property psp, |
53 | union power_supply_propval *val) | 51 | union power_supply_propval *val) |
54 | { | 52 | { |
55 | struct wm97xx_pdata *wmdata = bat_ps->dev.parent->platform_data; | 53 | struct wm97xx_batt_pdata *pdata = power_supply_get_drvdata(bat_ps); |
56 | struct wm97xx_batt_pdata *pdata = wmdata->batt_pdata; | ||
57 | 54 | ||
58 | switch (psp) { | 55 | switch (psp) { |
59 | case POWER_SUPPLY_PROP_STATUS: | 56 | case POWER_SUPPLY_PROP_STATUS: |
@@ -103,8 +100,7 @@ static void wm97xx_bat_external_power_changed(struct power_supply *bat_ps) | |||
103 | static void wm97xx_bat_update(struct power_supply *bat_ps) | 100 | static void wm97xx_bat_update(struct power_supply *bat_ps) |
104 | { | 101 | { |
105 | int old_status = bat_status; | 102 | int old_status = bat_status; |
106 | struct wm97xx_pdata *wmdata = bat_ps->dev.parent->platform_data; | 103 | struct wm97xx_batt_pdata *pdata = power_supply_get_drvdata(bat_ps); |
107 | struct wm97xx_batt_pdata *pdata = wmdata->batt_pdata; | ||
108 | 104 | ||
109 | mutex_lock(&work_lock); | 105 | mutex_lock(&work_lock); |
110 | 106 | ||
@@ -166,15 +162,15 @@ static int wm97xx_bat_probe(struct platform_device *dev) | |||
166 | int ret = 0; | 162 | int ret = 0; |
167 | int props = 1; /* POWER_SUPPLY_PROP_PRESENT */ | 163 | int props = 1; /* POWER_SUPPLY_PROP_PRESENT */ |
168 | int i = 0; | 164 | int i = 0; |
169 | struct wm97xx_pdata *wmdata = dev->dev.platform_data; | 165 | struct wm97xx_batt_pdata *pdata = dev->dev.platform_data; |
170 | struct wm97xx_batt_pdata *pdata; | 166 | struct power_supply_config cfg = {}; |
171 | 167 | ||
172 | if (!wmdata) { | 168 | if (!pdata) { |
173 | dev_err(&dev->dev, "No platform data supplied\n"); | 169 | dev_err(&dev->dev, "No platform data supplied\n"); |
174 | return -EINVAL; | 170 | return -EINVAL; |
175 | } | 171 | } |
176 | 172 | ||
177 | pdata = wmdata->batt_pdata; | 173 | cfg.drv_data = pdata; |
178 | 174 | ||
179 | if (dev->id != -1) | 175 | if (dev->id != -1) |
180 | return -EINVAL; | 176 | return -EINVAL; |
@@ -243,7 +239,7 @@ static int wm97xx_bat_probe(struct platform_device *dev) | |||
243 | bat_psy_desc.properties = prop; | 239 | bat_psy_desc.properties = prop; |
244 | bat_psy_desc.num_properties = props; | 240 | bat_psy_desc.num_properties = props; |
245 | 241 | ||
246 | bat_psy = power_supply_register(&dev->dev, &bat_psy_desc, NULL); | 242 | bat_psy = power_supply_register(&dev->dev, &bat_psy_desc, &cfg); |
247 | if (!IS_ERR(bat_psy)) { | 243 | if (!IS_ERR(bat_psy)) { |
248 | schedule_work(&bat_work); | 244 | schedule_work(&bat_work); |
249 | } else { | 245 | } else { |
@@ -266,8 +262,7 @@ err: | |||
266 | 262 | ||
267 | static int wm97xx_bat_remove(struct platform_device *dev) | 263 | static int wm97xx_bat_remove(struct platform_device *dev) |
268 | { | 264 | { |
269 | struct wm97xx_pdata *wmdata = dev->dev.platform_data; | 265 | struct wm97xx_batt_pdata *pdata = dev->dev.platform_data; |
270 | struct wm97xx_batt_pdata *pdata = wmdata->batt_pdata; | ||
271 | 266 | ||
272 | if (pdata && gpio_is_valid(pdata->charge_gpio)) { | 267 | if (pdata && gpio_is_valid(pdata->charge_gpio)) { |
273 | free_irq(gpio_to_irq(pdata->charge_gpio), dev); | 268 | free_irq(gpio_to_irq(pdata->charge_gpio), dev); |