diff options
author | Hans de Goede <hdegoede@redhat.com> | 2015-08-23 18:35:36 -0400 |
---|---|---|
committer | Chanwoo Choi <cw00.choi@samsung.com> | 2015-09-21 02:07:19 -0400 |
commit | f4513b065f7dbd37224226ef6e44b09eff742776 (patch) | |
tree | 29e311e448ab030241f808fc4603fa32a41e84de /drivers/extcon | |
parent | 1f93e4a96c9109378204c147b3eec0d0e8100fde (diff) |
extcon: Fix attached value returned by is_extcon_changed
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.
Cc: stable@vger.kernel.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Diffstat (limited to 'drivers/extcon')
-rw-r--r-- | drivers/extcon/extcon.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c index a07addde297b..8dd0af1d50bc 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) | |||
159 | static bool is_extcon_changed(u32 prev, u32 new, int idx, bool *attached) | 159 | static bool is_extcon_changed(u32 prev, u32 new, int idx, bool *attached) |
160 | { | 160 | { |
161 | if (((prev >> idx) & 0x1) != ((new >> idx) & 0x1)) { | 161 | if (((prev >> idx) & 0x1) != ((new >> idx) & 0x1)) { |
162 | *attached = new ? true : false; | 162 | *attached = ((new >> idx) & 0x1) ? true : false; |
163 | return true; | 163 | return true; |
164 | } | 164 | } |
165 | 165 | ||