aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2015-08-24 00:35:36 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-10-22 14:49:28 -0700
commitf11d76eb7e8776b64b9fbded9691f694810d5c72 (patch)
tree6497ce98805fc497c89bd3901da0374d0062ae9b /drivers
parent930c6cd2bd843abf267c833b3164fd760c48066a (diff)
extcon: Fix attached value returned by is_extcon_changed
commit f4513b065f7dbd37224226ef6e44b09eff742776 upstream. is_extcon_changed should only check the idx-th bit of new, not the entirety of new when setting attached. This fixes extcon sending notifications that a cable was inserted when it gets removed while another cable is still connected. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/extcon/extcon.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index a394ca419715..ca94f475fd05 100644
--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -159,7 +159,7 @@ static int find_cable_index_by_name(struct extcon_dev *edev, const char *name)
static bool is_extcon_changed(u32 prev, u32 new, int idx, bool *attached)
{
if (((prev >> idx) & 0x1) != ((new >> idx) & 0x1)) {
- *attached = new ? true : false;
+ *attached = ((new >> idx) & 0x1) ? true : false;
return true;
}