Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 309684
b: refs/heads/master
c: 055d7f0
h: refs/heads/master
v: v3
  • Loading branch information
Mika Westerberg authored and Anton Vorontsov committed May 5, 2012
1 parent ca1f6d3 commit 523442a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b75ef1d807e20919a00bed16045537e76e0497a7
refs/heads/master: 055d7f0f29b2af6ec8fd5da9f0ce27b9e9e63436
42 changes: 21 additions & 21 deletions trunk/drivers/power/smb347-charger.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,14 +235,14 @@ static int smb347_write(struct smb347_charger *smb, u8 reg, u8 val)
}

/**
* smb347_update_status - updates the charging status
* smb347_update_ps_status - refreshes the power source status
* @smb: pointer to smb347 charger instance
*
* Function checks status of the charging and updates internal state
* accordingly. Returns %0 if there is no change in status, %1 if the
* status has changed and negative errno in case of failure.
* Function checks whether any power source is connected to the charger and
* updates internal state accordingly. If there is a change to previous state
* function returns %1, otherwise %0 and negative errno in case of errror.
*/
static int smb347_update_status(struct smb347_charger *smb)
static int smb347_update_ps_status(struct smb347_charger *smb)
{
bool usb = false;
bool dc = false;
Expand Down Expand Up @@ -271,15 +271,15 @@ static int smb347_update_status(struct smb347_charger *smb)
}

/*
* smb347_is_online - returns whether input power source is connected
* smb347_is_ps_online - returns whether input power source is connected
* @smb: pointer to smb347 charger instance
*
* Returns %true if input power source is connected. Note that this is
* dependent on what platform has configured for usable power sources. For
* example if USB is disabled, this will return %false even if the USB
* cable is connected.
* example if USB is disabled, this will return %false even if the USB cable
* is connected.
*/
static bool smb347_is_online(struct smb347_charger *smb)
static bool smb347_is_ps_online(struct smb347_charger *smb)
{
bool ret;

Expand All @@ -301,7 +301,7 @@ static int smb347_charging_status(struct smb347_charger *smb)
{
int ret;

if (!smb347_is_online(smb))
if (!smb347_is_ps_online(smb))
return 0;

ret = smb347_read(smb, STAT_C);
Expand Down Expand Up @@ -351,7 +351,7 @@ static inline int smb347_charging_disable(struct smb347_charger *smb)
return smb347_charging_set(smb, false);
}

static int smb347_update_online(struct smb347_charger *smb)
static int smb347_start_stop_charging(struct smb347_charger *smb)
{
int ret;

Expand All @@ -360,7 +360,7 @@ static int smb347_update_online(struct smb347_charger *smb)
* disable or enable the charging. We do it manually because it
* depends on how the platform has configured the valid inputs.
*/
if (smb347_is_online(smb)) {
if (smb347_is_ps_online(smb)) {
ret = smb347_charging_enable(smb);
if (ret < 0)
dev_err(&smb->client->dev,
Expand Down Expand Up @@ -749,11 +749,11 @@ static int smb347_hw_init(struct smb347_charger *smb)
if (ret < 0)
goto fail;

ret = smb347_update_status(smb);
ret = smb347_update_ps_status(smb);
if (ret < 0)
goto fail;

ret = smb347_update_online(smb);
ret = smb347_start_stop_charging(smb);

fail:
smb347_set_writable(smb, false);
Expand Down Expand Up @@ -814,8 +814,8 @@ static irqreturn_t smb347_interrupt(int irq, void *data)
* was connected or disconnected.
*/
if (irqstat_e & (IRQSTAT_E_USBIN_UV_IRQ | IRQSTAT_E_DCIN_UV_IRQ)) {
if (smb347_update_status(smb) > 0) {
smb347_update_online(smb);
if (smb347_update_ps_status(smb) > 0) {
smb347_start_stop_charging(smb);
if (smb->pdata->use_mains)
power_supply_changed(&smb->mains);
if (smb->pdata->use_usb)
Expand Down Expand Up @@ -989,13 +989,13 @@ static int smb347_battery_get_property(struct power_supply *psy,
const struct smb347_charger_platform_data *pdata = smb->pdata;
int ret;

ret = smb347_update_status(smb);
ret = smb347_update_ps_status(smb);
if (ret < 0)
return ret;

switch (prop) {
case POWER_SUPPLY_PROP_STATUS:
if (!smb347_is_online(smb)) {
if (!smb347_is_ps_online(smb)) {
val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
break;
}
Expand All @@ -1006,7 +1006,7 @@ static int smb347_battery_get_property(struct power_supply *psy,
break;

case POWER_SUPPLY_PROP_CHARGE_TYPE:
if (!smb347_is_online(smb))
if (!smb347_is_ps_online(smb))
return -ENODATA;

/*
Expand Down Expand Up @@ -1039,7 +1039,7 @@ static int smb347_battery_get_property(struct power_supply *psy,
break;

case POWER_SUPPLY_PROP_VOLTAGE_NOW:
if (!smb347_is_online(smb))
if (!smb347_is_ps_online(smb))
return -ENODATA;
ret = smb347_read(smb, STAT_A);
if (ret < 0)
Expand All @@ -1053,7 +1053,7 @@ static int smb347_battery_get_property(struct power_supply *psy,
break;

case POWER_SUPPLY_PROP_CURRENT_NOW:
if (!smb347_is_online(smb))
if (!smb347_is_ps_online(smb))
return -ENODATA;

ret = smb347_read(smb, STAT_B);
Expand Down

0 comments on commit 523442a

Please sign in to comment.