Skip to content

Commit eb8a790

Browse files
Jean DelvareJean Delvare
authored andcommitted
i2c: Kill the old driver matching scheme
Remove the old driver_name/type scheme for i2c driver matching. Only the standard aliasing model will be used from now on. Signed-off-by: Jean Delvare <khali@linux-fr.org>
1 parent af29486 commit eb8a790

3 files changed

Lines changed: 7 additions & 25 deletions

File tree

‎drivers/i2c/i2c-core.c‎

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,7 @@ static int i2c_device_match(struct device *dev, struct device_driver *drv)
7474
if (driver->id_table)
7575
return i2c_match_id(driver->id_table, client) != NULL;
7676

77-
/* new style drivers use the same kind of driver matching policy
78-
* as platform devices or SPI: compare device and driver IDs.
79-
*/
80-
return strcmp(client->driver_name, drv->name) == 0;
77+
return 0;
8178
}
8279

8380
#ifdef CONFIG_HOTPLUG
@@ -91,14 +88,9 @@ static int i2c_device_uevent(struct device *dev, struct kobj_uevent_env *env)
9188
if (dev->driver)
9289
return 0;
9390

94-
if (client->driver_name[0]) {
95-
if (add_uevent_var(env, "MODALIAS=%s", client->driver_name))
96-
return -ENOMEM;
97-
} else {
98-
if (add_uevent_var(env, "MODALIAS=%s%s",
99-
I2C_MODULE_PREFIX, client->name))
100-
return -ENOMEM;
101-
}
91+
if (add_uevent_var(env, "MODALIAS=%s%s",
92+
I2C_MODULE_PREFIX, client->name))
93+
return -ENOMEM;
10294
dev_dbg(dev, "uevent\n");
10395
return 0;
10496
}
@@ -206,9 +198,7 @@ static ssize_t show_client_name(struct device *dev, struct device_attribute *att
206198
static ssize_t show_modalias(struct device *dev, struct device_attribute *attr, char *buf)
207199
{
208200
struct i2c_client *client = to_i2c_client(dev);
209-
return client->driver_name[0]
210-
? sprintf(buf, "%s\n", client->driver_name)
211-
: sprintf(buf, "%s%s\n", I2C_MODULE_PREFIX, client->name);
201+
return sprintf(buf, "%s%s\n", I2C_MODULE_PREFIX, client->name);
212202
}
213203

214204
static struct device_attribute i2c_dev_attrs[] = {
@@ -282,8 +272,6 @@ i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info)
282272
client->addr = info->addr;
283273
client->irq = info->irq;
284274

285-
strlcpy(client->driver_name, info->driver_name,
286-
sizeof(client->driver_name));
287275
strlcpy(client->name, info->type, sizeof(client->name));
288276

289277
/* a new style driver may be bound to this device when we

‎include/linux/i2c.h‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,6 @@ struct i2c_driver {
155155
* @driver: device's driver, hence pointer to access routines
156156
* @dev: Driver model device node for the slave.
157157
* @irq: indicates the IRQ generated by this device (if any)
158-
* @driver_name: Identifies new-style driver used with this device; also
159-
* used as the module name for hotplug/coldplug modprobe support.
160158
* @list: list of active/busy clients (DEPRECATED)
161159
* @released: used to synchronize client releases & detaches and references
162160
*
@@ -174,7 +172,6 @@ struct i2c_client {
174172
struct i2c_driver *driver; /* and our access routines */
175173
struct device dev; /* the device structure */
176174
int irq; /* irq issued by device (or -1) */
177-
char driver_name[KOBJ_NAME_LEN];
178175
struct list_head list; /* DEPRECATED */
179176
struct completion released;
180177
};
@@ -200,8 +197,7 @@ static inline void i2c_set_clientdata (struct i2c_client *dev, void *data)
200197

201198
/**
202199
* struct i2c_board_info - template for device creation
203-
* @driver_name: identifies the driver to be bound to the device
204-
* @type: optional chip type information, to initialize i2c_client.name
200+
* @type: chip type, to initialize i2c_client.name
205201
* @flags: to initialize i2c_client.flags
206202
* @addr: stored in i2c_client.addr
207203
* @platform_data: stored in i2c_client.dev.platform_data
@@ -220,7 +216,6 @@ static inline void i2c_set_clientdata (struct i2c_client *dev, void *data)
220216
* with the adapter already known.
221217
*/
222218
struct i2c_board_info {
223-
char driver_name[KOBJ_NAME_LEN];
224219
char type[I2C_NAME_SIZE];
225220
unsigned short flags;
226221
unsigned short addr;

‎include/linux/i2c/pcf857x.h‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
* @context: optional parameter passed to setup() and teardown()
1313
*
1414
* In addition to the I2C_BOARD_INFO() state appropriate to each chip,
15-
* the i2c_board_info used with the pcf875x driver must provide the
16-
* chip "type" ("pcf8574", "pcf8574a", "pcf8575", "pcf8575c") and its
15+
* the i2c_board_info used with the pcf875x driver must provide its
1716
* platform_data (pointer to one of these structures) with at least
1817
* the gpio_base value initialized.
1918
*

0 commit comments

Comments
 (0)