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>
This commit is contained in:
committed by
Jean Delvare
parent
af294867a5
commit
eb8a790809
@@ -74,10 +74,7 @@ static int i2c_device_match(struct device *dev, struct device_driver *drv)
|
|||||||
if (driver->id_table)
|
if (driver->id_table)
|
||||||
return i2c_match_id(driver->id_table, client) != NULL;
|
return i2c_match_id(driver->id_table, client) != NULL;
|
||||||
|
|
||||||
/* new style drivers use the same kind of driver matching policy
|
return 0;
|
||||||
* as platform devices or SPI: compare device and driver IDs.
|
|
||||||
*/
|
|
||||||
return strcmp(client->driver_name, drv->name) == 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_HOTPLUG
|
#ifdef CONFIG_HOTPLUG
|
||||||
@@ -91,14 +88,9 @@ static int i2c_device_uevent(struct device *dev, struct kobj_uevent_env *env)
|
|||||||
if (dev->driver)
|
if (dev->driver)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (client->driver_name[0]) {
|
if (add_uevent_var(env, "MODALIAS=%s%s",
|
||||||
if (add_uevent_var(env, "MODALIAS=%s", client->driver_name))
|
I2C_MODULE_PREFIX, client->name))
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
} else {
|
|
||||||
if (add_uevent_var(env, "MODALIAS=%s%s",
|
|
||||||
I2C_MODULE_PREFIX, client->name))
|
|
||||||
return -ENOMEM;
|
|
||||||
}
|
|
||||||
dev_dbg(dev, "uevent\n");
|
dev_dbg(dev, "uevent\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -206,9 +198,7 @@ static ssize_t show_client_name(struct device *dev, struct device_attribute *att
|
|||||||
static ssize_t show_modalias(struct device *dev, struct device_attribute *attr, char *buf)
|
static ssize_t show_modalias(struct device *dev, struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct i2c_client *client = to_i2c_client(dev);
|
struct i2c_client *client = to_i2c_client(dev);
|
||||||
return client->driver_name[0]
|
return sprintf(buf, "%s%s\n", I2C_MODULE_PREFIX, client->name);
|
||||||
? sprintf(buf, "%s\n", client->driver_name)
|
|
||||||
: sprintf(buf, "%s%s\n", I2C_MODULE_PREFIX, client->name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct device_attribute i2c_dev_attrs[] = {
|
static struct device_attribute i2c_dev_attrs[] = {
|
||||||
@@ -282,8 +272,6 @@ i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info)
|
|||||||
client->addr = info->addr;
|
client->addr = info->addr;
|
||||||
client->irq = info->irq;
|
client->irq = info->irq;
|
||||||
|
|
||||||
strlcpy(client->driver_name, info->driver_name,
|
|
||||||
sizeof(client->driver_name));
|
|
||||||
strlcpy(client->name, info->type, sizeof(client->name));
|
strlcpy(client->name, info->type, sizeof(client->name));
|
||||||
|
|
||||||
/* a new style driver may be bound to this device when we
|
/* a new style driver may be bound to this device when we
|
||||||
|
@@ -155,8 +155,6 @@ struct i2c_driver {
|
|||||||
* @driver: device's driver, hence pointer to access routines
|
* @driver: device's driver, hence pointer to access routines
|
||||||
* @dev: Driver model device node for the slave.
|
* @dev: Driver model device node for the slave.
|
||||||
* @irq: indicates the IRQ generated by this device (if any)
|
* @irq: indicates the IRQ generated by this device (if any)
|
||||||
* @driver_name: Identifies new-style driver used with this device; also
|
|
||||||
* used as the module name for hotplug/coldplug modprobe support.
|
|
||||||
* @list: list of active/busy clients (DEPRECATED)
|
* @list: list of active/busy clients (DEPRECATED)
|
||||||
* @released: used to synchronize client releases & detaches and references
|
* @released: used to synchronize client releases & detaches and references
|
||||||
*
|
*
|
||||||
@@ -174,7 +172,6 @@ struct i2c_client {
|
|||||||
struct i2c_driver *driver; /* and our access routines */
|
struct i2c_driver *driver; /* and our access routines */
|
||||||
struct device dev; /* the device structure */
|
struct device dev; /* the device structure */
|
||||||
int irq; /* irq issued by device (or -1) */
|
int irq; /* irq issued by device (or -1) */
|
||||||
char driver_name[KOBJ_NAME_LEN];
|
|
||||||
struct list_head list; /* DEPRECATED */
|
struct list_head list; /* DEPRECATED */
|
||||||
struct completion released;
|
struct completion released;
|
||||||
};
|
};
|
||||||
@@ -200,8 +197,7 @@ static inline void i2c_set_clientdata (struct i2c_client *dev, void *data)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* struct i2c_board_info - template for device creation
|
* struct i2c_board_info - template for device creation
|
||||||
* @driver_name: identifies the driver to be bound to the device
|
* @type: chip type, to initialize i2c_client.name
|
||||||
* @type: optional chip type information, to initialize i2c_client.name
|
|
||||||
* @flags: to initialize i2c_client.flags
|
* @flags: to initialize i2c_client.flags
|
||||||
* @addr: stored in i2c_client.addr
|
* @addr: stored in i2c_client.addr
|
||||||
* @platform_data: stored in i2c_client.dev.platform_data
|
* @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)
|
|||||||
* with the adapter already known.
|
* with the adapter already known.
|
||||||
*/
|
*/
|
||||||
struct i2c_board_info {
|
struct i2c_board_info {
|
||||||
char driver_name[KOBJ_NAME_LEN];
|
|
||||||
char type[I2C_NAME_SIZE];
|
char type[I2C_NAME_SIZE];
|
||||||
unsigned short flags;
|
unsigned short flags;
|
||||||
unsigned short addr;
|
unsigned short addr;
|
||||||
|
@@ -12,8 +12,7 @@
|
|||||||
* @context: optional parameter passed to setup() and teardown()
|
* @context: optional parameter passed to setup() and teardown()
|
||||||
*
|
*
|
||||||
* In addition to the I2C_BOARD_INFO() state appropriate to each chip,
|
* In addition to the I2C_BOARD_INFO() state appropriate to each chip,
|
||||||
* the i2c_board_info used with the pcf875x driver must provide the
|
* the i2c_board_info used with the pcf875x driver must provide its
|
||||||
* chip "type" ("pcf8574", "pcf8574a", "pcf8575", "pcf8575c") and its
|
|
||||||
* platform_data (pointer to one of these structures) with at least
|
* platform_data (pointer to one of these structures) with at least
|
||||||
* the gpio_base value initialized.
|
* the gpio_base value initialized.
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user