power: supply: axp288_charger: Remove no longer needed locking

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>
This commit is contained in:
Hans de Goede 2017-12-26 13:59:04 +01:00 committed by Sebastian Reichel
parent bbafa111ca
commit c28185bd3a
1 changed files with 5 additions and 19 deletions

View File

@ -140,7 +140,6 @@ struct axp288_chrg_info {
struct regmap_irq_chip_data *regmap_irqc; struct regmap_irq_chip_data *regmap_irqc;
int irq[CHRG_INTR_END]; int irq[CHRG_INTR_END];
struct power_supply *psy_usb; struct power_supply *psy_usb;
struct mutex lock;
/* OTG/Host mode */ /* OTG/Host mode */
struct { struct {
@ -361,8 +360,6 @@ static int axp288_charger_usb_set_property(struct power_supply *psy,
int ret = 0; int ret = 0;
int scaled_val; int scaled_val;
mutex_lock(&info->lock);
switch (psp) { switch (psp) {
case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT: case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT:
scaled_val = min(val->intval, info->max_cc); scaled_val = min(val->intval, info->max_cc);
@ -382,7 +379,6 @@ static int axp288_charger_usb_set_property(struct power_supply *psy,
ret = -EINVAL; ret = -EINVAL;
} }
mutex_unlock(&info->lock);
return ret; return ret;
} }
@ -391,9 +387,7 @@ static int axp288_charger_usb_get_property(struct power_supply *psy,
union power_supply_propval *val) union power_supply_propval *val)
{ {
struct axp288_chrg_info *info = power_supply_get_drvdata(psy); struct axp288_chrg_info *info = power_supply_get_drvdata(psy);
int ret = 0; int ret;
mutex_lock(&info->lock);
switch (psp) { switch (psp) {
case POWER_SUPPLY_PROP_PRESENT: case POWER_SUPPLY_PROP_PRESENT:
@ -404,7 +398,7 @@ static int axp288_charger_usb_get_property(struct power_supply *psy,
} }
ret = axp288_charger_is_present(info); ret = axp288_charger_is_present(info);
if (ret < 0) if (ret < 0)
goto psy_get_prop_fail; return ret;
val->intval = ret; val->intval = ret;
break; break;
case POWER_SUPPLY_PROP_ONLINE: case POWER_SUPPLY_PROP_ONLINE:
@ -415,7 +409,7 @@ static int axp288_charger_usb_get_property(struct power_supply *psy,
} }
ret = axp288_charger_is_online(info); ret = axp288_charger_is_online(info);
if (ret < 0) if (ret < 0)
goto psy_get_prop_fail; return ret;
val->intval = ret; val->intval = ret;
break; break;
case POWER_SUPPLY_PROP_HEALTH: case POWER_SUPPLY_PROP_HEALTH:
@ -437,13 +431,10 @@ static int axp288_charger_usb_get_property(struct power_supply *psy,
val->intval = info->inlmt * 1000; val->intval = info->inlmt * 1000;
break; break;
default: default:
ret = -EINVAL; return -EINVAL;
goto psy_get_prop_fail;
} }
psy_get_prop_fail: return 0;
mutex_unlock(&info->lock);
return ret;
} }
static int axp288_charger_property_is_writeable(struct power_supply *psy, static int axp288_charger_property_is_writeable(struct power_supply *psy,
@ -561,9 +552,7 @@ static void axp288_charger_extcon_evt_worker(struct work_struct *work)
/* Offline? Disable charging and bail */ /* Offline? Disable charging and bail */
if (!(val & PS_STAT_VBUS_VALID)) { if (!(val & PS_STAT_VBUS_VALID)) {
dev_dbg(&info->pdev->dev, "USB charger disconnected\n"); dev_dbg(&info->pdev->dev, "USB charger disconnected\n");
mutex_lock(&info->lock);
axp288_charger_enable_charger(info, false); axp288_charger_enable_charger(info, false);
mutex_unlock(&info->lock);
power_supply_changed(info->psy_usb); power_supply_changed(info->psy_usb);
return; return;
} }
@ -583,7 +572,6 @@ static void axp288_charger_extcon_evt_worker(struct work_struct *work)
return; return;
} }
mutex_lock(&info->lock);
/* Set vbus current limit first, then enable charger */ /* Set vbus current limit first, then enable charger */
ret = axp288_charger_set_vbus_inlmt(info, current_limit); ret = axp288_charger_set_vbus_inlmt(info, current_limit);
if (ret == 0) if (ret == 0)
@ -591,7 +579,6 @@ static void axp288_charger_extcon_evt_worker(struct work_struct *work)
else else
dev_err(&info->pdev->dev, dev_err(&info->pdev->dev,
"error setting current limit (%d)\n", ret); "error setting current limit (%d)\n", ret);
mutex_unlock(&info->lock);
power_supply_changed(info->psy_usb); power_supply_changed(info->psy_usb);
} }
@ -784,7 +771,6 @@ static int axp288_charger_probe(struct platform_device *pdev)
} }
platform_set_drvdata(pdev, info); platform_set_drvdata(pdev, info);
mutex_init(&info->lock);
ret = charger_init_hw_regs(info); ret = charger_init_hw_regs(info);
if (ret) if (ret)