diff options
author | Hans de Goede <hdegoede@redhat.com> | 2017-12-26 07:59:04 -0500 |
---|---|---|
committer | Sebastian Reichel <sebastian.reichel@collabora.co.uk> | 2018-01-08 12:38:57 -0500 |
commit | c28185bd3af43bbcf95d659deaef73754b3623fc (patch) | |
tree | cbbd5a857882a2c0aed32e965ea85d177676328d | |
parent | bbafa111caa06339a1ca50a7230c56dea0dffbde (diff) |
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>
-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 { | |||
140 | struct regmap_irq_chip_data *regmap_irqc; | 140 | struct regmap_irq_chip_data *regmap_irqc; |
141 | int irq[CHRG_INTR_END]; | 141 | int irq[CHRG_INTR_END]; |
142 | struct power_supply *psy_usb; | 142 | struct power_supply *psy_usb; |
143 | struct mutex lock; | ||
144 | 143 | ||
145 | /* OTG/Host mode */ | 144 | /* OTG/Host mode */ |
146 | struct { | 145 | struct { |
@@ -361,8 +360,6 @@ static int axp288_charger_usb_set_property(struct power_supply *psy, | |||
361 | int ret = 0; | 360 | int ret = 0; |
362 | int scaled_val; | 361 | int scaled_val; |
363 | 362 | ||
364 | mutex_lock(&info->lock); | ||
365 | |||
366 | switch (psp) { | 363 | switch (psp) { |
367 | case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT: | 364 | case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT: |
368 | scaled_val = min(val->intval, info->max_cc); | 365 | scaled_val = min(val->intval, info->max_cc); |
@@ -382,7 +379,6 @@ static int axp288_charger_usb_set_property(struct power_supply *psy, | |||
382 | ret = -EINVAL; | 379 | ret = -EINVAL; |
383 | } | 380 | } |
384 | 381 | ||
385 | mutex_unlock(&info->lock); | ||
386 | return ret; | 382 | return ret; |
387 | } | 383 | } |
388 | 384 | ||
@@ -391,9 +387,7 @@ static int axp288_charger_usb_get_property(struct power_supply *psy, | |||
391 | union power_supply_propval *val) | 387 | union power_supply_propval *val) |
392 | { | 388 | { |
393 | struct axp288_chrg_info *info = power_supply_get_drvdata(psy); | 389 | struct axp288_chrg_info *info = power_supply_get_drvdata(psy); |
394 | int ret = 0; | 390 | int ret; |
395 | |||
396 | mutex_lock(&info->lock); | ||
397 | 391 | ||
398 | switch (psp) { | 392 | switch (psp) { |
399 | case POWER_SUPPLY_PROP_PRESENT: | 393 | case POWER_SUPPLY_PROP_PRESENT: |
@@ -404,7 +398,7 @@ static int axp288_charger_usb_get_property(struct power_supply *psy, | |||
404 | } | 398 | } |
405 | ret = axp288_charger_is_present(info); | 399 | ret = axp288_charger_is_present(info); |
406 | if (ret < 0) | 400 | if (ret < 0) |
407 | goto psy_get_prop_fail; | 401 | return ret; |
408 | val->intval = ret; | 402 | val->intval = ret; |
409 | break; | 403 | break; |
410 | case POWER_SUPPLY_PROP_ONLINE: | 404 | case POWER_SUPPLY_PROP_ONLINE: |
@@ -415,7 +409,7 @@ static int axp288_charger_usb_get_property(struct power_supply *psy, | |||
415 | } | 409 | } |
416 | ret = axp288_charger_is_online(info); | 410 | ret = axp288_charger_is_online(info); |
417 | if (ret < 0) | 411 | if (ret < 0) |
418 | goto psy_get_prop_fail; | 412 | return ret; |
419 | val->intval = ret; | 413 | val->intval = ret; |
420 | break; | 414 | break; |
421 | case POWER_SUPPLY_PROP_HEALTH: | 415 | case POWER_SUPPLY_PROP_HEALTH: |
@@ -437,13 +431,10 @@ static int axp288_charger_usb_get_property(struct power_supply *psy, | |||
437 | val->intval = info->inlmt * 1000; | 431 | val->intval = info->inlmt * 1000; |
438 | break; | 432 | break; |
439 | default: | 433 | default: |
440 | ret = -EINVAL; | 434 | return -EINVAL; |
441 | goto psy_get_prop_fail; | ||
442 | } | 435 | } |
443 | 436 | ||
444 | psy_get_prop_fail: | 437 | return 0; |
445 | mutex_unlock(&info->lock); | ||
446 | return ret; | ||
447 | } | 438 | } |
448 | 439 | ||
449 | static int axp288_charger_property_is_writeable(struct power_supply *psy, | 440 | 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) | |||
561 | /* Offline? Disable charging and bail */ | 552 | /* Offline? Disable charging and bail */ |
562 | if (!(val & PS_STAT_VBUS_VALID)) { | 553 | if (!(val & PS_STAT_VBUS_VALID)) { |
563 | dev_dbg(&info->pdev->dev, "USB charger disconnected\n"); | 554 | dev_dbg(&info->pdev->dev, "USB charger disconnected\n"); |
564 | mutex_lock(&info->lock); | ||
565 | axp288_charger_enable_charger(info, false); | 555 | axp288_charger_enable_charger(info, false); |
566 | mutex_unlock(&info->lock); | ||
567 | power_supply_changed(info->psy_usb); | 556 | power_supply_changed(info->psy_usb); |
568 | return; | 557 | return; |
569 | } | 558 | } |
@@ -583,7 +572,6 @@ static void axp288_charger_extcon_evt_worker(struct work_struct *work) | |||
583 | return; | 572 | return; |
584 | } | 573 | } |
585 | 574 | ||
586 | mutex_lock(&info->lock); | ||
587 | /* Set vbus current limit first, then enable charger */ | 575 | /* Set vbus current limit first, then enable charger */ |
588 | ret = axp288_charger_set_vbus_inlmt(info, current_limit); | 576 | ret = axp288_charger_set_vbus_inlmt(info, current_limit); |
589 | if (ret == 0) | 577 | if (ret == 0) |
@@ -591,7 +579,6 @@ static void axp288_charger_extcon_evt_worker(struct work_struct *work) | |||
591 | else | 579 | else |
592 | dev_err(&info->pdev->dev, | 580 | dev_err(&info->pdev->dev, |
593 | "error setting current limit (%d)\n", ret); | 581 | "error setting current limit (%d)\n", ret); |
594 | mutex_unlock(&info->lock); | ||
595 | 582 | ||
596 | power_supply_changed(info->psy_usb); | 583 | power_supply_changed(info->psy_usb); |
597 | } | 584 | } |
@@ -784,7 +771,6 @@ static int axp288_charger_probe(struct platform_device *pdev) | |||
784 | } | 771 | } |
785 | 772 | ||
786 | platform_set_drvdata(pdev, info); | 773 | platform_set_drvdata(pdev, info); |
787 | mutex_init(&info->lock); | ||
788 | 774 | ||
789 | ret = charger_init_hw_regs(info); | 775 | ret = charger_init_hw_regs(info); |
790 | if (ret) | 776 | if (ret) |