i2c: Convert most new-style drivers to use module aliasing

Based on earlier work by Jon Smirl and Jochen Friedrich.

Update most new-style i2c drivers to use standard module aliasing
instead of the old driver_name/type driver matching scheme. I've
left the video drivers apart (except for SoC camera drivers) as
they're a bit more diffcult to deal with, they'll have their own
patch later.

Signed-off-by: Jean Delvare <[email protected]>
Cc: Jon Smirl <[email protected]>
Cc: Jochen Friedrich <[email protected]>
This commit is contained in:
Jean Delvare 2008-04-29 23:11:40 +02:00 • committed by Jean Delvare
commit 3760f73671
43 changed files with 211 additions and 247 deletions

View file

@ -51,7 +51,6 @@ struct taos_data {
/* TAOS TSL2550 EVM */
static struct i2c_board_info tsl2550_info = {
I2C_BOARD_INFO("tsl2550", 0x39),
.type = "tsl2550",
};
/* Instantiate i2c devices based on the adapter name */
@ -59,7 +58,7 @@ static struct i2c_client *taos_instantiate_device(struct i2c_adapter *adapter)
{
if (!strncmp(adapter->name, "TAOS TSL2550 EVM", 16)) {
dev_info(&adapter->dev, "Instantiating device %s at 0x%02x\n",
tsl2550_info.driver_name, tsl2550_info.addr);
tsl2550_info.type, tsl2550_info.addr);
return i2c_new_device(adapter, &tsl2550_info);
}

View file

@ -235,12 +235,19 @@ static int ds1682_remove(struct i2c_client *client)
return 0;
}
static const struct i2c_device_id ds1682_id[] = {
{ "ds1682", 0 },
{ }
};
MODULE_DEVICE_TABLE(i2c, ds1682_id);
static struct i2c_driver ds1682_driver = {
.driver = {
.name = "ds1682",
},
.probe = ds1682_probe,
.remove = ds1682_remove,
.id_table = ds1682_id,
};
static int __init ds1682_init(void)

View file

@ -1243,12 +1243,19 @@ static int __exit menelaus_remove(struct i2c_client *client)
return 0;
}
static const struct i2c_device_id menelaus_id[] = {
{ "menelaus", 0 },
{ }
};
MODULE_DEVICE_TABLE(i2c, menelaus_id);
static struct i2c_driver menelaus_i2c_driver = {
.driver = {
.name = DRIVER_NAME,
},
.probe = menelaus_probe,
.remove = __exit_p(menelaus_remove),
.id_table = menelaus_id,
};
static int __init menelaus_init(void)

View file

@ -64,7 +64,6 @@ static struct i2c_driver tps65010_driver;
* as part of board setup by a bootloader.
*/
enum tps_model {
TPS_UNKNOWN = 0,
TPS65010,
TPS65011,
TPS65012,
@ -554,20 +553,7 @@ static int tps65010_probe(struct i2c_client *client,
mutex_init(&tps->lock);
INIT_DELAYED_WORK(&tps->work, tps65010_work);
tps->client = client;
if (strcmp(client->name, "tps65010") == 0)
tps->model = TPS65010;
else if (strcmp(client->name, "tps65011") == 0)
tps->model = TPS65011;
else if (strcmp(client->name, "tps65012") == 0)
tps->model = TPS65012;
else if (strcmp(client->name, "tps65013") == 0)
tps->model = TPS65013;
else {
dev_warn(&client->dev, "unknown chip '%s'\n", client->name);
status = -ENODEV;
goto fail1;
}
tps->model = id->driver_data;
/* the IRQ is active low, but many gpio lines can't support that
* so this driver uses falling-edge triggers instead.
@ -596,9 +582,6 @@ static int tps65010_probe(struct i2c_client *client,
case TPS65012:
tps->por = 1;
break;
case TPS_UNKNOWN:
printk(KERN_WARNING "%s: unknown TPS chip\n", DRIVER_NAME);
break;
/* else CHGCONFIG.POR is replaced by AUA, enabling a WAIT mode */
}
tps->chgconf = i2c_smbus_read_byte_data(client, TPS_CHGCONFIG);
@ -685,12 +668,22 @@ fail1:
return status;
}
static const struct i2c_device_id tps65010_id[] = {
{ "tps65010", TPS65010 },
{ "tps65011", TPS65011 },
{ "tps65012", TPS65012 },
{ "tps65013", TPS65013 },
{ }
};
MODULE_DEVICE_TABLE(i2c, tps65010_id);
static struct i2c_driver tps65010_driver = {
.driver = {
.name = "tps65010",
},
.probe = tps65010_probe,
.remove = __exit_p(tps65010_remove),
.id_table = tps65010_id,
};
/*-------------------------------------------------------------------------*/

View file

@ -452,6 +452,12 @@ static int tsl2550_resume(struct i2c_client *client)
#endif /* CONFIG_PM */
static const struct i2c_device_id tsl2550_id[] = {
{ "tsl2550", 0 },
{ }
};
MODULE_DEVICE_TABLE(i2c, tsl2550_id);
static struct i2c_driver tsl2550_driver = {
.driver = {
.name = TSL2550_DRV_NAME,
@ -461,6 +467,7 @@ static struct i2c_driver tsl2550_driver = {
.resume = tsl2550_resume,
.probe = tsl2550_probe,
.remove = __devexit_p(tsl2550_remove),
.id_table = tsl2550_id,
};
static int __init tsl2550_init(void)