diff options
author | Alexander Stein <alexander.stein@ew.tq-group.com> | 2021-11-23 15:53:01 +0100 |
---|---|---|
committer | Chanwoo Choi <cw00.choi@samsung.com> | 2021-12-24 15:27:52 +0900 |
commit | 2da3db7f498d8b6137566b4869d289938b69de13 (patch) | |
tree | bea5a047d1c5ecf7c14566e58faf0b137ed59eeb /drivers/extcon | |
parent | 38b1a3c6197af61b41a166279bc8f5859106b116 (diff) |
extcon: Deduplicate code in extcon_set_state_sync()
Finding the cable index and checking for changed status is also done
in extcon_set_state(). So calling extcon_set_state_sync() will do these
checks twice. Remove them and use these checks from extcon_set_state().
Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Diffstat (limited to 'drivers/extcon')
-rw-r--r-- | drivers/extcon/extcon.c | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c index e7a9561a826d..a09e704fd0fa 100644 --- a/drivers/extcon/extcon.c +++ b/drivers/extcon/extcon.c @@ -576,19 +576,7 @@ EXPORT_SYMBOL_GPL(extcon_set_state); */ int extcon_set_state_sync(struct extcon_dev *edev, unsigned int id, bool state) { - int ret, index; - unsigned long flags; - - index = find_cable_index_by_id(edev, id); - if (index < 0) - return index; - - /* Check whether the external connector's state is changed. */ - spin_lock_irqsave(&edev->lock, flags); - ret = is_extcon_changed(edev, index, state); - spin_unlock_irqrestore(&edev->lock, flags); - if (!ret) - return 0; + int ret; ret = extcon_set_state(edev, id, state); if (ret < 0) |