Skip to contentSkip to conversation

extcon: Fix attached value returned by is_extcon_changed

PATCH RESEND Superseded Hans de Goede 2 participants 7 messages Sep 20, 2015 – Sep 22, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 extcon: Fix attached value returned by is_extcon_changed

Hi MyungJoo,

Here is a resend of a bug-fix I send a while back, you said you would merge this for v4.3-rc1, but I'm not seeing it there.

Can you please get this merged into 4.3, without this fix the sunxi usb otg controller support which got merged in 4.3 will not work properly.

Regards,

Hans

#1 lore raw

PATCH RESEND 1/1 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 at vger.kernel.org
---
 drivers/extcon/extcon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/extcon/extcon.c +1 -1
index a07addd..8dd0af1 100644
@@ -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;
 	}
 
Signature · 1 line
2.4.3
maintainer
#2 lore raw

PATCH RESEND 1/1 extcon: Fix attached value returned by is_extcon_changed

Quoted 18 lines · Hans de Goede

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
---
 drivers/extcon/extcon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/extcon/extcon.c +0 -0
index a07addd..8dd0af1 100644

drivers/extcon/extcon.c static int find_cable_index_by_name(struct extcon_dev *edev, const char *name) · line 165

Quoted 8 lines
drivers/extcon/extcon.c +1 -1
@@ -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

#3 lore raw

PATCH RESEND 1/1 extcon: Fix attached value returned by is_extcon_changed

Hi,

Quoted 22 lines · Chanwoo Choi
Quoted 21 lines · Hans de Goede

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
---
  drivers/extcon/extcon.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/extcon/extcon.c +0 -1
index a07addd..8dd0af1 100644
@@ -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;
Quoted 8 lines

drivers/extcon/extcon.c static int find_cable_index_by_name(struct extcon_dev *edev, const char *name) · line 165

Quoted 5 lines
drivers/extcon/extcon.c +1 -0
+		*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

Yet it is not in 4.3-rc1, applying the patch to your tree is not useful unless you also send a pull-req to get the changes in your tree actually merged ...

Regards,

Hans

maintainer
#4 lore raw

PATCH RESEND 1/1 extcon: Fix attached value returned by is_extcon_changed

Hi,

Quoted 34 lines · Hans de Goede

Hi,

Quoted 22 lines · Chanwoo Choi
Quoted 21 lines · Hans de Goede

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
---
  drivers/extcon/extcon.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/extcon/extcon.c +0 -1
index a07addd..8dd0af1 100644
@@ -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;
Quoted 8 lines

drivers/extcon/extcon.c static int find_cable_index_by_name(struct extcon_dev *edev, const char *name) · line 165

Quoted 5 lines
drivers/extcon/extcon.c +1 -0
+        *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

Quoted 3 lines

Yet it is not in 4.3-rc1, applying the patch to your tree is not useful unless you also send a pull-req to get the changes in your tree actually merged ...

No. It is useful step. It is first step to send pull-request for including the main tree. I'll send pull-request before releasing official version.

Thanks,
Chanwoo Choi

#5 lore raw

PATCH RESEND 1/1 extcon: Fix attached value returned by is_extcon_changed

Hi,

Quoted 37 lines · Chanwoo Choi

Hi,

Quoted 34 lines · Hans de Goede

Hi,

Quoted 30 lines · Chanwoo Choi
Quoted 18 lines · Hans de Goede

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
---
   drivers/extcon/extcon.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
drivers/extcon/extcon.c +0 -0
index a07addd..8dd0af1 100644

drivers/extcon/extcon.c static int find_cable_index_by_name(struct extcon_dev *edev, const char *name) · line 165

Quoted 8 lines
drivers/extcon/extcon.c +1 -1
@@ -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

Quoted 6 lines
Quoted 3 lines

Yet it is not in 4.3-rc1, applying the patch to your tree is not useful unless you also send a pull-req to get the changes in your tree actually merged ...

No. It is useful step. It is first step to send pull-request for including the main tree. I'll send pull-request before releasing official version.

This patch fixes a bug in the extcon core, thus affecting ALL extcon users, the patch is trivial, so IMHO this patch should have been part of a pull-req already, adn should be Cc: stable at vger.kernel.org. When you do you plan to submit a pullreq with this patch ?

Regards,

Hans

maintainer
#6 lore raw

PATCH RESEND 1/1 extcon: Fix attached value returned by is_extcon_changed

Quoted 40 lines · Hans de Goede

Hi,

Quoted 37 lines · Chanwoo Choi

Hi,

Quoted 34 lines · Hans de Goede

Hi,

Quoted 30 lines · Chanwoo Choi
Quoted 18 lines · Hans de Goede

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
---
   drivers/extcon/extcon.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
drivers/extcon/extcon.c +0 -0
index a07addd..8dd0af1 100644

drivers/extcon/extcon.c static int find_cable_index_by_name(struct extcon_dev *edev, const char *name) · line 165

Quoted 8 lines
drivers/extcon/extcon.c +1 -1
@@ -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

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

Yet it is not in 4.3-rc1, applying the patch to your tree is not useful unless you also send a pull-req to get the changes in your tree actually merged ...

No. It is useful step. It is first step to send pull-request for including the main tree. I'll send pull-request before releasing official version.

This patch fixes a bug in the extcon core, thus affecting ALL extcon users, the patch

I know.

Quoted 1 line

is trivial, so IMHO this patch should have been part of a pull-req already, adn should

I'll send pull-request to include this patch on rc release. But it is not fixed that should be included in rc1. Don't worry about this patch that is included in rcX version.

Quoted 2 lines

be Cc: stable at vger.kernel.org. When you do you plan to submit a pullreq with this patch ?

I'll send fixes pull-request wihtin this week for including it in rc3.

Thanks,
Chanwoo Choi