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>
This commit is contained in:
parent
1f93e4a96c
commit
f4513b065f
1 changed files with 1 additions and 1 deletions
|
@ -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)
|
static bool is_extcon_changed(u32 prev, u32 new, int idx, bool *attached)
|
||||||
{
|
{
|
||||||
if (((prev >> idx) & 0x1) != ((new >> idx) & 0x1)) {
|
if (((prev >> idx) & 0x1) != ((new >> idx) & 0x1)) {
|
||||||
*attached = new ? true : false;
|
*attached = ((new >> idx) & 0x1) ? true : false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue