diff options
Diffstat (limited to 'drivers/hwmon')
| -rw-r--r-- | drivers/hwmon/f75375s.c | 29 |
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 { | |||
| 117 | static int f75375_attach_adapter(struct i2c_adapter *adapter); | 117 | static int f75375_attach_adapter(struct i2c_adapter *adapter); |
| 118 | static int f75375_detect(struct i2c_adapter *adapter, int address, int kind); | 118 | static int f75375_detect(struct i2c_adapter *adapter, int address, int kind); |
| 119 | static int f75375_detach_client(struct i2c_client *client); | 119 | static int f75375_detach_client(struct i2c_client *client); |
| 120 | static int f75375_probe(struct i2c_client *client); | 120 | static int f75375_probe(struct i2c_client *client, |
| 121 | const struct i2c_device_id *id); | ||
| 121 | static int f75375_remove(struct i2c_client *client); | 122 | static int f75375_remove(struct i2c_client *client); |
| 122 | 123 | ||
| 123 | static struct i2c_driver f75375_legacy_driver = { | 124 | static 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 | ||
| 132 | static const struct i2c_device_id f75375_id[] = { | ||
| 133 | { "f75373", f75373 }, | ||
| 134 | { "f75375", f75375 }, | ||
| 135 | { } | ||
| 136 | }; | ||
| 137 | MODULE_DEVICE_TABLE(i2c, f75375_id); | ||
| 138 | |||
| 131 | static struct i2c_driver f75375_driver = { | 139 | static 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 | ||
| 139 | static inline int f75375_read8(struct i2c_client *client, u8 reg) | 148 | static 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 | ||
| 631 | static int f75375_probe(struct i2c_client *client) | 640 | static 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; |
