diff options
author | Hans de Goede <hdegoede@redhat.com> | 2017-12-26 15:59:04 +0300 |
---|---|---|
committer | Sebastian Reichel <sebastian.reichel@collabora.co.uk> | 2018-01-08 20:38:57 +0300 |
commit | c28185bd3af43bbcf95d659deaef73754b3623fc (patch) | |
tree | cbbd5a857882a2c0aed32e965ea85d177676328d /drivers/power/supply/axp288_charger.c | |
parent | bbafa111caa06339a1ca50a7230c56dea0dffbde (diff) | |
download | linux-c28185bd3af43bbcf95d659deaef73754b3623fc.tar.xz |
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>
Diffstat (limited to 'drivers/power/supply/axp288_charger.c')
-rw-r--r-- | drivers/power/supply/axp288_charger.c | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/drivers/power/supply/axp288_charger.c b/drivers/power/supply/axp288_charger.c index 7b48afca1a1f..070dd79e606f 100644 --- a/drivers/power/supply/axp288_charger.c +++ b/drivers/power/supply/axp288_charger.c @@ -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 { @@ -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); @@ -382,7 +379,6 @@ static int axp288_charger_usb_set_property(struct power_supply *psy, ret = -EINVAL; } - mutex_unlock(&info->lock); return ret; } @@ -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: @@ -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: @@ -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: @@ -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, @@ -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; } @@ -583,7 +572,6 @@ 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) @@ -591,7 +579,6 @@ static void axp288_charger_extcon_evt_worker(struct work_struct *work) else dev_err(&info->pdev->dev, "error setting current limit (%d)\n", ret); - mutex_unlock(&info->lock); power_supply_changed(info->psy_usb); } @@ -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) |