aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/f75375s.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/f75375s.c')
-rw-r--r--drivers/hwmon/f75375s.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/drivers/hwmon/f75375s.c b/drivers/hwmon/f75375s.c
index 1464338e4e11..dc1f30e432ea 100644
--- a/drivers/hwmon/f75375s.c
+++ b/drivers/hwmon/f75375s.c
@@ -117,7 +117,8 @@ struct f75375_data {
117static int f75375_attach_adapter(struct i2c_adapter *adapter); 117static int f75375_attach_adapter(struct i2c_adapter *adapter);
118static int f75375_detect(struct i2c_adapter *adapter, int address, int kind); 118static int f75375_detect(struct i2c_adapter *adapter, int address, int kind);
119static int f75375_detach_client(struct i2c_client *client); 119static int f75375_detach_client(struct i2c_client *client);
120static int f75375_probe(struct i2c_client *client); 120static int f75375_probe(struct i2c_client *client,
121 const struct i2c_device_id *id);
121static int f75375_remove(struct i2c_client *client); 122static int f75375_remove(struct i2c_client *client);
122 123
123static struct i2c_driver f75375_legacy_driver = { 124static struct i2c_driver f75375_legacy_driver = {
@@ -128,12 +129,20 @@ static struct i2c_driver f75375_legacy_driver = {
128 .detach_client = f75375_detach_client, 129 .detach_client = f75375_detach_client,
129}; 130};
130 131
132static const struct i2c_device_id f75375_id[] = {
133 { "f75373", f75373 },
134 { "f75375", f75375 },
135 { }
136};
137MODULE_DEVICE_TABLE(i2c, f75375_id);
138
131static struct i2c_driver f75375_driver = { 139static struct i2c_driver f75375_driver = {
132 .driver = { 140 .driver = {
133 .name = "f75375", 141 .name = "f75375",
134 }, 142 },
135 .probe = f75375_probe, 143 .probe = f75375_probe,
136 .remove = f75375_remove, 144 .remove = f75375_remove,
145 .id_table = f75375_id,
137}; 146};
138 147
139static inline int f75375_read8(struct i2c_client *client, u8 reg) 148static inline int f75375_read8(struct i2c_client *client, u8 reg)
@@ -628,7 +637,8 @@ static void f75375_init(struct i2c_client *client, struct f75375_data *data,
628 637
629} 638}
630 639
631static int f75375_probe(struct i2c_client *client) 640static int f75375_probe(struct i2c_client *client,
641 const struct i2c_device_id *id)
632{ 642{
633 struct f75375_data *data = i2c_get_clientdata(client); 643 struct f75375_data *data = i2c_get_clientdata(client);
634 struct f75375s_platform_data *f75375s_pdata = client->dev.platform_data; 644 struct f75375s_platform_data *f75375s_pdata = client->dev.platform_data;
@@ -643,15 +653,7 @@ static int f75375_probe(struct i2c_client *client)
643 i2c_set_clientdata(client, data); 653 i2c_set_clientdata(client, data);
644 data->client = client; 654 data->client = client;
645 mutex_init(&data->update_lock); 655 mutex_init(&data->update_lock);
646 656 data->kind = id->driver_data;
647 if (strcmp(client->name, "f75375") == 0)
648 data->kind = f75375;
649 else if (strcmp(client->name, "f75373") == 0)
650 data->kind = f75373;
651 else {
652 dev_err(&client->dev, "Unsupported device: %s\n", client->name);
653 return -ENODEV;
654 }
655 657
656 if ((err = sysfs_create_group(&client->dev.kobj, &f75375_group))) 658 if ((err = sysfs_create_group(&client->dev.kobj, &f75375_group)))
657 goto exit_free; 659 goto exit_free;
@@ -712,6 +714,7 @@ static int f75375_detect(struct i2c_adapter *adapter, int address, int kind)
712 u8 version = 0; 714 u8 version = 0;
713 int err = 0; 715 int err = 0;
714 const char *name = ""; 716 const char *name = "";
717 struct i2c_device_id id;
715 718
716 if (!(client = kzalloc(sizeof(*client), GFP_KERNEL))) { 719 if (!(client = kzalloc(sizeof(*client), GFP_KERNEL))) {
717 err = -ENOMEM; 720 err = -ENOMEM;
@@ -748,7 +751,9 @@ static int f75375_detect(struct i2c_adapter *adapter, int address, int kind)
748 if ((err = i2c_attach_client(client))) 751 if ((err = i2c_attach_client(client)))
749 goto exit_free; 752 goto exit_free;
750 753
751 if ((err = f75375_probe(client)) < 0) 754 strlcpy(id.name, name, I2C_NAME_SIZE);
755 id.driver_data = kind;
756 if ((err = f75375_probe(client, &id)) < 0)
752 goto exit_detach; 757 goto exit_detach;
753 758
754 return 0; 759 return 0;