summaryrefslogtreecommitdiffstats
path: root/drivers/extcon/extcon.h
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2023-04-11 14:48:22 +0300
committerChanwoo Choi <cw00.choi@samsung.com>2023-05-29 23:41:29 +0900
commit7bba9e81a6fbf00daa4063c41da6b250d339f43b (patch)
treed5fc45730617aaad45bcd3e9cee92c7db6c25446 /drivers/extcon/extcon.h
parent566825a31f65da111270abac35662502706e7c8a (diff)
downloadlinux-stable-7bba9e81a6fbf00daa4063c41da6b250d339f43b.tar.gz
linux-stable-7bba9e81a6fbf00daa4063c41da6b250d339f43b.tar.bz2
linux-stable-7bba9e81a6fbf00daa4063c41da6b250d339f43b.zip
extcon: Use unique number for the extcon device ID
The use of atomic variable is still racy when we do not control which device has been unregistered and there is a (theoretical) possibility of the overflow that may cause a duplicate extcon device ID number to be allocated next time a device is registered. Replace above mentioned approach by using IDA framework. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Diffstat (limited to 'drivers/extcon/extcon.h')
-rw-r--r--drivers/extcon/extcon.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/extcon/extcon.h b/drivers/extcon/extcon.h
index 15616446140d..946182687786 100644
--- a/drivers/extcon/extcon.h
+++ b/drivers/extcon/extcon.h
@@ -20,6 +20,7 @@
* {0x3, 0x6, 0x5, 0}. If it is {0xFFFFFFFF, 0}, there
* can be no simultaneous connections.
* @dev: Device of this extcon.
+ * @id: Unique device ID of this extcon.
* @state: Attach/detach state of this extcon. Do not provide at
* register-time.
* @nh_all: Notifier for the state change events for all supported
@@ -46,6 +47,7 @@ struct extcon_dev {
/* Internal data. Please do not set. */
struct device dev;
+ unsigned int id;
struct raw_notifier_head nh_all;
struct raw_notifier_head *nh;
struct list_head entry;