Skip to content

Commit

Permalink
extcon: Fix attached value returned by is_extcon_changed
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Hans de Goede authored and Chanwoo Choi committed Sep 21, 2015
1 parent 1f93e4a commit f4513b0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/extcon/extcon.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit f4513b0

Please sign in to comment.