Skip to content

Commit 00a06c2

Browse files
committed
i2c: export i2c_client_type structure
i2c bus has 2 different types of device belonging to the same bus and bus notifiers use device type to distinguish between adapters and clients. Previously we only had i2c_adapter_type exported, which made code wanting to work with i2c_client devices test for type not equal to adapter type. This unfortunately is not safe if we ever add another type to the bus, so let's export i2c_client_type as well. Reviewed-by: Jean Delvare <[email protected]> Acked-by: Benjamin Tissoires <[email protected]> Reviewed-by: Wolfram Sang <[email protected]> Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 97da385 commit 00a06c2

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

drivers/i2c/i2c-core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@
7474
static DEFINE_MUTEX(core_lock);
7575
static DEFINE_IDR(i2c_adapter_idr);
7676

77-
static struct device_type i2c_client_type;
7877
static int i2c_detect(struct i2c_adapter *adapter, struct i2c_driver *driver);
7978

8079
static struct static_key i2c_trace_msg = STATIC_KEY_INIT_FALSE;
@@ -1097,11 +1096,12 @@ struct bus_type i2c_bus_type = {
10971096
};
10981097
EXPORT_SYMBOL_GPL(i2c_bus_type);
10991098

1100-
static struct device_type i2c_client_type = {
1099+
struct device_type i2c_client_type = {
11011100
.groups = i2c_dev_groups,
11021101
.uevent = i2c_device_uevent,
11031102
.release = i2c_client_dev_release,
11041103
};
1104+
EXPORT_SYMBOL_GPL(i2c_client_type);
11051105

11061106

11071107
/**

include/linux/i2c.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838

3939
extern struct bus_type i2c_bus_type;
4040
extern struct device_type i2c_adapter_type;
41+
extern struct device_type i2c_client_type;
4142

4243
/* --- General options ------------------------------------------------ */
4344

0 commit comments

Comments
 (0)