Commit dd431939 authored by Stephen Kitt's avatar Stephen Kitt Committed by Guenter Roeck

hwmon (pmbus) use simple i2c probe function

pmbus_do_probe doesn't use the id information provided in its second
argument, so this can be removed, which then allows using the
single-parameter i2c probe function ("probe_new") for probes.

This avoids scanning the identifier tables during probes.

Drivers which didn't use the id are converted as-is; drivers which did
are modified as follows:

* if the information in i2c_client is sufficient, that's used instead
  (client->name);
* configured v. probed comparisons are performed by comparing the
  configured name to the detected name, instead of the ids; this
  involves strcmp but is still cheaper than comparing all the device
  names when scanning the tables;
* anything else is handled by calling i2c_match_id() with the same
  level of error-handling (if any) as before.

Additionally, the mismatch message in the ltc2978 driver is adjusted
so that it no longer assumes that the driver_data is an index into
ltc2978_id.
Signed-off-by: default avatarStephen Kitt <steve@sk2.org>
Acked-by: default avatarWolfram Sang <wsa@kernel.org>
Link: https://lore.kernel.org/r/20200808210004.30880-1-steve@sk2.orgSigned-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent e4035839
...@@ -270,8 +270,7 @@ obtain the chip status. Therefore, it must _not_ be called from that function. ...@@ -270,8 +270,7 @@ obtain the chip status. Therefore, it must _not_ be called from that function.
:: ::
int pmbus_do_probe(struct i2c_client *client, const struct i2c_device_id *id, int pmbus_do_probe(struct i2c_client *client, struct pmbus_driver_info *info);
struct pmbus_driver_info *info);
Execute probe function. Similar to standard probe function for other drivers, Execute probe function. Similar to standard probe function for other drivers,
with the pointer to struct pmbus_driver_info as additional argument. Calls with the pointer to struct pmbus_driver_info as additional argument. Calls
......
...@@ -143,10 +143,9 @@ Emerson DS1200 power modules might look as follows:: ...@@ -143,10 +143,9 @@ Emerson DS1200 power modules might look as follows::
| PMBUS_HAVE_FAN12 | PMBUS_HAVE_STATUS_FAN12, | PMBUS_HAVE_FAN12 | PMBUS_HAVE_STATUS_FAN12,
}; };
static int ds1200_probe(struct i2c_client *client, static int ds1200_probe(struct i2c_client *client)
const struct i2c_device_id *id)
{ {
return pmbus_do_probe(client, id, &ds1200_info); return pmbus_do_probe(client, &ds1200_info);
} }
static int ds1200_remove(struct i2c_client *client) static int ds1200_remove(struct i2c_client *client)
...@@ -166,7 +165,7 @@ Emerson DS1200 power modules might look as follows:: ...@@ -166,7 +165,7 @@ Emerson DS1200 power modules might look as follows::
.driver = { .driver = {
.name = "ds1200", .name = "ds1200",
}, },
.probe = ds1200_probe, .probe_new = ds1200_probe,
.remove = ds1200_remove, .remove = ds1200_remove,
.id_table = ds1200_id, .id_table = ds1200_id,
}; };
......
...@@ -462,8 +462,7 @@ static const struct i2c_device_id adm1275_id[] = { ...@@ -462,8 +462,7 @@ static const struct i2c_device_id adm1275_id[] = {
}; };
MODULE_DEVICE_TABLE(i2c, adm1275_id); MODULE_DEVICE_TABLE(i2c, adm1275_id);
static int adm1275_probe(struct i2c_client *client, static int adm1275_probe(struct i2c_client *client)
const struct i2c_device_id *id)
{ {
s32 (*config_read_fn)(const struct i2c_client *client, u8 reg); s32 (*config_read_fn)(const struct i2c_client *client, u8 reg);
u8 block_buffer[I2C_SMBUS_BLOCK_MAX + 1]; u8 block_buffer[I2C_SMBUS_BLOCK_MAX + 1];
...@@ -506,10 +505,10 @@ static int adm1275_probe(struct i2c_client *client, ...@@ -506,10 +505,10 @@ static int adm1275_probe(struct i2c_client *client,
return -ENODEV; return -ENODEV;
} }
if (id->driver_data != mid->driver_data) if (strcmp(client->name, mid->name) != 0)
dev_notice(&client->dev, dev_notice(&client->dev,
"Device mismatch: Configured %s, detected %s\n", "Device mismatch: Configured %s, detected %s\n",
id->name, mid->name); client->name, mid->name);
if (mid->driver_data == adm1272 || mid->driver_data == adm1278 || if (mid->driver_data == adm1272 || mid->driver_data == adm1278 ||
mid->driver_data == adm1293 || mid->driver_data == adm1294) mid->driver_data == adm1293 || mid->driver_data == adm1294)
...@@ -790,14 +789,14 @@ static int adm1275_probe(struct i2c_client *client, ...@@ -790,14 +789,14 @@ static int adm1275_probe(struct i2c_client *client,
info->R[PSC_TEMPERATURE] = coefficients[tindex].R; info->R[PSC_TEMPERATURE] = coefficients[tindex].R;
} }
return pmbus_do_probe(client, id, info); return pmbus_do_probe(client, info);
} }
static struct i2c_driver adm1275_driver = { static struct i2c_driver adm1275_driver = {
.driver = { .driver = {
.name = "adm1275", .name = "adm1275",
}, },
.probe = adm1275_probe, .probe_new = adm1275_probe,
.remove = pmbus_do_remove, .remove = pmbus_do_remove,
.id_table = adm1275_id, .id_table = adm1275_id,
}; };
......
...@@ -87,12 +87,13 @@ static struct pmbus_driver_info pfe_driver_info[] = { ...@@ -87,12 +87,13 @@ static struct pmbus_driver_info pfe_driver_info[] = {
}, },
}; };
static int pfe_pmbus_probe(struct i2c_client *client, static const struct i2c_device_id pfe_device_id[];
const struct i2c_device_id *id)
static int pfe_pmbus_probe(struct i2c_client *client)
{ {
int model; int model;
model = (int)id->driver_data; model = (int)i2c_match_id(pfe_device_id, client)->driver_data;
/* /*
* PFE3000-12-069RA devices may not stay in page 0 during device * PFE3000-12-069RA devices may not stay in page 0 during device
...@@ -104,7 +105,7 @@ static int pfe_pmbus_probe(struct i2c_client *client, ...@@ -104,7 +105,7 @@ static int pfe_pmbus_probe(struct i2c_client *client,
i2c_smbus_write_byte_data(client, PMBUS_PAGE, 0); i2c_smbus_write_byte_data(client, PMBUS_PAGE, 0);
} }
return pmbus_do_probe(client, id, &pfe_driver_info[model]); return pmbus_do_probe(client, &pfe_driver_info[model]);
} }
static const struct i2c_device_id pfe_device_id[] = { static const struct i2c_device_id pfe_device_id[] = {
...@@ -119,7 +120,7 @@ static struct i2c_driver pfe_pmbus_driver = { ...@@ -119,7 +120,7 @@ static struct i2c_driver pfe_pmbus_driver = {
.driver = { .driver = {
.name = "bel-pfe", .name = "bel-pfe",
}, },
.probe = pfe_pmbus_probe, .probe_new = pfe_pmbus_probe,
.remove = pmbus_do_remove, .remove = pmbus_do_remove,
.id_table = pfe_device_id, .id_table = pfe_device_id,
}; };
......
...@@ -91,6 +91,8 @@ struct ibm_cffps { ...@@ -91,6 +91,8 @@ struct ibm_cffps {
struct led_classdev led; struct led_classdev led;
}; };
static const struct i2c_device_id ibm_cffps_id[];
#define to_psu(x, y) container_of((x), struct ibm_cffps, debugfs_entries[(y)]) #define to_psu(x, y) container_of((x), struct ibm_cffps, debugfs_entries[(y)])
static ssize_t ibm_cffps_read_input_history(struct ibm_cffps *psu, static ssize_t ibm_cffps_read_input_history(struct ibm_cffps *psu,
...@@ -473,8 +475,7 @@ static struct pmbus_platform_data ibm_cffps_pdata = { ...@@ -473,8 +475,7 @@ static struct pmbus_platform_data ibm_cffps_pdata = {
.flags = PMBUS_SKIP_STATUS_CHECK, .flags = PMBUS_SKIP_STATUS_CHECK,
}; };
static int ibm_cffps_probe(struct i2c_client *client, static int ibm_cffps_probe(struct i2c_client *client)
const struct i2c_device_id *id)
{ {
int i, rc; int i, rc;
enum versions vs = cffps_unknown; enum versions vs = cffps_unknown;
...@@ -482,11 +483,15 @@ static int ibm_cffps_probe(struct i2c_client *client, ...@@ -482,11 +483,15 @@ static int ibm_cffps_probe(struct i2c_client *client,
struct dentry *ibm_cffps_dir; struct dentry *ibm_cffps_dir;
struct ibm_cffps *psu; struct ibm_cffps *psu;
const void *md = of_device_get_match_data(&client->dev); const void *md = of_device_get_match_data(&client->dev);
const struct i2c_device_id *id;
if (md) if (md) {
vs = (enum versions)md; vs = (enum versions)md;
else if (id) } else {
vs = (enum versions)id->driver_data; id = i2c_match_id(ibm_cffps_id, client);
if (id)
vs = (enum versions)id->driver_data;
}
if (vs == cffps_unknown) { if (vs == cffps_unknown) {
u16 ccin_revision = 0; u16 ccin_revision = 0;
...@@ -519,7 +524,7 @@ static int ibm_cffps_probe(struct i2c_client *client, ...@@ -519,7 +524,7 @@ static int ibm_cffps_probe(struct i2c_client *client,
} }
client->dev.platform_data = &ibm_cffps_pdata; client->dev.platform_data = &ibm_cffps_pdata;
rc = pmbus_do_probe(client, id, &ibm_cffps_info[vs]); rc = pmbus_do_probe(client, &ibm_cffps_info[vs]);
if (rc) if (rc)
return rc; return rc;
...@@ -611,7 +616,7 @@ static struct i2c_driver ibm_cffps_driver = { ...@@ -611,7 +616,7 @@ static struct i2c_driver ibm_cffps_driver = {
.name = "ibm-cffps", .name = "ibm-cffps",
.of_match_table = ibm_cffps_of_match, .of_match_table = ibm_cffps_of_match,
}, },
.probe = ibm_cffps_probe, .probe_new = ibm_cffps_probe,
.remove = pmbus_do_remove, .remove = pmbus_do_remove,
.id_table = ibm_cffps_id, .id_table = ibm_cffps_id,
}; };
......
...@@ -190,11 +190,10 @@ static struct pmbus_platform_data ipsps_pdata = { ...@@ -190,11 +190,10 @@ static struct pmbus_platform_data ipsps_pdata = {
.flags = PMBUS_SKIP_STATUS_CHECK, .flags = PMBUS_SKIP_STATUS_CHECK,
}; };
static int ipsps_probe(struct i2c_client *client, static int ipsps_probe(struct i2c_client *client)
const struct i2c_device_id *id)
{ {
client->dev.platform_data = &ipsps_pdata; client->dev.platform_data = &ipsps_pdata;
return pmbus_do_probe(client, id, &ipsps_info); return pmbus_do_probe(client, &ipsps_info);
} }
static const struct i2c_device_id ipsps_id[] = { static const struct i2c_device_id ipsps_id[] = {
...@@ -216,7 +215,7 @@ static struct i2c_driver ipsps_driver = { ...@@ -216,7 +215,7 @@ static struct i2c_driver ipsps_driver = {
.name = "inspur-ipsps", .name = "inspur-ipsps",
.of_match_table = of_match_ptr(ipsps_of_match), .of_match_table = of_match_ptr(ipsps_of_match),
}, },
.probe = ipsps_probe, .probe_new = ipsps_probe,
.remove = pmbus_do_remove, .remove = pmbus_do_remove,
.id_table = ipsps_id, .id_table = ipsps_id,
}; };
......
...@@ -67,8 +67,7 @@ static int ir35221_read_word_data(struct i2c_client *client, int page, ...@@ -67,8 +67,7 @@ static int ir35221_read_word_data(struct i2c_client *client, int page,
return ret; return ret;
} }
static int ir35221_probe(struct i2c_client *client, static int ir35221_probe(struct i2c_client *client)
const struct i2c_device_id *id)
{ {
struct pmbus_driver_info *info; struct pmbus_driver_info *info;
u8 buf[I2C_SMBUS_BLOCK_MAX]; u8 buf[I2C_SMBUS_BLOCK_MAX];
...@@ -123,7 +122,7 @@ static int ir35221_probe(struct i2c_client *client, ...@@ -123,7 +122,7 @@ static int ir35221_probe(struct i2c_client *client,
| PMBUS_HAVE_STATUS_INPUT | PMBUS_HAVE_STATUS_TEMP; | PMBUS_HAVE_STATUS_INPUT | PMBUS_HAVE_STATUS_TEMP;
info->func[1] = info->func[0]; info->func[1] = info->func[0];
return pmbus_do_probe(client, id, info); return pmbus_do_probe(client, info);
} }
static const struct i2c_device_id ir35221_id[] = { static const struct i2c_device_id ir35221_id[] = {
...@@ -137,7 +136,7 @@ static struct i2c_driver ir35221_driver = { ...@@ -137,7 +136,7 @@ static struct i2c_driver ir35221_driver = {
.driver = { .driver = {
.name = "ir35221", .name = "ir35221",
}, },
.probe = ir35221_probe, .probe_new = ir35221_probe,
.remove = pmbus_do_remove, .remove = pmbus_do_remove,
.id_table = ir35221_id, .id_table = ir35221_id,
}; };
......
...@@ -35,10 +35,9 @@ static struct pmbus_driver_info ir38064_info = { ...@@ -35,10 +35,9 @@ static struct pmbus_driver_info ir38064_info = {
| PMBUS_HAVE_POUT, | PMBUS_HAVE_POUT,
}; };
static int ir38064_probe(struct i2c_client *client, static int ir38064_probe(struct i2c_client *client)
const struct i2c_device_id *id)
{ {
return pmbus_do_probe(client, id, &ir38064_info); return pmbus_do_probe(client, &ir38064_info);
} }
static const struct i2c_device_id ir38064_id[] = { static const struct i2c_device_id ir38064_id[] = {
...@@ -53,7 +52,7 @@ static struct i2c_driver ir38064_driver = { ...@@ -53,7 +52,7 @@ static struct i2c_driver ir38064_driver = {
.driver = { .driver = {
.name = "ir38064", .name = "ir38064",
}, },
.probe = ir38064_probe, .probe_new = ir38064_probe,
.remove = pmbus_do_remove, .remove = pmbus_do_remove,
.id_table = ir38064_id, .id_table = ir38064_id,
}; };
......
...@@ -38,10 +38,9 @@ static struct pmbus_driver_info irps5401_info = { ...@@ -38,10 +38,9 @@ static struct pmbus_driver_info irps5401_info = {
.func[4] = IRPS5401_LDO_FUNC, .func[4] = IRPS5401_LDO_FUNC,
}; };
static int irps5401_probe(struct i2c_client *client, static int irps5401_probe(struct i2c_client *client)
const struct i2c_device_id *id)
{ {
return pmbus_do_probe(client, id, &irps5401_info); return pmbus_do_probe(client, &irps5401_info);
} }
static const struct i2c_device_id irps5401_id[] = { static const struct i2c_device_id irps5401_id[] = {
...@@ -55,7 +54,7 @@ static struct i2c_driver irps5401_driver = { ...@@ -55,7 +54,7 @@ static struct i2c_driver irps5401_driver = {
.driver = { .driver = {
.name = "irps5401", .name = "irps5401",
}, },
.probe = irps5401_probe, .probe_new = irps5401_probe,
.remove = pmbus_do_remove, .remove = pmbus_do_remove,
.id_table = irps5401_id, .id_table = irps5401_id,
}; };
......
...@@ -72,6 +72,8 @@ enum variants { ...@@ -72,6 +72,8 @@ enum variants {
raa_dmpvr2_hv, raa_dmpvr2_hv,
}; };
static const struct i2c_device_id raa_dmpvr_id[];
static ssize_t isl68137_avs_enable_show_page(struct i2c_client *client, static ssize_t isl68137_avs_enable_show_page(struct i2c_client *client,
int page, int page,
char *buf) char *buf)
...@@ -218,8 +220,7 @@ static struct pmbus_driver_info raa_dmpvr_info = { ...@@ -218,8 +220,7 @@ static struct pmbus_driver_info raa_dmpvr_info = {
| PMBUS_HAVE_STATUS_IOUT | PMBUS_HAVE_POUT, | PMBUS_HAVE_STATUS_IOUT | PMBUS_HAVE_POUT,
}; };
static int isl68137_probe(struct i2c_client *client, static int isl68137_probe(struct i2c_client *client)
const struct i2c_device_id *id)
{ {
struct pmbus_driver_info *info; struct pmbus_driver_info *info;
...@@ -228,7 +229,7 @@ static int isl68137_probe(struct i2c_client *client, ...@@ -228,7 +229,7 @@ static int isl68137_probe(struct i2c_client *client,
return -ENOMEM; return -ENOMEM;
memcpy(info, &raa_dmpvr_info, sizeof(*info)); memcpy(info, &raa_dmpvr_info, sizeof(*info));
switch (id->driver_data) { switch (i2c_match_id(raa_dmpvr_id, client)->driver_data) {
case raa_dmpvr1_2rail: case raa_dmpvr1_2rail:
info->pages = 2; info->pages = 2;
info->R[PSC_VOLTAGE_IN] = 3; info->R[PSC_VOLTAGE_IN] = 3;
...@@ -267,7 +268,7 @@ static int isl68137_probe(struct i2c_client *client, ...@@ -267,7 +268,7 @@ static int isl68137_probe(struct i2c_client *client,
return -ENODEV; return -ENODEV;
} }
return pmbus_do_probe(client, id, info); return pmbus_do_probe(client, info);
} }
static const struct i2c_device_id raa_dmpvr_id[] = { static const struct i2c_device_id raa_dmpvr_id[] = {
...@@ -322,7 +323,7 @@ static struct i2c_driver isl68137_driver = { ...@@ -322,7 +323,7 @@ static struct i2c_driver isl68137_driver = {
.driver = { .driver = {
.name = "isl68137", .name = "isl68137",
}, },
.probe = isl68137_probe, .probe_new = isl68137_probe,
.remove = pmbus_do_remove, .remove = pmbus_do_remove,
.id_table = raa_dmpvr_id, .id_table = raa_dmpvr_id,
}; };
......
...@@ -211,6 +211,8 @@ struct lm25066_data { ...@@ -211,6 +211,8 @@ struct lm25066_data {
#define to_lm25066_data(x) container_of(x, struct lm25066_data, info) #define to_lm25066_data(x) container_of(x, struct lm25066_data, info)
static const struct i2c_device_id lm25066_id[];
static int lm25066_read_word_data(struct i2c_client *client, int page, static int lm25066_read_word_data(struct i2c_client *client, int page,
int phase, int reg) int phase, int reg)
{ {
...@@ -416,8 +418,7 @@ static int lm25066_write_word_data(struct i2c_client *client, int page, int reg, ...@@ -416,8 +418,7 @@ static int lm25066_write_word_data(struct i2c_client *client, int page, int reg,
return ret; return ret;
} }
static int lm25066_probe(struct i2c_client *client, static int lm25066_probe(struct i2c_client *client)
const struct i2c_device_id *id)
{ {
int config; int config;
struct lm25066_data *data; struct lm25066_data *data;
...@@ -437,7 +438,7 @@ static int lm25066_probe(struct i2c_client *client, ...@@ -437,7 +438,7 @@ static int lm25066_probe(struct i2c_client *client,
if (config < 0) if (config < 0)
return config; return config;
data->id = id->driver_data; data->id = i2c_match_id(lm25066_id, client)->driver_data;
info = &data->info; info = &data->info;
info->pages = 1; info->pages = 1;
...@@ -487,7 +488,7 @@ static int lm25066_probe(struct i2c_client *client, ...@@ -487,7 +488,7 @@ static int lm25066_probe(struct i2c_client *client,
info->b[PSC_POWER] = coeff[PSC_POWER].b; info->b[PSC_POWER] = coeff[PSC_POWER].b;
} }
return pmbus_do_probe(client, id, info); return pmbus_do_probe(client, info);
} }
static const struct i2c_device_id lm25066_id[] = { static const struct i2c_device_id lm25066_id[] = {
...@@ -506,7 +507,7 @@ static struct i2c_driver lm25066_driver = { ...@@ -506,7 +507,7 @@ static struct i2c_driver lm25066_driver = {
.driver = { .driver = {
.name = "lm25066", .name = "lm25066",
}, },
.probe = lm25066_probe, .probe_new = lm25066_probe,
.remove = pmbus_do_remove, .remove = pmbus_do_remove,
.id_table = lm25066_id, .id_table = lm25066_id,
}; };
......
...@@ -649,12 +649,12 @@ static int ltc2978_get_id(struct i2c_client *client) ...@@ -649,12 +649,12 @@ static int ltc2978_get_id(struct i2c_client *client)
return -ENODEV; return -ENODEV;
} }
static int ltc2978_probe(struct i2c_client *client, static int ltc2978_probe(struct i2c_client *client)
const struct i2c_device_id *id)
{ {
int i, chip_id; int i, chip_id;
struct ltc2978_data *data; struct ltc2978_data *data;
struct pmbus_driver_info *info; struct pmbus_driver_info *info;
const struct i2c_device_id *id;
if (!i2c_check_functionality(client->adapter, if (!i2c_check_functionality(client->adapter,
I2C_FUNC_SMBUS_READ_WORD_DATA)) I2C_FUNC_SMBUS_READ_WORD_DATA))
...@@ -670,11 +670,13 @@ static int ltc2978_probe(struct i2c_client *client, ...@@ -670,11 +670,13 @@ static int ltc2978_probe(struct i2c_client *client,
return chip_id; return chip_id;
data->id = chip_id; data->id = chip_id;
id = i2c_match_id(ltc2978_id, client);
if (data->id != id->driver_data) if (data->id != id->driver_data)
dev_warn(&client->dev, dev_warn(&client->dev,
"Device mismatch: Configured %s, detected %s\n", "Device mismatch: Configured %s (%d), detected %d\n",
id->name, id->name,
ltc2978_id[data->id].name); (int) id->driver_data,
chip_id);
info = &data->info; info = &data->info;
info->write_word_data = ltc2978_write_word_data; info->write_word_data = ltc2978_write_word_data;
...@@ -832,7 +834,7 @@ static int ltc2978_probe(struct i2c_client *client, ...@@ -832,7 +834,7 @@ static int ltc2978_probe(struct i2c_client *client,
} }
#endif #endif
return pmbus_do_probe(client, id, info); return pmbus_do_probe(client, info);
} }
...@@ -872,7 +874,7 @@ static struct i2c_driver ltc2978_driver = { ...@@ -872,7 +874,7 @@ static struct i2c_driver ltc2978_driver = {
.name = "ltc2978", .name = "ltc2978",
.of_match_table = of_match_ptr(ltc2978_of_match), .of_match_table = of_match_ptr(ltc2978_of_match),
}, },
.probe = ltc2978_probe, .probe_new = ltc2978_probe,
.remove = pmbus_do_remove, .remove = pmbus_do_remove,
.id_table = ltc2978_id, .id_table = ltc2978_id,
}; };
......
...@@ -178,8 +178,7 @@ static struct pmbus_driver_info ltc3815_info = { ...@@ -178,8 +178,7 @@ static struct pmbus_driver_info ltc3815_info = {
.write_word_data = ltc3815_write_word_data, .write_word_data = ltc3815_write_word_data,
}; };
static int ltc3815_probe(struct i2c_client *client, static int ltc3815_probe(struct i2c_client *client)
const struct i2c_device_id *id)
{ {
int chip_id; int chip_id;
...@@ -193,14 +192,14 @@ static int ltc3815_probe(struct i2c_client *client, ...@@ -193,14 +192,14 @@ static int ltc3815_probe(struct i2c_client *client,
if ((chip_id & LTC3815_ID_MASK) != LTC3815_ID) if ((chip_id & LTC3815_ID_MASK) != LTC3815_ID)
return -ENODEV; return -ENODEV;
return pmbus_do_probe(client, id, &ltc3815_info); return pmbus_do_probe(client, &ltc3815_info);
} }
static struct i2c_driver ltc3815_driver = { static struct i2c_driver ltc3815_driver = {
.driver = { .driver = {
.name = "ltc3815", .name = "ltc3815",
}, },
.probe = ltc3815_probe, .probe_new = ltc3815_probe,
.remove = pmbus_do_remove, .remove = pmbus_do_remove,
.id_table = ltc3815_id, .id_table = ltc3815_id,
}; };
......
...@@ -85,10 +85,9 @@ static struct pmbus_driver_info max16064_info = { ...@@ -85,10 +85,9 @@ static struct pmbus_driver_info max16064_info = {
.write_word_data = max16064_write_word_data, .write_word_data = max16064_write_word_data,
}; };
static int max16064_probe(struct i2c_client *client, static int max16064_probe(struct i2c_client *client)
const struct i2c_device_id *id)
{ {
return pmbus_do_probe(client, id, &max16064_info); return pmbus_do_probe(client, &max16064_info);
} }
static const struct i2c_device_id max16064_id[] = { static const struct i2c_device_id max16064_id[] = {
...@@ -103,7 +102,7 @@ static struct i2c_driver max16064_driver = { ...@@ -103,7 +102,7 @@ static struct i2c_driver max16064_driver = {
.driver = { .driver = {
.name = "max16064", .name = "max16064",
}, },
.probe = max16064_probe, .probe_new = max16064_probe,
.remove = pmbus_do_remove, .remove = pmbus_do_remove,
.id_table = max16064_id, .id_table = max16064_id,
}; };
......
...@@ -239,8 +239,7 @@ static void max16601_remove(void *_data) ...@@ -239,8 +239,7 @@ static void max16601_remove(void *_data)
i2c_unregister_device(data->vsa); i2c_unregister_device(data->vsa);
} }
static int max16601_probe(struct i2c_client *client, static int max16601_probe(struct i2c_client *client)
const struct i2c_device_id *id)
{ {
struct device *dev = &client->dev; struct device *dev = &client->dev;
u8 buf[I2C_SMBUS_BLOCK_MAX + 1]; u8 buf[I2C_SMBUS_BLOCK_MAX + 1];
...@@ -288,7 +287,7 @@ static int max16601_probe(struct i2c_client *client, ...@@ -288,7 +287,7 @@ static int max16601_probe(struct i2c_client *client,
data->info = max16601_info; data->info = max16601_info;
return pmbus_do_probe(client, id, &data->info); return pmbus_do_probe(client, &data->info);
} }
static const struct i2c_device_id max16601_id[] = { static const struct i2c_device_id max16601_id[] = {
...@@ -302,7 +301,7 @@ static struct i2c_driver max16601_driver = { ...@@ -302,7 +301,7 @@ static struct i2c_driver max16601_driver = {
.driver = { .driver = {
.name = "max16601", .name = "max16601",
}, },
.probe = max16601_probe, .probe_new = max16601_probe,
.remove = pmbus_do_remove, .remove = pmbus_do_remove,
.id_table = max16601_id, .id_table = max16601_id,
}; };
......
...@@ -37,6 +37,8 @@ struct max20730_data { ...@@ -37,6 +37,8 @@ struct max20730_data {
#define MAX20730_MFR_DEVSET1 0xd2 #define MAX20730_MFR_DEVSET1 0xd2
static const struct i2c_device_id max20730_id[];
/* /*
* Convert discreet value to direct data format. Strictly speaking, all passed * Convert discreet value to direct data format. Strictly speaking, all passed
* values are constants, so we could do that calculation manually. On the * values are constants, so we could do that calculation manually. On the
...@@ -295,8 +297,7 @@ static const struct pmbus_driver_info max20730_info[] = { ...@@ -295,8 +297,7 @@ static const struct pmbus_driver_info max20730_info[] = {
}, },
}; };
static int max20730_probe(struct i2c_client *client, static int max20730_probe(struct i2c_client *client)
const struct i2c_device_id *id)
{ {
struct device *dev = &client->dev; struct device *dev = &client->dev;
u8 buf[I2C_SMBUS_BLOCK_MAX + 1]; u8 buf[I2C_SMBUS_BLOCK_MAX + 1];
...@@ -356,7 +357,7 @@ static int max20730_probe(struct i2c_client *client, ...@@ -356,7 +357,7 @@ static int max20730_probe(struct i2c_client *client,
if (client->dev.of_node) if (client->dev.of_node)
chip_id = (enum chips)of_device_get_match_data(dev); chip_id = (enum chips)of_device_get_match_data(dev);
else else
chip_id = id->driver_data; chip_id = i2c_match_id(max20730_id, client)->driver_data;
data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
if (!data) if (!data)
...@@ -370,7 +371,7 @@ static int max20730_probe(struct i2c_client *client, ...@@ -370,7 +371,7 @@ static int max20730_probe(struct i2c_client *client,
return ret; return ret;
data->mfr_devset1 = ret; data->mfr_devset1 = ret;
return pmbus_do_probe(client, id, &data->info); return pmbus_do_probe(client, &data->info);
} }
static const struct i2c_device_id max20730_id[] = { static const struct i2c_device_id max20730_id[] = {
...@@ -398,7 +399,7 @@ static struct i2c_driver max20730_driver = { ...@@ -398,7 +399,7 @@ static struct i2c_driver max20730_driver = {
.name = "max20730", .name = "max20730",
.of_match_table = max20730_of_match, .of_match_table = max20730_of_match,
}, },
.probe = max20730_probe, .probe_new = max20730_probe,
.remove = pmbus_do_remove, .remove = pmbus_do_remove,
.id_table = max20730_id, .id_table = max20730_id,
}; };
......
...@@ -26,10 +26,9 @@ static struct pmbus_driver_info max20751_info = { ...@@ -26,10 +26,9 @@ static struct pmbus_driver_info max20751_info = {
PMBUS_HAVE_POUT, PMBUS_HAVE_POUT,
}; };
static int max20751_probe(struct i2c_client *client, static int max20751_probe(struct i2c_client *client)
const struct i2c_device_id *id)
{ {
return pmbus_do_probe(client, id, &max20751_info); return pmbus_do_probe(client, &max20751_info);
} }
static const struct i2c_device_id max20751_id[] = { static const struct i2c_device_id max20751_id[] = {
...@@ -43,7 +42,7 @@ static struct i2c_driver max20751_driver = { ...@@ -43,7 +42,7 @@ static struct i2c_driver max20751_driver = {
.driver = { .driver = {
.name = "max20751", .name = "max20751",
}, },
.probe = max20751_probe, .probe_new = max20751_probe,
.remove = pmbus_do_remove, .remove = pmbus_do_remove,
.id_table = max20751_id, .id_table = max20751_id,
}; };
......
...@@ -324,8 +324,7 @@ static int max31785_configure_dual_tach(struct i2c_client *client, ...@@ -324,8 +324,7 @@ static int max31785_configure_dual_tach(struct i2c_client *client,
return 0; return 0;
} }
static int max31785_probe(struct i2c_client *client, static int max31785_probe(struct i2c_client *client)
const struct i2c_device_id *id)
{ {
struct device *dev = &client->dev; struct device *dev = &client->dev;
struct pmbus_driver_info *info; struct pmbus_driver_info *info;
...@@ -354,7 +353,7 @@ static int max31785_probe(struct i2c_client *client, ...@@ -354,7 +353,7 @@ static int max31785_probe(struct i2c_client *client,
if (ret == MAX31785A) { if (ret == MAX31785A) {
dual_tach = true; dual_tach = true;
} else if (ret == MAX31785) { } else if (ret == MAX31785) {
if (!strcmp("max31785a", id->name)) if (!strcmp("max31785a", client->name))
dev_warn(dev, "Expected max3175a, found max31785: cannot provide secondary tachometer readings\n"); dev_warn(dev, "Expected max3175a, found max31785: cannot provide secondary tachometer readings\n");
} else { } else {
return -ENODEV; return -ENODEV;
...@@ -366,7 +365,7 @@ static int max31785_probe(struct i2c_client *client, ...@@ -366,7 +365,7 @@ static int max31785_probe(struct i2c_client *client,
return ret; return ret;
} }
return pmbus_do_probe(client, id, info); return pmbus_do_probe(client, info);
} }
static const struct i2c_device_id max31785_id[] = { static const struct i2c_device_id max31785_id[] = {
...@@ -390,7 +389,7 @@ static struct i2c_driver max31785_driver = { ...@@ -390,7 +389,7 @@ static struct i2c_driver max31785_driver = {
.name = "max31785", .name = "max31785",
.of_match_table = max31785_of_match, .of_match_table = max31785_of_match,
}, },
.probe = max31785_probe, .probe_new = max31785_probe,
.remove = pmbus_do_remove, .remove = pmbus_do_remove,
.id_table = max31785_id, .id_table = max31785_id,
}; };
......
...@@ -41,6 +41,8 @@ struct max34440_data { ...@@ -41,6 +41,8 @@ struct max34440_data {
#define to_max34440_data(x) container_of(x, struct max34440_data, info) #define to_max34440_data(x) container_of(x, struct max34440_data, info)
static const struct i2c_device_id max34440_id[];
static int max34440_read_word_data(struct i2c_client *client, int page, static int max34440_read_word_data(struct i2c_client *client, int page,
int phase, int reg) int phase, int reg)
{ {
...@@ -458,8 +460,7 @@ static struct pmbus_driver_info max34440_info[] = { ...@@ -458,8 +460,7 @@ static struct pmbus_driver_info max34440_info[] = {
}, },
}; };
static int max34440_probe(struct i2c_client *client, static int max34440_probe(struct i2c_client *client)
const struct i2c_device_id *id)
{ {
struct max34440_data *data; struct max34440_data *data;
int rv; int rv;
...@@ -468,8 +469,8 @@ static int max34440_probe(struct i2c_client *client, ...@@ -468,8 +469,8 @@ static int max34440_probe(struct i2c_client *client,
GFP_KERNEL); GFP_KERNEL);
if (!data) if (!data)
return -ENOMEM; return -ENOMEM;
data->id = id->driver_data; data->id = i2c_match_id(max34440_id, client)->driver_data;
data->info = max34440_info[id->driver_data]; data->info = max34440_info[data->id];
if (data->id == max34451) { if (data->id == max34451) {
rv = max34451_set_supported_funcs(client, data); rv = max34451_set_supported_funcs(client, data);
...@@ -477,7 +478,7 @@ static int max34440_probe(struct i2c_client *client, ...@@ -477,7 +478,7 @@ static int max34440_probe(struct i2c_client *client,
return rv; return rv;
} }
return pmbus_do_probe(client, id, &data->info); return pmbus_do_probe(client, &data->info);
} }
static const struct i2c_device_id max34440_id[] = { static const struct i2c_device_id max34440_id[] = {
...@@ -496,7 +497,7 @@ static struct i2c_driver max34440_driver = { ...@@ -496,7 +497,7 @@ static struct i2c_driver max34440_driver = {
.driver = { .driver = {
.name = "max34440", .name = "max34440",
}, },
.probe = max34440_probe, .probe_new = max34440_probe,
.remove = pmbus_do_remove, .remove = pmbus_do_remove,
.id_table = max34440_id, .id_table = max34440_id,
}; };
......
...@@ -165,10 +165,9 @@ static struct pmbus_driver_info max8688_info = { ...@@ -165,10 +165,9 @@ static struct pmbus_driver_info max8688_info = {
.write_word_data = max8688_write_word_data, .write_word_data = max8688_write_word_data,
}; };
static int max8688_probe(struct i2c_client *client, static int max8688_probe(struct i2c_client *client)
const struct i2c_device_id *id)
{ {
return pmbus_do_probe(client, id, &max8688_info); return pmbus_do_probe(client, &max8688_info);
} }
static const struct i2c_device_id max8688_id[] = { static const struct i2c_device_id max8688_id[] = {
...@@ -183,7 +182,7 @@ static struct i2c_driver max8688_driver = { ...@@ -183,7 +182,7 @@ static struct i2c_driver max8688_driver = {
.driver = { .driver = {
.name = "max8688", .name = "max8688",
}, },
.probe = max8688_probe, .probe_new = max8688_probe,
.remove = pmbus_do_remove, .remove = pmbus_do_remove,
.id_table = max8688_id, .id_table = max8688_id,
}; };
......
...@@ -20,6 +20,8 @@ struct pmbus_device_info { ...@@ -20,6 +20,8 @@ struct pmbus_device_info {
u32 flags; u32 flags;
}; };
static const struct i2c_device_id pmbus_id[];
/* /*
* Find sensor groups and status registers on each page. * Find sensor groups and status registers on each page.
*/ */
...@@ -159,8 +161,7 @@ static int pmbus_identify(struct i2c_client *client, ...@@ -159,8 +161,7 @@ static int pmbus_identify(struct i2c_client *client,
return ret; return ret;
} }
static int pmbus_probe(struct i2c_client *client, static int pmbus_probe(struct i2c_client *client)
const struct i2c_device_id *id)
{ {
struct pmbus_driver_info *info; struct pmbus_driver_info *info;
struct pmbus_platform_data *pdata = NULL; struct pmbus_platform_data *pdata = NULL;
...@@ -171,7 +172,7 @@ static int pmbus_probe(struct i2c_client *client, ...@@ -171,7 +172,7 @@ static int pmbus_probe(struct i2c_client *client,
if (!info) if (!info)
return -ENOMEM; return -ENOMEM;
device_info = (struct pmbus_device_info *)id->driver_data; device_info = (struct pmbus_device_info *)i2c_match_id(pmbus_id, client)->driver_data;
if (device_info->flags & PMBUS_SKIP_STATUS_CHECK) { if (device_info->flags & PMBUS_SKIP_STATUS_CHECK) {
pdata = devm_kzalloc(dev, sizeof(struct pmbus_platform_data), pdata = devm_kzalloc(dev, sizeof(struct pmbus_platform_data),
GFP_KERNEL); GFP_KERNEL);
...@@ -185,7 +186,7 @@ static int pmbus_probe(struct i2c_client *client, ...@@ -185,7 +186,7 @@ static int pmbus_probe(struct i2c_client *client,
info->identify = pmbus_identify; info->identify = pmbus_identify;
dev->platform_data = pdata; dev->platform_data = pdata;
return pmbus_do_probe(client, id, info); return pmbus_do_probe(client, info);
} }
static const struct pmbus_device_info pmbus_info_one = { static const struct pmbus_device_info pmbus_info_one = {
...@@ -236,7 +237,7 @@ static struct i2c_driver pmbus_driver = { ...@@ -236,7 +237,7 @@ static struct i2c_driver pmbus_driver = {
.driver = { .driver = {
.name = "pmbus", .name = "pmbus",
}, },
.probe = pmbus_probe, .probe_new = pmbus_probe,
.remove = pmbus_do_remove, .remove = pmbus_do_remove,
.id_table = pmbus_id, .id_table = pmbus_id,
}; };
......
...@@ -489,8 +489,7 @@ int pmbus_update_byte_data(struct i2c_client *client, int page, u8 reg, ...@@ -489,8 +489,7 @@ int pmbus_update_byte_data(struct i2c_client *client, int page, u8 reg,
void pmbus_clear_faults(struct i2c_client *client); void pmbus_clear_faults(struct i2c_client *client);
bool pmbus_check_byte_register(struct i2c_client *client, int page, int reg); bool pmbus_check_byte_register(struct i2c_client *client, int page, int reg);
bool pmbus_check_word_register(struct i2c_client *client, int page, int reg); bool pmbus_check_word_register(struct i2c_client *client, int page, int reg);
int pmbus_do_probe(struct i2c_client *client, const struct i2c_device_id *id, int pmbus_do_probe(struct i2c_client *client, struct pmbus_driver_info *info);
struct pmbus_driver_info *info);
int pmbus_do_remove(struct i2c_client *client); int pmbus_do_remove(struct i2c_client *client);
const struct pmbus_driver_info *pmbus_get_driver_info(struct i2c_client const struct pmbus_driver_info *pmbus_get_driver_info(struct i2c_client
*client); *client);
......
...@@ -2521,8 +2521,7 @@ static int pmbus_init_debugfs(struct i2c_client *client, ...@@ -2521,8 +2521,7 @@ static int pmbus_init_debugfs(struct i2c_client *client,
} }
#endif /* IS_ENABLED(CONFIG_DEBUG_FS) */ #endif /* IS_ENABLED(CONFIG_DEBUG_FS) */
int pmbus_do_probe(struct i2c_client *client, const struct i2c_device_id *id, int pmbus_do_probe(struct i2c_client *client, struct pmbus_driver_info *info)
struct pmbus_driver_info *info)
{ {
struct device *dev = &client->dev; struct device *dev = &client->dev;
const struct pmbus_platform_data *pdata = dev_get_platdata(dev); const struct pmbus_platform_data *pdata = dev_get_platdata(dev);
......
...@@ -78,8 +78,7 @@ static struct pmbus_driver_info pxe1610_info = { ...@@ -78,8 +78,7 @@ static struct pmbus_driver_info pxe1610_info = {
.identify = pxe1610_identify, .identify = pxe1610_identify,
}; };
static int pxe1610_probe(struct i2c_client *client, static int pxe1610_probe(struct i2c_client *client)
const struct i2c_device_id *id)
{ {
struct pmbus_driver_info *info; struct pmbus_driver_info *info;
u8 buf[I2C_SMBUS_BLOCK_MAX]; u8 buf[I2C_SMBUS_BLOCK_MAX];
...@@ -115,7 +114,7 @@ static int pxe1610_probe(struct i2c_client *client, ...@@ -115,7 +114,7 @@ static int pxe1610_probe(struct i2c_client *client,
if (!info) if (!info)
return -ENOMEM; return -ENOMEM;
return pmbus_do_probe(client, id, info); return pmbus_do_probe(client, info);
} }
static const struct i2c_device_id pxe1610_id[] = { static const struct i2c_device_id pxe1610_id[] = {
...@@ -131,7 +130,7 @@ static struct i2c_driver pxe1610_driver = { ...@@ -131,7 +130,7 @@ static struct i2c_driver pxe1610_driver = {
.driver = { .driver = {
.name = "pxe1610", .name = "pxe1610",
}, },
.probe = pxe1610_probe, .probe_new = pxe1610_probe,
.remove = pmbus_do_remove, .remove = pmbus_do_remove,
.id_table = pxe1610_id, .id_table = pxe1610_id,
}; };
......
...@@ -25,10 +25,9 @@ static struct pmbus_driver_info tps40422_info = { ...@@ -25,10 +25,9 @@ static struct pmbus_driver_info tps40422_info = {
| PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT, | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT,
}; };
static int tps40422_probe(struct i2c_client *client, static int tps40422_probe(struct i2c_client *client)
const struct i2c_device_id *id)
{ {
return pmbus_do_probe(client, id, &tps40422_info); return pmbus_do_probe(client, &tps40422_info);
} }
static const struct i2c_device_id tps40422_id[] = { static const struct i2c_device_id tps40422_id[] = {
...@@ -43,7 +42,7 @@ static struct i2c_driver tps40422_driver = { ...@@ -43,7 +42,7 @@ static struct i2c_driver tps40422_driver = {
.driver = { .driver = {
.name = "tps40422", .name = "tps40422",
}, },
.probe = tps40422_probe, .probe_new = tps40422_probe,
.remove = pmbus_do_remove, .remove = pmbus_do_remove,
.id_table = tps40422_id, .id_table = tps40422_id,
}; };
......
...@@ -34,6 +34,8 @@ enum chips { ...@@ -34,6 +34,8 @@ enum chips {
#define TPS53681_MFR_SPECIFIC_20 0xe4 /* Number of phases, per page */ #define TPS53681_MFR_SPECIFIC_20 0xe4 /* Number of phases, per page */
static const struct i2c_device_id tps53679_id[];
static int tps53679_identify_mode(struct i2c_client *client, static int tps53679_identify_mode(struct i2c_client *client,
struct pmbus_driver_info *info) struct pmbus_driver_info *info)
{ {
...@@ -183,8 +185,7 @@ static struct pmbus_driver_info tps53679_info = { ...@@ -183,8 +185,7 @@ static struct pmbus_driver_info tps53679_info = {
.pfunc[5] = PMBUS_HAVE_IOUT, .pfunc[5] = PMBUS_HAVE_IOUT,
}; };
static int tps53679_probe(struct i2c_client *client, static int tps53679_probe(struct i2c_client *client)
const struct i2c_device_id *id)
{ {
struct device *dev = &client->dev; struct device *dev = &client->dev;
struct pmbus_driver_info *info; struct pmbus_driver_info *info;
...@@ -193,7 +194,7 @@ static int tps53679_probe(struct i2c_client *client, ...@@ -193,7 +194,7 @@ static int tps53679_probe(struct i2c_client *client,
if (dev->of_node) if (dev->of_node)
chip_id = (enum chips)of_device_get_match_data(dev); chip_id = (enum chips)of_device_get_match_data(dev);
else else
chip_id = id->driver_data; chip_id = i2c_match_id(tps53679_id, client)->driver_data;
info = devm_kmemdup(dev, &tps53679_info, sizeof(*info), GFP_KERNEL); info = devm_kmemdup(dev, &tps53679_info, sizeof(*info), GFP_KERNEL);
if (!info) if (!info)
...@@ -220,7 +221,7 @@ static int tps53679_probe(struct i2c_client *client, ...@@ -220,7 +221,7 @@ static int tps53679_probe(struct i2c_client *client,
return -ENODEV; return -ENODEV;
} }
return pmbus_do_probe(client, id, info); return pmbus_do_probe(client, info);
} }
static const struct i2c_device_id tps53679_id[] = { static const struct i2c_device_id tps53679_id[] = {
...@@ -249,7 +250,7 @@ static struct i2c_driver tps53679_driver = { ...@@ -249,7 +250,7 @@ static struct i2c_driver tps53679_driver = {
.name = "tps53679", .name = "tps53679",
.of_match_table = of_match_ptr(tps53679_of_match), .of_match_table = of_match_ptr(tps53679_of_match),
}, },
.probe = tps53679_probe, .probe_new = tps53679_probe,
.remove = pmbus_do_remove, .remove = pmbus_do_remove,
.id_table = tps53679_id, .id_table = tps53679_id,
}; };
......
...@@ -487,8 +487,7 @@ static int ucd9000_init_debugfs(struct i2c_client *client, ...@@ -487,8 +487,7 @@ static int ucd9000_init_debugfs(struct i2c_client *client,
} }
#endif /* CONFIG_DEBUG_FS */ #endif /* CONFIG_DEBUG_FS */
static int ucd9000_probe(struct i2c_client *client, static int ucd9000_probe(struct i2c_client *client)
const struct i2c_device_id *id)
{ {
u8 block_buffer[I2C_SMBUS_BLOCK_MAX + 1]; u8 block_buffer[I2C_SMBUS_BLOCK_MAX + 1];
struct ucd9000_data *data; struct ucd9000_data *data;
...@@ -523,12 +522,12 @@ static int ucd9000_probe(struct i2c_client *client, ...@@ -523,12 +522,12 @@ static int ucd9000_probe(struct i2c_client *client,
if (client->dev.of_node) if (client->dev.of_node)
chip = (enum chips)of_device_get_match_data(&client->dev); chip = (enum chips)of_device_get_match_data(&client->dev);
else else
chip = id->driver_data; chip = mid->driver_data;
if (chip != ucd9000 && chip != mid->driver_data) if (chip != ucd9000 && strcmp(client->name, mid->name) != 0)
dev_notice(&client->dev, dev_notice(&client->dev,
"Device mismatch: Configured %s, detected %s\n", "Device mismatch: Configured %s, detected %s\n",
id->name, mid->name); client->name, mid->name);
data = devm_kzalloc(&client->dev, sizeof(struct ucd9000_data), data = devm_kzalloc(&client->dev, sizeof(struct ucd9000_data),
GFP_KERNEL); GFP_KERNEL);
...@@ -603,7 +602,7 @@ static int ucd9000_probe(struct i2c_client *client, ...@@ -603,7 +602,7 @@ static int ucd9000_probe(struct i2c_client *client,
ucd9000_probe_gpio(client, mid, data); ucd9000_probe_gpio(client, mid, data);
ret = pmbus_do_probe(client, mid, info); ret = pmbus_do_probe(client, info);
if (ret) if (ret)
return ret; return ret;
...@@ -621,7 +620,7 @@ static struct i2c_driver ucd9000_driver = { ...@@ -621,7 +620,7 @@ static struct i2c_driver ucd9000_driver = {
.name = "ucd9000", .name = "ucd9000",
.of_match_table = of_match_ptr(ucd9000_of_match), .of_match_table = of_match_ptr(ucd9000_of_match),
}, },
.probe = ucd9000_probe, .probe_new = ucd9000_probe,
.remove = pmbus_do_remove, .remove = pmbus_do_remove,
.id_table = ucd9000_id, .id_table = ucd9000_id,
}; };
......
...@@ -71,8 +71,7 @@ static const struct of_device_id __maybe_unused ucd9200_of_match[] = { ...@@ -71,8 +71,7 @@ static const struct of_device_id __maybe_unused ucd9200_of_match[] = {
}; };
MODULE_DEVICE_TABLE(of, ucd9200_of_match); MODULE_DEVICE_TABLE(of, ucd9200_of_match);
static int ucd9200_probe(struct i2c_client *client, static int ucd9200_probe(struct i2c_client *client)
const struct i2c_device_id *id)
{ {
u8 block_buffer[I2C_SMBUS_BLOCK_MAX + 1]; u8 block_buffer[I2C_SMBUS_BLOCK_MAX + 1];
struct pmbus_driver_info *info; struct pmbus_driver_info *info;
...@@ -106,12 +105,12 @@ static int ucd9200_probe(struct i2c_client *client, ...@@ -106,12 +105,12 @@ static int ucd9200_probe(struct i2c_client *client,
if (client->dev.of_node) if (client->dev.of_node)
chip = (enum chips)of_device_get_match_data(&client->dev); chip = (enum chips)of_device_get_match_data(&client->dev);
else else
chip = id->driver_data; chip = mid->driver_data;
if (chip != ucd9200 && chip != mid->driver_data) if (chip != ucd9200 && strcmp(client->name, mid->name) != 0)
dev_notice(&client->dev, dev_notice(&client->dev,
"Device mismatch: Configured %s, detected %s\n", "Device mismatch: Configured %s, detected %s\n",
id->name, mid->name); client->name, mid->name);
info = devm_kzalloc(&client->dev, sizeof(struct pmbus_driver_info), info = devm_kzalloc(&client->dev, sizeof(struct pmbus_driver_info),
GFP_KERNEL); GFP_KERNEL);
...@@ -192,7 +191,7 @@ static int ucd9200_probe(struct i2c_client *client, ...@@ -192,7 +191,7 @@ static int ucd9200_probe(struct i2c_client *client,
if (mid->driver_data == ucd9240) if (mid->driver_data == ucd9240)
info->func[0] |= PMBUS_HAVE_FAN12 | PMBUS_HAVE_STATUS_FAN12; info->func[0] |= PMBUS_HAVE_FAN12 | PMBUS_HAVE_STATUS_FAN12;
return pmbus_do_probe(client, mid, info); return pmbus_do_probe(client, info);
} }
/* This is the driver that will be inserted */ /* This is the driver that will be inserted */
...@@ -201,7 +200,7 @@ static struct i2c_driver ucd9200_driver = { ...@@ -201,7 +200,7 @@ static struct i2c_driver ucd9200_driver = {
.name = "ucd9200", .name = "ucd9200",
.of_match_table = of_match_ptr(ucd9200_of_match), .of_match_table = of_match_ptr(ucd9200_of_match),
}, },
.probe = ucd9200_probe, .probe_new = ucd9200_probe,
.remove = pmbus_do_remove, .remove = pmbus_do_remove,
.id_table = ucd9200_id, .id_table = ucd9200_id,
}; };
......
...@@ -127,8 +127,7 @@ static struct pmbus_driver_info xdpe122_info = { ...@@ -127,8 +127,7 @@ static struct pmbus_driver_info xdpe122_info = {
.read_word_data = xdpe122_read_word_data, .read_word_data = xdpe122_read_word_data,
}; };
static int xdpe122_probe(struct i2c_client *client, static int xdpe122_probe(struct i2c_client *client)
const struct i2c_device_id *id)
{ {
struct pmbus_driver_info *info; struct pmbus_driver_info *info;
...@@ -137,7 +136,7 @@ static int xdpe122_probe(struct i2c_client *client, ...@@ -137,7 +136,7 @@ static int xdpe122_probe(struct i2c_client *client,
if (!info) if (!info)
return -ENOMEM; return -ENOMEM;
return pmbus_do_probe(client, id, info); return pmbus_do_probe(client, info);
} }
static const struct i2c_device_id xdpe122_id[] = { static const struct i2c_device_id xdpe122_id[] = {
...@@ -160,7 +159,7 @@ static struct i2c_driver xdpe122_driver = { ...@@ -160,7 +159,7 @@ static struct i2c_driver xdpe122_driver = {
.name = "xdpe12284", .name = "xdpe12284",
.of_match_table = of_match_ptr(xdpe122_of_match), .of_match_table = of_match_ptr(xdpe122_of_match),
}, },
.probe = xdpe122_probe, .probe_new = xdpe122_probe,
.remove = pmbus_do_remove, .remove = pmbus_do_remove,
.id_table = xdpe122_id, .id_table = xdpe122_id,
}; };
......
...@@ -301,8 +301,7 @@ static const struct i2c_device_id zl6100_id[] = { ...@@ -301,8 +301,7 @@ static const struct i2c_device_id zl6100_id[] = {
}; };
MODULE_DEVICE_TABLE(i2c, zl6100_id); MODULE_DEVICE_TABLE(i2c, zl6100_id);
static int zl6100_probe(struct i2c_client *client, static int zl6100_probe(struct i2c_client *client)
const struct i2c_device_id *id)
{ {
int ret; int ret;
struct zl6100_data *data; struct zl6100_data *data;
...@@ -333,10 +332,10 @@ static int zl6100_probe(struct i2c_client *client, ...@@ -333,10 +332,10 @@ static int zl6100_probe(struct i2c_client *client,
dev_err(&client->dev, "Unsupported device\n"); dev_err(&client->dev, "Unsupported device\n");
return -ENODEV; return -ENODEV;
} }
if (id->driver_data != mid->driver_data) if (strcmp(client->name, mid->name) != 0)
dev_notice(&client->dev, dev_notice(&client->dev,
"Device mismatch: Configured %s, detected %s\n", "Device mismatch: Configured %s, detected %s\n",
id->name, mid->name); client->name, mid->name);
data = devm_kzalloc(&client->dev, sizeof(struct zl6100_data), data = devm_kzalloc(&client->dev, sizeof(struct zl6100_data),
GFP_KERNEL); GFP_KERNEL);
...@@ -389,14 +388,14 @@ static int zl6100_probe(struct i2c_client *client, ...@@ -389,14 +388,14 @@ static int zl6100_probe(struct i2c_client *client,
info->write_word_data = zl6100_write_word_data; info->write_word_data = zl6100_write_word_data;
info->write_byte = zl6100_write_byte; info->write_byte = zl6100_write_byte;
return pmbus_do_probe(client, mid, info); return pmbus_do_probe(client, info);
} }
static struct i2c_driver zl6100_driver = { static struct i2c_driver zl6100_driver = {
.driver = { .driver = {
.name = "zl6100", .name = "zl6100",
}, },
.probe = zl6100_probe, .probe_new = zl6100_probe,
.remove = pmbus_do_remove, .remove = pmbus_do_remove,
.id_table = zl6100_id, .id_table = zl6100_id,
}; };
......
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