* [PATCH] extcon: Fix attached value returned by is_extcon_changed
@ 2015-08-23 22:35 Hans de Goede
2015-09-03 6:57 ` Chanwoo Choi
0 siblings, 1 reply; 2+ messages in thread
From: Hans de Goede @ 2015-08-23 22:35 UTC (permalink / raw)
To: MyungJoo Ham, Chanwoo Choi; +Cc: linux-kernel, Hans de Goede, stable
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>
---
drivers/extcon/extcon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index 43b57b0..c4698ce 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;
}
--
2.4.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] extcon: Fix attached value returned by is_extcon_changed
2015-08-23 22:35 [PATCH] extcon: Fix attached value returned by is_extcon_changed Hans de Goede
@ 2015-09-03 6:57 ` Chanwoo Choi
0 siblings, 0 replies; 2+ messages in thread
From: Chanwoo Choi @ 2015-09-03 6:57 UTC (permalink / raw)
To: Hans de Goede, MyungJoo Ham; +Cc: linux-kernel, stable
On 2015년 08월 24일 07:35, Hans de Goede wrote:
> 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>
> ---
> drivers/extcon/extcon.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
> index 43b57b0..c4698ce 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;
> }
>
>
Applied it.
Thanks,
Chanwoo Choi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-09-03 6:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-23 22:35 [PATCH] extcon: Fix attached value returned by is_extcon_changed Hans de Goede
2015-09-03 6:57 ` Chanwoo Choi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).