Skip to content

Commit

Permalink
power: supply: axp288_charger: Remove no longer needed locking
Browse files Browse the repository at this point in the history
Now that we use regmap to do read-modify-write ops everywhere, we can
rely on the regmap lock and no longer need our own lock.

Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
  • Loading branch information
Hans de Goede authored and Sebastian Reichel committed Jan 8, 2018
1 parent bbafa11 commit c28185b
Showing 1 changed file with 5 additions and 19 deletions.
24 changes: 5 additions & 19 deletions drivers/power/supply/axp288_charger.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ struct axp288_chrg_info {
struct regmap_irq_chip_data *regmap_irqc;
int irq[CHRG_INTR_END];
struct power_supply *psy_usb;
struct mutex lock;

/* OTG/Host mode */
struct {
Expand Down Expand Up @@ -361,8 +360,6 @@ static int axp288_charger_usb_set_property(struct power_supply *psy,
int ret = 0;
int scaled_val;

mutex_lock(&info->lock);

switch (psp) {
case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT:
scaled_val = min(val->intval, info->max_cc);
Expand All @@ -382,7 +379,6 @@ static int axp288_charger_usb_set_property(struct power_supply *psy,
ret = -EINVAL;
}

mutex_unlock(&info->lock);
return ret;
}

Expand All @@ -391,9 +387,7 @@ static int axp288_charger_usb_get_property(struct power_supply *psy,
union power_supply_propval *val)
{
struct axp288_chrg_info *info = power_supply_get_drvdata(psy);
int ret = 0;

mutex_lock(&info->lock);
int ret;

switch (psp) {
case POWER_SUPPLY_PROP_PRESENT:
Expand All @@ -404,7 +398,7 @@ static int axp288_charger_usb_get_property(struct power_supply *psy,
}
ret = axp288_charger_is_present(info);
if (ret < 0)
goto psy_get_prop_fail;
return ret;
val->intval = ret;
break;
case POWER_SUPPLY_PROP_ONLINE:
Expand All @@ -415,7 +409,7 @@ static int axp288_charger_usb_get_property(struct power_supply *psy,
}
ret = axp288_charger_is_online(info);
if (ret < 0)
goto psy_get_prop_fail;
return ret;
val->intval = ret;
break;
case POWER_SUPPLY_PROP_HEALTH:
Expand All @@ -437,13 +431,10 @@ static int axp288_charger_usb_get_property(struct power_supply *psy,
val->intval = info->inlmt * 1000;
break;
default:
ret = -EINVAL;
goto psy_get_prop_fail;
return -EINVAL;
}

psy_get_prop_fail:
mutex_unlock(&info->lock);
return ret;
return 0;
}

static int axp288_charger_property_is_writeable(struct power_supply *psy,
Expand Down Expand Up @@ -561,9 +552,7 @@ static void axp288_charger_extcon_evt_worker(struct work_struct *work)
/* Offline? Disable charging and bail */
if (!(val & PS_STAT_VBUS_VALID)) {
dev_dbg(&info->pdev->dev, "USB charger disconnected\n");
mutex_lock(&info->lock);
axp288_charger_enable_charger(info, false);
mutex_unlock(&info->lock);
power_supply_changed(info->psy_usb);
return;
}
Expand All @@ -583,15 +572,13 @@ static void axp288_charger_extcon_evt_worker(struct work_struct *work)
return;
}

mutex_lock(&info->lock);
/* Set vbus current limit first, then enable charger */
ret = axp288_charger_set_vbus_inlmt(info, current_limit);
if (ret == 0)
axp288_charger_enable_charger(info, true);
else
dev_err(&info->pdev->dev,
"error setting current limit (%d)\n", ret);
mutex_unlock(&info->lock);

power_supply_changed(info->psy_usb);
}
Expand Down Expand Up @@ -784,7 +771,6 @@ static int axp288_charger_probe(struct platform_device *pdev)
}

platform_set_drvdata(pdev, info);
mutex_init(&info->lock);

ret = charger_init_hw_regs(info);
if (ret)
Expand Down

0 comments on commit c28185b

Please sign in to comment.