]> git.baikalelectronics.ru Git - kernel.git/commit
extcon: Fix hang and extcon_get/set_cable_state().
authorRoger Quadros <rogerq@ti.com>
Tue, 7 Jul 2015 13:06:15 +0000 (16:06 +0300)
committerChanwoo Choi <cw00.choi@samsung.com>
Fri, 31 Jul 2015 01:08:47 +0000 (10:08 +0900)
commit3bda8f1d43262384f8ec7a3be3d517ff5381abe0
treea730360e39f24ab9b75fb930eecc615d21e0baca
parent78cab0b9691aec8d86a23a32a184c08675d7e124
extcon: Fix hang and extcon_get/set_cable_state().

Users of find_cable_index_by_name() will cause a kernel hang
as the while loop counter is never incremented and end condition
is never reached.

extcon_get_cable_state() and extcon_set_cable_state() are broken
because they use cable index instead of cable id. This causes
the first cable state (cable.0) to be always invalid in sysfs
or extcon_get_cable_state() users.

Introduce a new function find_cable_id_by_name() that fixes
both of the above issues.

Fixes: commit f099be6751d0 ("extcon: Redefine the unique id of supported external connectors without 'enum extcon' type")
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Roger Quadros <rogerq@ti.com>
Tested-by: Ivan T. Ivanov <ivan.ivanov@linaro.org>
[cw00.choi: Fix minor coding style]
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
drivers/extcon/extcon.c