Commit ae429083 authored by Jean Delvare's avatar Jean Delvare Committed by Jean Delvare

i2c: Convert some more new-style drivers to use module aliasing

Update 3 more new-style i2c drivers to use standard module aliasing
instead of the old driver_name/type driver matching scheme. These
video drivers aren't used yet so converting them is trivial.
Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
parent 60b129d7
...@@ -885,12 +885,19 @@ static int __exit tcm825x_remove(struct i2c_client *client) ...@@ -885,12 +885,19 @@ static int __exit tcm825x_remove(struct i2c_client *client)
return 0; return 0;
} }
static const struct i2c_device_id tcm825x_id[] = {
{ "tcm825x", 0 },
{ }
};
MODULE_DEVICE_TABLE(i2c, tcm825x_id);
static struct i2c_driver tcm825x_i2c_driver = { static struct i2c_driver tcm825x_i2c_driver = {
.driver = { .driver = {
.name = TCM825X_NAME, .name = TCM825X_NAME,
}, },
.probe = tcm825x_probe, .probe = tcm825x_probe,
.remove = __exit_p(tcm825x_remove), .remove = __exit_p(tcm825x_remove),
.id_table = tcm825x_id,
}; };
static struct tcm825x_sensor tcm825x = { static struct tcm825x_sensor tcm825x = {
......
...@@ -168,6 +168,11 @@ static int tlv320aic23b_remove(struct i2c_client *client) ...@@ -168,6 +168,11 @@ static int tlv320aic23b_remove(struct i2c_client *client)
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */
static const struct i2c_device_id tlv320aic23b_id[] = {
{ "tlv320aic23b", 0 },
{ }
};
MODULE_DEVICE_TABLE(i2c, tlv320aic23b_id);
static struct v4l2_i2c_driver_data v4l2_i2c_data = { static struct v4l2_i2c_driver_data v4l2_i2c_data = {
.name = "tlv320aic23b", .name = "tlv320aic23b",
...@@ -175,4 +180,5 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data = { ...@@ -175,4 +180,5 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data = {
.command = tlv320aic23b_command, .command = tlv320aic23b_command,
.probe = tlv320aic23b_probe, .probe = tlv320aic23b_probe,
.remove = tlv320aic23b_remove, .remove = tlv320aic23b_remove,
.id_table = tlv320aic23b_id,
}; };
...@@ -1505,7 +1505,8 @@ static int chip_probe(struct i2c_client *client, const struct i2c_device_id *id) ...@@ -1505,7 +1505,8 @@ static int chip_probe(struct i2c_client *client, const struct i2c_device_id *id)
} }
/* fill required data structures */ /* fill required data structures */
strcpy(client->name, desc->name); if (!id)
strlcpy(client->name, desc->name, I2C_NAME_SIZE);
chip->type = desc-chiplist; chip->type = desc-chiplist;
chip->shadow.count = desc->registers+1; chip->shadow.count = desc->registers+1;
chip->prevmode = -1; chip->prevmode = -1;
...@@ -1830,6 +1831,15 @@ static int chip_legacy_probe(struct i2c_adapter *adap) ...@@ -1830,6 +1831,15 @@ static int chip_legacy_probe(struct i2c_adapter *adap)
return 0; return 0;
} }
/* This driver supports many devices and the idea is to let the driver
detect which device is present. So rather than listing all supported
devices here, we pretend to support a single, fake device type. */
static const struct i2c_device_id chip_id[] = {
{ "tvaudio", 0 },
{ }
};
MODULE_DEVICE_TABLE(i2c, chip_id);
static struct v4l2_i2c_driver_data v4l2_i2c_data = { static struct v4l2_i2c_driver_data v4l2_i2c_data = {
.name = "tvaudio", .name = "tvaudio",
.driverid = I2C_DRIVERID_TVAUDIO, .driverid = I2C_DRIVERID_TVAUDIO,
...@@ -1837,6 +1847,7 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data = { ...@@ -1837,6 +1847,7 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data = {
.probe = chip_probe, .probe = chip_probe,
.remove = chip_remove, .remove = chip_remove,
.legacy_probe = chip_legacy_probe, .legacy_probe = chip_legacy_probe,
.id_table = chip_id,
}; };
/* /*
......
...@@ -31,6 +31,7 @@ struct v4l2_i2c_driver_data { ...@@ -31,6 +31,7 @@ struct v4l2_i2c_driver_data {
int (*resume)(struct i2c_client *client); int (*resume)(struct i2c_client *client);
int (*legacy_probe)(struct i2c_adapter *adapter); int (*legacy_probe)(struct i2c_adapter *adapter);
int legacy_class; int legacy_class;
const struct i2c_device_id *id_table;
}; };
static struct v4l2_i2c_driver_data v4l2_i2c_data; static struct v4l2_i2c_driver_data v4l2_i2c_data;
...@@ -124,6 +125,7 @@ static int __init v4l2_i2c_drv_init(void) ...@@ -124,6 +125,7 @@ static int __init v4l2_i2c_drv_init(void)
v4l2_i2c_driver.command = v4l2_i2c_data.command; v4l2_i2c_driver.command = v4l2_i2c_data.command;
v4l2_i2c_driver.probe = v4l2_i2c_data.probe; v4l2_i2c_driver.probe = v4l2_i2c_data.probe;
v4l2_i2c_driver.remove = v4l2_i2c_data.remove; v4l2_i2c_driver.remove = v4l2_i2c_data.remove;
v4l2_i2c_driver.id_table = v4l2_i2c_data.id_table;
err = i2c_add_driver(&v4l2_i2c_driver); err = i2c_add_driver(&v4l2_i2c_driver);
if (err) if (err)
i2c_del_driver(&v4l2_i2c_driver_legacy); i2c_del_driver(&v4l2_i2c_driver_legacy);
......
...@@ -36,6 +36,7 @@ struct v4l2_i2c_driver_data { ...@@ -36,6 +36,7 @@ struct v4l2_i2c_driver_data {
int (*resume)(struct i2c_client *client); int (*resume)(struct i2c_client *client);
int (*legacy_probe)(struct i2c_adapter *adapter); int (*legacy_probe)(struct i2c_adapter *adapter);
int legacy_class; int legacy_class;
const struct i2c_device_id *id_table;
}; };
static struct v4l2_i2c_driver_data v4l2_i2c_data; static struct v4l2_i2c_driver_data v4l2_i2c_data;
...@@ -53,6 +54,7 @@ static int __init v4l2_i2c_drv_init(void) ...@@ -53,6 +54,7 @@ static int __init v4l2_i2c_drv_init(void)
v4l2_i2c_driver.remove = v4l2_i2c_data.remove; v4l2_i2c_driver.remove = v4l2_i2c_data.remove;
v4l2_i2c_driver.suspend = v4l2_i2c_data.suspend; v4l2_i2c_driver.suspend = v4l2_i2c_data.suspend;
v4l2_i2c_driver.resume = v4l2_i2c_data.resume; v4l2_i2c_driver.resume = v4l2_i2c_data.resume;
v4l2_i2c_driver.id_table = v4l2_i2c_data.id_table;
return i2c_add_driver(&v4l2_i2c_driver); return i2c_add_driver(&v4l2_i2c_driver);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment