From mboxrd@z Thu Jan 1 00:00:00 1970 From: cw00.choi@samsung.com (Chanwoo Choi) Date: Mon, 21 Sep 2015 10:36:47 +0900 Subject: [PATCH resend] extcon: Fix attached value returned by is_extcon_changed In-Reply-To: <1442752494-22244-2-git-send-email-hdegoede@redhat.com> References: <1442752494-22244-1-git-send-email-hdegoede@redhat.com> <1442752494-22244-2-git-send-email-hdegoede@redhat.com> Message-ID: <55FF5F2F.9010504@samsung.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On 2015? 09? 20? 21:34, 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 at vger.kernel.org > Signed-off-by: Hans de Goede > --- > 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 a07addd..8dd0af1 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; > } > > This patch was already applied[1]. [1] https://git.kernel.org/cgit/linux/kernel/git/chanwoo/extcon.git/log/?h=extcon-next Thanks, Chanwoo Choi From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailout4.samsung.com ([203.254.224.34]:58501 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755777AbbIUBg5 convert rfc822-to-8bit (ORCPT ); Sun, 20 Sep 2015 21:36:57 -0400 Received: from epcpsbgr5.samsung.com (u145.gpu120.samsung.co.kr [203.254.230.145]) by mailout4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NV0018KM75BJOC0@mailout4.samsung.com> for stable@vger.kernel.org; Mon, 21 Sep 2015 10:36:48 +0900 (KST) MIME-version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 8BIT Message-id: <55FF5F2F.9010504@samsung.com> Date: Mon, 21 Sep 2015 10:36:47 +0900 From: Chanwoo Choi To: Hans de Goede , MyungJoo Ham Cc: Maxime Ripard , Chen-Yu Tsai , linux-arm-kernel@lists.infradead.org, stable@vger.kernel.org Subject: Re: [PATCH resend] extcon: Fix attached value returned by is_extcon_changed References: <1442752494-22244-1-git-send-email-hdegoede@redhat.com> <1442752494-22244-2-git-send-email-hdegoede@redhat.com> In-reply-to: <1442752494-22244-2-git-send-email-hdegoede@redhat.com> Sender: stable-owner@vger.kernel.org List-ID: On 2015년 09월 20일 21:34, 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 > --- > 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 a07addd..8dd0af1 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; > } > > This patch was already applied[1]. [1] https://git.kernel.org/cgit/linux/kernel/git/chanwoo/extcon.git/log/?h=extcon-next Thanks, Chanwoo Choi