diff options
author | Mika Westerberg <mika.westerberg@linux.intel.com> | 2012-04-16 04:48:39 -0400 |
---|---|---|
committer | Anton Vorontsov <anton.vorontsov@linaro.org> | 2012-05-05 08:35:22 -0400 |
commit | 055d7f0f29b2af6ec8fd5da9f0ce27b9e9e63436 (patch) | |
tree | a51e8bbec8a644205ebe8df629c5ee333d543503 /drivers/power | |
parent | b75ef1d807e20919a00bed16045537e76e0497a7 (diff) |
smb347-charger: Rename few functions to match better what they are doing
The naming used in the driver for some functions is not very clear what
the functions are really doing. To make this a bit easier to understand
we rename few functions which were badly named.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/smb347-charger.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/drivers/power/smb347-charger.c b/drivers/power/smb347-charger.c index 0dfe063f4178..18d53748e66d 100644 --- a/drivers/power/smb347-charger.c +++ b/drivers/power/smb347-charger.c | |||
@@ -235,14 +235,14 @@ static int smb347_write(struct smb347_charger *smb, u8 reg, u8 val) | |||
235 | } | 235 | } |
236 | 236 | ||
237 | /** | 237 | /** |
238 | * smb347_update_status - updates the charging status | 238 | * smb347_update_ps_status - refreshes the power source status |
239 | * @smb: pointer to smb347 charger instance | 239 | * @smb: pointer to smb347 charger instance |
240 | * | 240 | * |
241 | * Function checks status of the charging and updates internal state | 241 | * Function checks whether any power source is connected to the charger and |
242 | * accordingly. Returns %0 if there is no change in status, %1 if the | 242 | * updates internal state accordingly. If there is a change to previous state |
243 | * status has changed and negative errno in case of failure. | 243 | * function returns %1, otherwise %0 and negative errno in case of errror. |
244 | */ | 244 | */ |
245 | static int smb347_update_status(struct smb347_charger *smb) | 245 | static int smb347_update_ps_status(struct smb347_charger *smb) |
246 | { | 246 | { |
247 | bool usb = false; | 247 | bool usb = false; |
248 | bool dc = false; | 248 | bool dc = false; |
@@ -271,15 +271,15 @@ static int smb347_update_status(struct smb347_charger *smb) | |||
271 | } | 271 | } |
272 | 272 | ||
273 | /* | 273 | /* |
274 | * smb347_is_online - returns whether input power source is connected | 274 | * smb347_is_ps_online - returns whether input power source is connected |
275 | * @smb: pointer to smb347 charger instance | 275 | * @smb: pointer to smb347 charger instance |
276 | * | 276 | * |
277 | * Returns %true if input power source is connected. Note that this is | 277 | * Returns %true if input power source is connected. Note that this is |
278 | * dependent on what platform has configured for usable power sources. For | 278 | * dependent on what platform has configured for usable power sources. For |
279 | * example if USB is disabled, this will return %false even if the USB | 279 | * example if USB is disabled, this will return %false even if the USB cable |
280 | * cable is connected. | 280 | * is connected. |
281 | */ | 281 | */ |
282 | static bool smb347_is_online(struct smb347_charger *smb) | 282 | static bool smb347_is_ps_online(struct smb347_charger *smb) |
283 | { | 283 | { |
284 | bool ret; | 284 | bool ret; |
285 | 285 | ||
@@ -301,7 +301,7 @@ static int smb347_charging_status(struct smb347_charger *smb) | |||
301 | { | 301 | { |
302 | int ret; | 302 | int ret; |
303 | 303 | ||
304 | if (!smb347_is_online(smb)) | 304 | if (!smb347_is_ps_online(smb)) |
305 | return 0; | 305 | return 0; |
306 | 306 | ||
307 | ret = smb347_read(smb, STAT_C); | 307 | ret = smb347_read(smb, STAT_C); |
@@ -351,7 +351,7 @@ static inline int smb347_charging_disable(struct smb347_charger *smb) | |||
351 | return smb347_charging_set(smb, false); | 351 | return smb347_charging_set(smb, false); |
352 | } | 352 | } |
353 | 353 | ||
354 | static int smb347_update_online(struct smb347_charger *smb) | 354 | static int smb347_start_stop_charging(struct smb347_charger *smb) |
355 | { | 355 | { |
356 | int ret; | 356 | int ret; |
357 | 357 | ||
@@ -360,7 +360,7 @@ static int smb347_update_online(struct smb347_charger *smb) | |||
360 | * disable or enable the charging. We do it manually because it | 360 | * disable or enable the charging. We do it manually because it |
361 | * depends on how the platform has configured the valid inputs. | 361 | * depends on how the platform has configured the valid inputs. |
362 | */ | 362 | */ |
363 | if (smb347_is_online(smb)) { | 363 | if (smb347_is_ps_online(smb)) { |
364 | ret = smb347_charging_enable(smb); | 364 | ret = smb347_charging_enable(smb); |
365 | if (ret < 0) | 365 | if (ret < 0) |
366 | dev_err(&smb->client->dev, | 366 | dev_err(&smb->client->dev, |
@@ -749,11 +749,11 @@ static int smb347_hw_init(struct smb347_charger *smb) | |||
749 | if (ret < 0) | 749 | if (ret < 0) |
750 | goto fail; | 750 | goto fail; |
751 | 751 | ||
752 | ret = smb347_update_status(smb); | 752 | ret = smb347_update_ps_status(smb); |
753 | if (ret < 0) | 753 | if (ret < 0) |
754 | goto fail; | 754 | goto fail; |
755 | 755 | ||
756 | ret = smb347_update_online(smb); | 756 | ret = smb347_start_stop_charging(smb); |
757 | 757 | ||
758 | fail: | 758 | fail: |
759 | smb347_set_writable(smb, false); | 759 | smb347_set_writable(smb, false); |
@@ -814,8 +814,8 @@ static irqreturn_t smb347_interrupt(int irq, void *data) | |||
814 | * was connected or disconnected. | 814 | * was connected or disconnected. |
815 | */ | 815 | */ |
816 | if (irqstat_e & (IRQSTAT_E_USBIN_UV_IRQ | IRQSTAT_E_DCIN_UV_IRQ)) { | 816 | if (irqstat_e & (IRQSTAT_E_USBIN_UV_IRQ | IRQSTAT_E_DCIN_UV_IRQ)) { |
817 | if (smb347_update_status(smb) > 0) { | 817 | if (smb347_update_ps_status(smb) > 0) { |
818 | smb347_update_online(smb); | 818 | smb347_start_stop_charging(smb); |
819 | if (smb->pdata->use_mains) | 819 | if (smb->pdata->use_mains) |
820 | power_supply_changed(&smb->mains); | 820 | power_supply_changed(&smb->mains); |
821 | if (smb->pdata->use_usb) | 821 | if (smb->pdata->use_usb) |
@@ -989,13 +989,13 @@ static int smb347_battery_get_property(struct power_supply *psy, | |||
989 | const struct smb347_charger_platform_data *pdata = smb->pdata; | 989 | const struct smb347_charger_platform_data *pdata = smb->pdata; |
990 | int ret; | 990 | int ret; |
991 | 991 | ||
992 | ret = smb347_update_status(smb); | 992 | ret = smb347_update_ps_status(smb); |
993 | if (ret < 0) | 993 | if (ret < 0) |
994 | return ret; | 994 | return ret; |
995 | 995 | ||
996 | switch (prop) { | 996 | switch (prop) { |
997 | case POWER_SUPPLY_PROP_STATUS: | 997 | case POWER_SUPPLY_PROP_STATUS: |
998 | if (!smb347_is_online(smb)) { | 998 | if (!smb347_is_ps_online(smb)) { |
999 | val->intval = POWER_SUPPLY_STATUS_DISCHARGING; | 999 | val->intval = POWER_SUPPLY_STATUS_DISCHARGING; |
1000 | break; | 1000 | break; |
1001 | } | 1001 | } |
@@ -1006,7 +1006,7 @@ static int smb347_battery_get_property(struct power_supply *psy, | |||
1006 | break; | 1006 | break; |
1007 | 1007 | ||
1008 | case POWER_SUPPLY_PROP_CHARGE_TYPE: | 1008 | case POWER_SUPPLY_PROP_CHARGE_TYPE: |
1009 | if (!smb347_is_online(smb)) | 1009 | if (!smb347_is_ps_online(smb)) |
1010 | return -ENODATA; | 1010 | return -ENODATA; |
1011 | 1011 | ||
1012 | /* | 1012 | /* |
@@ -1039,7 +1039,7 @@ static int smb347_battery_get_property(struct power_supply *psy, | |||
1039 | break; | 1039 | break; |
1040 | 1040 | ||
1041 | case POWER_SUPPLY_PROP_VOLTAGE_NOW: | 1041 | case POWER_SUPPLY_PROP_VOLTAGE_NOW: |
1042 | if (!smb347_is_online(smb)) | 1042 | if (!smb347_is_ps_online(smb)) |
1043 | return -ENODATA; | 1043 | return -ENODATA; |
1044 | ret = smb347_read(smb, STAT_A); | 1044 | ret = smb347_read(smb, STAT_A); |
1045 | if (ret < 0) | 1045 | if (ret < 0) |
@@ -1053,7 +1053,7 @@ static int smb347_battery_get_property(struct power_supply *psy, | |||
1053 | break; | 1053 | break; |
1054 | 1054 | ||
1055 | case POWER_SUPPLY_PROP_CURRENT_NOW: | 1055 | case POWER_SUPPLY_PROP_CURRENT_NOW: |
1056 | if (!smb347_is_online(smb)) | 1056 | if (!smb347_is_ps_online(smb)) |
1057 | return -ENODATA; | 1057 | return -ENODATA; |
1058 | 1058 | ||
1059 | ret = smb347_read(smb, STAT_B); | 1059 | ret = smb347_read(smb, STAT_B); |