summaryrefslogtreecommitdiff
path: root/drivers/extcon
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2015-08-24 00:35:36 +0200
committerChanwoo Choi <cw00.choi@samsung.com>2015-09-15 08:55:45 +0900
commit3070ed6b1d6d8b0b8bfeeecf08c37d2ba84bb1bc (patch)
tree26d2fe0a991945a3329e6acdfd69f6c6f7b266fe /drivers/extcon
parent6ff33f3902c3b1c5d0db6b1e2c70b6d76fba357f (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.c2
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)
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;
}