Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1249551 > unrolled thread

[PATCH 4.2 175/258] extcon: Fix attached value returned by is_extcon_changed

Started byGreg Kroah-Hartman <gregkh@linuxfoundation.org>
First post2015-10-18 04:30 +0200
Last post2015-10-18 04:30 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 4.2 175/258] extcon: Fix attached value returned by is_extcon_changed Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-18 04:30 +0200

#1249551 — [PATCH 4.2 175/258] extcon: Fix attached value returned by is_extcon_changed

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2015-10-18 04:30 +0200
Subject[PATCH 4.2 175/258] extcon: Fix attached value returned by is_extcon_changed
Message-ID<qkLTt-8a8-41@gated-at.bofh.it>
4.2-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Hans de Goede <hdegoede@redhat.com>

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>

---
 drivers/extcon/extcon.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -159,7 +159,7 @@ static int find_cable_index_by_name(stru
 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;
 	}
 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web