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.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/drivers/hwmon/f75375s.c b/drivers/hwmon/f75375s.c
index 1f63bab05522..dc1f30e432ea 100644
--- a/drivers/hwmon/f75375s.c
+++ b/drivers/hwmon/f75375s.c
@@ -129,12 +129,20 @@ static struct i2c_driver f75375_legacy_driver = {
129 .detach_client = f75375_detach_client, 129 .detach_client = f75375_detach_client,
130}; 130};
131 131
132static const struct i2c_device_id f75375_id[] = {
133 { "f75373", f75373 },
134 { "f75375", f75375 },
135 { }
136};
137MODULE_DEVICE_TABLE(i2c, f75375_id);
138
132static struct i2c_driver f75375_driver = { 139static struct i2c_driver f75375_driver = {
133 .driver = { 140 .driver = {
134 .name = "f75375", 141 .name = "f75375",
135 }, 142 },
136 .probe = f75375_probe, 143 .probe = f75375_probe,
137 .remove = f75375_remove, 144 .remove = f75375_remove,
145 .id_table = f75375_id,
138}; 146};
139 147
140static inline int f75375_read8(struct i2c_client *client, u8 reg) 148static inline int f75375_read8(struct i2c_client *client, u8 reg)
@@ -645,15 +653,7 @@ static int f75375_probe(struct i2c_client *client,
645 i2c_set_clientdata(client, data); 653 i2c_set_clientdata(client, data);
646 data->client = client; 654 data->client = client;
647 mutex_init(&data->update_lock); 655 mutex_init(&data->update_lock);
648 656 data->kind = id->driver_data;
649 if (strcmp(client->name, "f75375") == 0)
650 data->kind = f75375;
651 else if (strcmp(client->name, "f75373") == 0)
652 data->kind = f75373;
653 else {
654 dev_err(&client->dev, "Unsupported device: %s\n", client->name);
655 return -ENODEV;
656 }
657 657
658 if ((err = sysfs_create_group(&client->dev.kobj, &f75375_group))) 658 if ((err = sysfs_create_group(&client->dev.kobj, &f75375_group)))
659 goto exit_free; 659 goto exit_free;
@@ -714,6 +714,7 @@ static int f75375_detect(struct i2c_adapter *adapter, int address, int kind)
714 u8 version = 0; 714 u8 version = 0;
715 int err = 0; 715 int err = 0;
716 const char *name = ""; 716 const char *name = "";
717 struct i2c_device_id id;
717 718
718 if (!(client = kzalloc(sizeof(*client), GFP_KERNEL))) { 719 if (!(client = kzalloc(sizeof(*client), GFP_KERNEL))) {
719 err = -ENOMEM; 720 err = -ENOMEM;
@@ -750,7 +751,9 @@ static int f75375_detect(struct i2c_adapter *adapter, int address, int kind)
750 if ((err = i2c_attach_client(client))) 751 if ((err = i2c_attach_client(client)))
751 goto exit_free; 752 goto exit_free;
752 753
753 if ((err = f75375_probe(client, NULL)) < 0) 754 strlcpy(id.name, name, I2C_NAME_SIZE);
755 id.driver_data = kind;
756 if ((err = f75375_probe(client, &id)) < 0)
754 goto exit_detach; 757 goto exit_detach;
755 758
756 return 0; 759 return 0;