diff mbox series

hwmon/pmbus: use simple i2c probe function

Message ID 20200806161645.9437-1-steve@sk2.org
State Superseded
Headers show
Series hwmon/pmbus: use simple i2c probe function | expand

Commit Message

Stephen Kitt Aug. 6, 2020, 4:16 p.m. UTC
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 which
don't use the id information either.

This avoids scanning the identifier tables during probes.

Additionally, in cases where the id information (driver_data) isn't
used, the corresponding declarations are removed from the id_table,
and .name is specified explicitly.

Signed-off-by: Stephen Kitt <steve@sk2.org>
---
 drivers/hwmon/pmbus/bel-pfe.c      |  2 +-
 drivers/hwmon/pmbus/ibm-cffps.c    |  2 +-
 drivers/hwmon/pmbus/inspur-ipsps.c |  9 ++++-----
 drivers/hwmon/pmbus/ir35221.c      |  9 ++++-----
 drivers/hwmon/pmbus/ir38064.c      |  9 ++++-----
 drivers/hwmon/pmbus/irps5401.c     |  9 ++++-----
 drivers/hwmon/pmbus/isl68137.c     |  2 +-
 drivers/hwmon/pmbus/lm25066.c      |  2 +-
 drivers/hwmon/pmbus/ltc2978.c      |  2 +-
 drivers/hwmon/pmbus/ltc3815.c      |  9 ++++-----
 drivers/hwmon/pmbus/max16064.c     |  9 ++++-----
 drivers/hwmon/pmbus/max16601.c     |  9 ++++-----
 drivers/hwmon/pmbus/max20730.c     |  2 +-
 drivers/hwmon/pmbus/max20751.c     |  9 ++++-----
 drivers/hwmon/pmbus/max31785.c     | 13 ++++++-------
 drivers/hwmon/pmbus/max34440.c     |  2 +-
 drivers/hwmon/pmbus/max8688.c      |  9 ++++-----
 drivers/hwmon/pmbus/pmbus.c        |  2 +-
 drivers/hwmon/pmbus/pmbus.h        |  3 +--
 drivers/hwmon/pmbus/pmbus_core.c   |  3 +--
 drivers/hwmon/pmbus/pxe1610.c      | 13 ++++++-------
 drivers/hwmon/pmbus/tps40422.c     |  9 ++++-----
 drivers/hwmon/pmbus/tps53679.c     |  2 +-
 drivers/hwmon/pmbus/ucd9000.c      |  2 +-
 drivers/hwmon/pmbus/ucd9200.c      |  2 +-
 drivers/hwmon/pmbus/xdpe12284.c    | 11 +++++------
 drivers/hwmon/pmbus/zl6100.c       |  2 +-
 27 files changed, 71 insertions(+), 86 deletions(-)


base-commit: bcf876870b95592b52519ed4aafcf9d95999bc9c

Comments

Guenter Roeck Aug. 6, 2020, 7:15 p.m. UTC | #1
On 8/6/20 9:16 AM, Stephen Kitt wrote:
> 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 which
> don't use the id information either.
> 
> This avoids scanning the identifier tables during probes.
> 
> Additionally, in cases where the id information (driver_data) isn't
> used, the corresponding declarations are removed from the id_table,
> and .name is specified explicitly.
> 

The ultimate idea seems to be to remove the "old" i2c probe function
entirely. This means we'll have to touch the various drivers again
to make that happen if they are not converted to probe_new.

With that in mind, since we are at it, why not use probe_new() in
every driver and call i2c_match_id() in cases where it is actually
needed/used ?

Also, I am not convinced that replacements such as

-	{ "ipsps1", 0 },
+	{ .name = "ipsps1" },

are an improvement. I would suggest to leave that alone for
consistency (and to make it easier to add more devices to the
various drivers if that happens in the future).

Thanks,
Guenter

> Signed-off-by: Stephen Kitt <steve@sk2.org>
> ---
>  drivers/hwmon/pmbus/bel-pfe.c      |  2 +-
>  drivers/hwmon/pmbus/ibm-cffps.c    |  2 +-
>  drivers/hwmon/pmbus/inspur-ipsps.c |  9 ++++-----
>  drivers/hwmon/pmbus/ir35221.c      |  9 ++++-----
>  drivers/hwmon/pmbus/ir38064.c      |  9 ++++-----
>  drivers/hwmon/pmbus/irps5401.c     |  9 ++++-----
>  drivers/hwmon/pmbus/isl68137.c     |  2 +-
>  drivers/hwmon/pmbus/lm25066.c      |  2 +-
>  drivers/hwmon/pmbus/ltc2978.c      |  2 +-
>  drivers/hwmon/pmbus/ltc3815.c      |  9 ++++-----
>  drivers/hwmon/pmbus/max16064.c     |  9 ++++-----
>  drivers/hwmon/pmbus/max16601.c     |  9 ++++-----
>  drivers/hwmon/pmbus/max20730.c     |  2 +-
>  drivers/hwmon/pmbus/max20751.c     |  9 ++++-----
>  drivers/hwmon/pmbus/max31785.c     | 13 ++++++-------
>  drivers/hwmon/pmbus/max34440.c     |  2 +-
>  drivers/hwmon/pmbus/max8688.c      |  9 ++++-----
>  drivers/hwmon/pmbus/pmbus.c        |  2 +-
>  drivers/hwmon/pmbus/pmbus.h        |  3 +--
>  drivers/hwmon/pmbus/pmbus_core.c   |  3 +--
>  drivers/hwmon/pmbus/pxe1610.c      | 13 ++++++-------
>  drivers/hwmon/pmbus/tps40422.c     |  9 ++++-----
>  drivers/hwmon/pmbus/tps53679.c     |  2 +-
>  drivers/hwmon/pmbus/ucd9000.c      |  2 +-
>  drivers/hwmon/pmbus/ucd9200.c      |  2 +-
>  drivers/hwmon/pmbus/xdpe12284.c    | 11 +++++------
>  drivers/hwmon/pmbus/zl6100.c       |  2 +-
>  27 files changed, 71 insertions(+), 86 deletions(-)
> 
> diff --git a/drivers/hwmon/pmbus/bel-pfe.c b/drivers/hwmon/pmbus/bel-pfe.c
> index f236e18f45a5..240d86043d75 100644
> --- a/drivers/hwmon/pmbus/bel-pfe.c
> +++ b/drivers/hwmon/pmbus/bel-pfe.c
> @@ -104,7 +104,7 @@ static int pfe_pmbus_probe(struct i2c_client *client,
>  		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[] = {
> diff --git a/drivers/hwmon/pmbus/ibm-cffps.c b/drivers/hwmon/pmbus/ibm-cffps.c
> index 7d300f2f338d..0215e792ec7e 100644
> --- a/drivers/hwmon/pmbus/ibm-cffps.c
> +++ b/drivers/hwmon/pmbus/ibm-cffps.c
> @@ -519,7 +519,7 @@ static int ibm_cffps_probe(struct i2c_client *client,
>  	}
>  
>  	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)
>  		return rc;
>  
> diff --git a/drivers/hwmon/pmbus/inspur-ipsps.c b/drivers/hwmon/pmbus/inspur-ipsps.c
> index 42e01549184a..b97848e05ae2 100644
> --- a/drivers/hwmon/pmbus/inspur-ipsps.c
> +++ b/drivers/hwmon/pmbus/inspur-ipsps.c
> @@ -190,15 +190,14 @@ static struct pmbus_platform_data ipsps_pdata = {
>  	.flags = PMBUS_SKIP_STATUS_CHECK,
>  };
>  
> -static int ipsps_probe(struct i2c_client *client,
> -		       const struct i2c_device_id *id)
> +static int ipsps_probe(struct i2c_client *client)
>  {
>  	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[] = {
> -	{ "ipsps1", 0 },
> +	{ .name = "ipsps1" },
>  	{}
>  };
>  MODULE_DEVICE_TABLE(i2c, ipsps_id);
> @@ -216,7 +215,7 @@ static struct i2c_driver ipsps_driver = {
>  		.name = "inspur-ipsps",
>  		.of_match_table = of_match_ptr(ipsps_of_match),
>  	},
> -	.probe = ipsps_probe,
> +	.probe_new = ipsps_probe,
>  	.remove = pmbus_do_remove,
>  	.id_table = ipsps_id,
>  };
> diff --git a/drivers/hwmon/pmbus/ir35221.c b/drivers/hwmon/pmbus/ir35221.c
> index 3eea3e006a96..e7fabafca2f1 100644
> --- a/drivers/hwmon/pmbus/ir35221.c
> +++ b/drivers/hwmon/pmbus/ir35221.c
> @@ -67,8 +67,7 @@ static int ir35221_read_word_data(struct i2c_client *client, int page,
>  	return ret;
>  }
>  
> -static int ir35221_probe(struct i2c_client *client,
> -			 const struct i2c_device_id *id)
> +static int ir35221_probe(struct i2c_client *client)
>  {
>  	struct pmbus_driver_info *info;
>  	u8 buf[I2C_SMBUS_BLOCK_MAX];
> @@ -123,11 +122,11 @@ static int ir35221_probe(struct i2c_client *client,
>  		| PMBUS_HAVE_STATUS_INPUT | PMBUS_HAVE_STATUS_TEMP;
>  	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[] = {
> -	{"ir35221", 0},
> +	{ .name = "ir35221" },
>  	{}
>  };
>  
> @@ -137,7 +136,7 @@ static struct i2c_driver ir35221_driver = {
>  	.driver = {
>  		.name	= "ir35221",
>  	},
> -	.probe		= ir35221_probe,
> +	.probe_new	= ir35221_probe,
>  	.remove		= pmbus_do_remove,
>  	.id_table	= ir35221_id,
>  };
> diff --git a/drivers/hwmon/pmbus/ir38064.c b/drivers/hwmon/pmbus/ir38064.c
> index 1820f5077f66..a36ab6cc21d7 100644
> --- a/drivers/hwmon/pmbus/ir38064.c
> +++ b/drivers/hwmon/pmbus/ir38064.c
> @@ -35,14 +35,13 @@ static struct pmbus_driver_info ir38064_info = {
>  	    | PMBUS_HAVE_POUT,
>  };
>  
> -static int ir38064_probe(struct i2c_client *client,
> -			 const struct i2c_device_id *id)
> +static int ir38064_probe(struct i2c_client *client)
>  {
> -	return pmbus_do_probe(client, id, &ir38064_info);
> +	return pmbus_do_probe(client, &ir38064_info);
>  }
>  
>  static const struct i2c_device_id ir38064_id[] = {
> -	{"ir38064", 0},
> +	{ .name = "ir38064" },
>  	{}
>  };
>  
> @@ -53,7 +52,7 @@ static struct i2c_driver ir38064_driver = {
>  	.driver = {
>  		   .name = "ir38064",
>  		   },
> -	.probe = ir38064_probe,
> +	.probe_new = ir38064_probe,
>  	.remove = pmbus_do_remove,
>  	.id_table = ir38064_id,
>  };
> diff --git a/drivers/hwmon/pmbus/irps5401.c b/drivers/hwmon/pmbus/irps5401.c
> index d37daa001fb3..828b91567137 100644
> --- a/drivers/hwmon/pmbus/irps5401.c
> +++ b/drivers/hwmon/pmbus/irps5401.c
> @@ -38,14 +38,13 @@ static struct pmbus_driver_info irps5401_info = {
>  	.func[4] = IRPS5401_LDO_FUNC,
>  };
>  
> -static int irps5401_probe(struct i2c_client *client,
> -			  const struct i2c_device_id *id)
> +static int irps5401_probe(struct i2c_client *client)
>  {
> -	return pmbus_do_probe(client, id, &irps5401_info);
> +	return pmbus_do_probe(client, &irps5401_info);
>  }
>  
>  static const struct i2c_device_id irps5401_id[] = {
> -	{"irps5401", 0},
> +	{ .name = "irps5401" },
>  	{}
>  };
>  
> @@ -55,7 +54,7 @@ static struct i2c_driver irps5401_driver = {
>  	.driver = {
>  		   .name = "irps5401",
>  		   },
> -	.probe = irps5401_probe,
> +	.probe_new = irps5401_probe,
>  	.remove = pmbus_do_remove,
>  	.id_table = irps5401_id,
>  };
> diff --git a/drivers/hwmon/pmbus/isl68137.c b/drivers/hwmon/pmbus/isl68137.c
> index 0c622711ef7e..2d626ccbc11d 100644
> --- a/drivers/hwmon/pmbus/isl68137.c
> +++ b/drivers/hwmon/pmbus/isl68137.c
> @@ -262,7 +262,7 @@ static int isl68137_probe(struct i2c_client *client,
>  		return -ENODEV;
>  	}
>  
> -	return pmbus_do_probe(client, id, info);
> +	return pmbus_do_probe(client, info);
>  }
>  
>  static const struct i2c_device_id raa_dmpvr_id[] = {
> diff --git a/drivers/hwmon/pmbus/lm25066.c b/drivers/hwmon/pmbus/lm25066.c
> index 9e4cf0800186..2d28cddc365f 100644
> --- a/drivers/hwmon/pmbus/lm25066.c
> +++ b/drivers/hwmon/pmbus/lm25066.c
> @@ -487,7 +487,7 @@ static int lm25066_probe(struct i2c_client *client,
>  		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[] = {
> diff --git a/drivers/hwmon/pmbus/ltc2978.c b/drivers/hwmon/pmbus/ltc2978.c
> index 7b0e6b37e247..da6832094676 100644
> --- a/drivers/hwmon/pmbus/ltc2978.c
> +++ b/drivers/hwmon/pmbus/ltc2978.c
> @@ -832,7 +832,7 @@ static int ltc2978_probe(struct i2c_client *client,
>  	}
>  #endif
>  
> -	return pmbus_do_probe(client, id, info);
> +	return pmbus_do_probe(client, info);
>  }
>  
>  
> diff --git a/drivers/hwmon/pmbus/ltc3815.c b/drivers/hwmon/pmbus/ltc3815.c
> index 3036263e0a66..0a02fbac127a 100644
> --- a/drivers/hwmon/pmbus/ltc3815.c
> +++ b/drivers/hwmon/pmbus/ltc3815.c
> @@ -143,7 +143,7 @@ static int ltc3815_write_word_data(struct i2c_client *client, int page,
>  }
>  
>  static const struct i2c_device_id ltc3815_id[] = {
> -	{"ltc3815", 0},
> +	{ .name = "ltc3815" },
>  	{ }
>  };
>  MODULE_DEVICE_TABLE(i2c, ltc3815_id);
> @@ -178,8 +178,7 @@ static struct pmbus_driver_info ltc3815_info = {
>  	.write_word_data = ltc3815_write_word_data,
>  };
>  
> -static int ltc3815_probe(struct i2c_client *client,
> -			 const struct i2c_device_id *id)
> +static int ltc3815_probe(struct i2c_client *client)
>  {
>  	int chip_id;
>  
> @@ -193,14 +192,14 @@ static int ltc3815_probe(struct i2c_client *client,
>  	if ((chip_id & LTC3815_ID_MASK) != LTC3815_ID)
>  		return -ENODEV;
>  
> -	return pmbus_do_probe(client, id, &ltc3815_info);
> +	return pmbus_do_probe(client, &ltc3815_info);
>  }
>  
>  static struct i2c_driver ltc3815_driver = {
>  	.driver = {
>  		   .name = "ltc3815",
>  		   },
> -	.probe = ltc3815_probe,
> +	.probe_new = ltc3815_probe,
>  	.remove = pmbus_do_remove,
>  	.id_table = ltc3815_id,
>  };
> diff --git a/drivers/hwmon/pmbus/max16064.c b/drivers/hwmon/pmbus/max16064.c
> index 288e93f74c28..e0efc7f6879d 100644
> --- a/drivers/hwmon/pmbus/max16064.c
> +++ b/drivers/hwmon/pmbus/max16064.c
> @@ -85,14 +85,13 @@ static struct pmbus_driver_info max16064_info = {
>  	.write_word_data = max16064_write_word_data,
>  };
>  
> -static int max16064_probe(struct i2c_client *client,
> -			  const struct i2c_device_id *id)
> +static int max16064_probe(struct i2c_client *client)
>  {
> -	return pmbus_do_probe(client, id, &max16064_info);
> +	return pmbus_do_probe(client, &max16064_info);
>  }
>  
>  static const struct i2c_device_id max16064_id[] = {
> -	{"max16064", 0},
> +	{ .name = "max16064" },
>  	{}
>  };
>  
> @@ -103,7 +102,7 @@ static struct i2c_driver max16064_driver = {
>  	.driver = {
>  		   .name = "max16064",
>  		   },
> -	.probe = max16064_probe,
> +	.probe_new = max16064_probe,
>  	.remove = pmbus_do_remove,
>  	.id_table = max16064_id,
>  };
> diff --git a/drivers/hwmon/pmbus/max16601.c b/drivers/hwmon/pmbus/max16601.c
> index 51cdfaf9023c..0d4049c29f9c 100644
> --- a/drivers/hwmon/pmbus/max16601.c
> +++ b/drivers/hwmon/pmbus/max16601.c
> @@ -239,8 +239,7 @@ static void max16601_remove(void *_data)
>  	i2c_unregister_device(data->vsa);
>  }
>  
> -static int max16601_probe(struct i2c_client *client,
> -			  const struct i2c_device_id *id)
> +static int max16601_probe(struct i2c_client *client)
>  {
>  	struct device *dev = &client->dev;
>  	u8 buf[I2C_SMBUS_BLOCK_MAX + 1];
> @@ -288,11 +287,11 @@ static int max16601_probe(struct i2c_client *client,
>  
>  	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[] = {
> -	{"max16601", 0},
> +	{ .name = "max16601" },
>  	{}
>  };
>  
> @@ -302,7 +301,7 @@ static struct i2c_driver max16601_driver = {
>  	.driver = {
>  		   .name = "max16601",
>  		   },
> -	.probe = max16601_probe,
> +	.probe_new = max16601_probe,
>  	.remove = pmbus_do_remove,
>  	.id_table = max16601_id,
>  };
> diff --git a/drivers/hwmon/pmbus/max20730.c b/drivers/hwmon/pmbus/max20730.c
> index c0bb05487e0e..0abcef2ac649 100644
> --- a/drivers/hwmon/pmbus/max20730.c
> +++ b/drivers/hwmon/pmbus/max20730.c
> @@ -335,7 +335,7 @@ static int max20730_probe(struct i2c_client *client,
>  		return 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[] = {
> diff --git a/drivers/hwmon/pmbus/max20751.c b/drivers/hwmon/pmbus/max20751.c
> index da3c38cb9a5c..8ab666969a77 100644
> --- a/drivers/hwmon/pmbus/max20751.c
> +++ b/drivers/hwmon/pmbus/max20751.c
> @@ -26,14 +26,13 @@ static struct pmbus_driver_info max20751_info = {
>  		PMBUS_HAVE_POUT,
>  };
>  
> -static int max20751_probe(struct i2c_client *client,
> -			  const struct i2c_device_id *id)
> +static int max20751_probe(struct i2c_client *client)
>  {
> -	return pmbus_do_probe(client, id, &max20751_info);
> +	return pmbus_do_probe(client, &max20751_info);
>  }
>  
>  static const struct i2c_device_id max20751_id[] = {
> -	{"max20751", 0},
> +	{ .name = "max20751" },
>  	{}
>  };
>  
> @@ -43,7 +42,7 @@ static struct i2c_driver max20751_driver = {
>  	.driver = {
>  		   .name = "max20751",
>  		   },
> -	.probe = max20751_probe,
> +	.probe_new = max20751_probe,
>  	.remove = pmbus_do_remove,
>  	.id_table = max20751_id,
>  };
> diff --git a/drivers/hwmon/pmbus/max31785.c b/drivers/hwmon/pmbus/max31785.c
> index d9aa5c873d21..3e77c79f3f42 100644
> --- a/drivers/hwmon/pmbus/max31785.c
> +++ b/drivers/hwmon/pmbus/max31785.c
> @@ -324,8 +324,7 @@ static int max31785_configure_dual_tach(struct i2c_client *client,
>  	return 0;
>  }
>  
> -static int max31785_probe(struct i2c_client *client,
> -			  const struct i2c_device_id *id)
> +static int max31785_probe(struct i2c_client *client)
>  {
>  	struct device *dev = &client->dev;
>  	struct pmbus_driver_info *info;
> @@ -354,7 +353,7 @@ static int max31785_probe(struct i2c_client *client,
>  	if (ret == MAX31785A) {
>  		dual_tach = true;
>  	} 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");
>  	} else {
>  		return -ENODEV;
> @@ -366,12 +365,12 @@ static int max31785_probe(struct i2c_client *client,
>  			return ret;
>  	}
>  
> -	return pmbus_do_probe(client, id, info);
> +	return pmbus_do_probe(client, info);
>  }
>  
>  static const struct i2c_device_id max31785_id[] = {
> -	{ "max31785", 0 },
> -	{ "max31785a", 0 },
> +	{ .name = "max31785" },
> +	{ .name = "max31785a" },
>  	{ },
>  };
>  
> @@ -390,7 +389,7 @@ static struct i2c_driver max31785_driver = {
>  		.name = "max31785",
>  		.of_match_table = max31785_of_match,
>  	},
> -	.probe = max31785_probe,
> +	.probe_new = max31785_probe,
>  	.remove = pmbus_do_remove,
>  	.id_table = max31785_id,
>  };
> diff --git a/drivers/hwmon/pmbus/max34440.c b/drivers/hwmon/pmbus/max34440.c
> index 18b4e071067f..0205983bd51f 100644
> --- a/drivers/hwmon/pmbus/max34440.c
> +++ b/drivers/hwmon/pmbus/max34440.c
> @@ -480,7 +480,7 @@ static int max34440_probe(struct i2c_client *client,
>  			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[] = {
> diff --git a/drivers/hwmon/pmbus/max8688.c b/drivers/hwmon/pmbus/max8688.c
> index 643ccfc05106..2efce192e6af 100644
> --- a/drivers/hwmon/pmbus/max8688.c
> +++ b/drivers/hwmon/pmbus/max8688.c
> @@ -165,14 +165,13 @@ static struct pmbus_driver_info max8688_info = {
>  	.write_word_data = max8688_write_word_data,
>  };
>  
> -static int max8688_probe(struct i2c_client *client,
> -			 const struct i2c_device_id *id)
> +static int max8688_probe(struct i2c_client *client)
>  {
> -	return pmbus_do_probe(client, id, &max8688_info);
> +	return pmbus_do_probe(client, &max8688_info);
>  }
>  
>  static const struct i2c_device_id max8688_id[] = {
> -	{"max8688", 0},
> +	{ .name = "max8688" },
>  	{ }
>  };
>  
> @@ -183,7 +182,7 @@ static struct i2c_driver max8688_driver = {
>  	.driver = {
>  		   .name = "max8688",
>  		   },
> -	.probe = max8688_probe,
> +	.probe_new = max8688_probe,
>  	.remove = pmbus_do_remove,
>  	.id_table = max8688_id,
>  };
> diff --git a/drivers/hwmon/pmbus/pmbus.c b/drivers/hwmon/pmbus/pmbus.c
> index 6d384e8ee1db..7742ce83c99f 100644
> --- a/drivers/hwmon/pmbus/pmbus.c
> +++ b/drivers/hwmon/pmbus/pmbus.c
> @@ -185,7 +185,7 @@ static int pmbus_probe(struct i2c_client *client,
>  	info->identify = pmbus_identify;
>  	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 = {
> diff --git a/drivers/hwmon/pmbus/pmbus.h b/drivers/hwmon/pmbus/pmbus.h
> index 18e06fc6c53f..1ff5314287cb 100644
> --- a/drivers/hwmon/pmbus/pmbus.h
> +++ b/drivers/hwmon/pmbus/pmbus.h
> @@ -476,8 +476,7 @@ int pmbus_update_byte_data(struct i2c_client *client, int page, u8 reg,
>  void pmbus_clear_faults(struct i2c_client *client);
>  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);
> -int pmbus_do_probe(struct i2c_client *client, const struct i2c_device_id *id,
> -		   struct pmbus_driver_info *info);
> +int pmbus_do_probe(struct i2c_client *client, struct pmbus_driver_info *info);
>  int pmbus_do_remove(struct i2c_client *client);
>  const struct pmbus_driver_info *pmbus_get_driver_info(struct i2c_client
>  						      *client);
> diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
> index 2191575a448b..065a81f6545d 100644
> --- a/drivers/hwmon/pmbus/pmbus_core.c
> +++ b/drivers/hwmon/pmbus/pmbus_core.c
> @@ -2492,8 +2492,7 @@ static int pmbus_init_debugfs(struct i2c_client *client,
>  }
>  #endif	/* IS_ENABLED(CONFIG_DEBUG_FS) */
>  
> -int pmbus_do_probe(struct i2c_client *client, const struct i2c_device_id *id,
> -		   struct pmbus_driver_info *info)
> +int pmbus_do_probe(struct i2c_client *client, struct pmbus_driver_info *info)
>  {
>  	struct device *dev = &client->dev;
>  	const struct pmbus_platform_data *pdata = dev_get_platdata(dev);
> diff --git a/drivers/hwmon/pmbus/pxe1610.c b/drivers/hwmon/pmbus/pxe1610.c
> index 517584cff3de..732958b2f6b7 100644
> --- a/drivers/hwmon/pmbus/pxe1610.c
> +++ b/drivers/hwmon/pmbus/pxe1610.c
> @@ -78,8 +78,7 @@ static struct pmbus_driver_info pxe1610_info = {
>  	.identify = pxe1610_identify,
>  };
>  
> -static int pxe1610_probe(struct i2c_client *client,
> -			  const struct i2c_device_id *id)
> +static int pxe1610_probe(struct i2c_client *client)
>  {
>  	struct pmbus_driver_info *info;
>  	u8 buf[I2C_SMBUS_BLOCK_MAX];
> @@ -115,13 +114,13 @@ static int pxe1610_probe(struct i2c_client *client,
>  	if (!info)
>  		return -ENOMEM;
>  
> -	return pmbus_do_probe(client, id, info);
> +	return pmbus_do_probe(client, info);
>  }
>  
>  static const struct i2c_device_id pxe1610_id[] = {
> -	{"pxe1610", 0},
> -	{"pxe1110", 0},
> -	{"pxm1310", 0},
> +	{ .name = "pxe1610" },
> +	{ .name = "pxe1110" },
> +	{ .name = "pxm1310" },
>  	{}
>  };
>  
> @@ -131,7 +130,7 @@ static struct i2c_driver pxe1610_driver = {
>  	.driver = {
>  			.name = "pxe1610",
>  			},
> -	.probe = pxe1610_probe,
> +	.probe_new = pxe1610_probe,
>  	.remove = pmbus_do_remove,
>  	.id_table = pxe1610_id,
>  };
> diff --git a/drivers/hwmon/pmbus/tps40422.c b/drivers/hwmon/pmbus/tps40422.c
> index 2b83dcda964a..d265178c7689 100644
> --- a/drivers/hwmon/pmbus/tps40422.c
> +++ b/drivers/hwmon/pmbus/tps40422.c
> @@ -25,14 +25,13 @@ static struct pmbus_driver_info tps40422_info = {
>  		| PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT,
>  };
>  
> -static int tps40422_probe(struct i2c_client *client,
> -			  const struct i2c_device_id *id)
> +static int tps40422_probe(struct i2c_client *client)
>  {
> -	return pmbus_do_probe(client, id, &tps40422_info);
> +	return pmbus_do_probe(client, &tps40422_info);
>  }
>  
>  static const struct i2c_device_id tps40422_id[] = {
> -	{"tps40422", 0},
> +	{ .name = "tps40422" },
>  	{}
>  };
>  
> @@ -43,7 +42,7 @@ static struct i2c_driver tps40422_driver = {
>  	.driver = {
>  		   .name = "tps40422",
>  		   },
> -	.probe = tps40422_probe,
> +	.probe_new = tps40422_probe,
>  	.remove = pmbus_do_remove,
>  	.id_table = tps40422_id,
>  };
> diff --git a/drivers/hwmon/pmbus/tps53679.c b/drivers/hwmon/pmbus/tps53679.c
> index 157c99ffb52b..30832d71102f 100644
> --- a/drivers/hwmon/pmbus/tps53679.c
> +++ b/drivers/hwmon/pmbus/tps53679.c
> @@ -220,7 +220,7 @@ static int tps53679_probe(struct i2c_client *client,
>  		return -ENODEV;
>  	}
>  
> -	return pmbus_do_probe(client, id, info);
> +	return pmbus_do_probe(client, info);
>  }
>  
>  static const struct i2c_device_id tps53679_id[] = {
> diff --git a/drivers/hwmon/pmbus/ucd9000.c b/drivers/hwmon/pmbus/ucd9000.c
> index 81f4c4f166cd..d4c74e21c9d2 100644
> --- a/drivers/hwmon/pmbus/ucd9000.c
> +++ b/drivers/hwmon/pmbus/ucd9000.c
> @@ -603,7 +603,7 @@ static int ucd9000_probe(struct i2c_client *client,
>  
>  	ucd9000_probe_gpio(client, mid, data);
>  
> -	ret = pmbus_do_probe(client, mid, info);
> +	ret = pmbus_do_probe(client, info);
>  	if (ret)
>  		return ret;
>  
> diff --git a/drivers/hwmon/pmbus/ucd9200.c b/drivers/hwmon/pmbus/ucd9200.c
> index 7c04745a9709..58633bb495fb 100644
> --- a/drivers/hwmon/pmbus/ucd9200.c
> +++ b/drivers/hwmon/pmbus/ucd9200.c
> @@ -192,7 +192,7 @@ static int ucd9200_probe(struct i2c_client *client,
>  	if (mid->driver_data == ucd9240)
>  		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 */
> diff --git a/drivers/hwmon/pmbus/xdpe12284.c b/drivers/hwmon/pmbus/xdpe12284.c
> index d5103fc9e269..c05bc13552a7 100644
> --- a/drivers/hwmon/pmbus/xdpe12284.c
> +++ b/drivers/hwmon/pmbus/xdpe12284.c
> @@ -127,8 +127,7 @@ static struct pmbus_driver_info xdpe122_info = {
>  	.read_word_data = xdpe122_read_word_data,
>  };
>  
> -static int xdpe122_probe(struct i2c_client *client,
> -			 const struct i2c_device_id *id)
> +static int xdpe122_probe(struct i2c_client *client)
>  {
>  	struct pmbus_driver_info *info;
>  
> @@ -137,12 +136,12 @@ static int xdpe122_probe(struct i2c_client *client,
>  	if (!info)
>  		return -ENOMEM;
>  
> -	return pmbus_do_probe(client, id, info);
> +	return pmbus_do_probe(client, info);
>  }
>  
>  static const struct i2c_device_id xdpe122_id[] = {
> -	{"xdpe12254", 0},
> -	{"xdpe12284", 0},
> +	{ .name = "xdpe12254" },
> +	{ .name = "xdpe12284" },
>  	{}
>  };
>  
> @@ -160,7 +159,7 @@ static struct i2c_driver xdpe122_driver = {
>  		.name = "xdpe12284",
>  		.of_match_table = of_match_ptr(xdpe122_of_match),
>  	},
> -	.probe = xdpe122_probe,
> +	.probe_new = xdpe122_probe,
>  	.remove = pmbus_do_remove,
>  	.id_table = xdpe122_id,
>  };
> diff --git a/drivers/hwmon/pmbus/zl6100.c b/drivers/hwmon/pmbus/zl6100.c
> index 3a827d0a881d..24b1b0f46a40 100644
> --- a/drivers/hwmon/pmbus/zl6100.c
> +++ b/drivers/hwmon/pmbus/zl6100.c
> @@ -389,7 +389,7 @@ static int zl6100_probe(struct i2c_client *client,
>  	info->write_word_data = zl6100_write_word_data;
>  	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 = {
> 
> base-commit: bcf876870b95592b52519ed4aafcf9d95999bc9c
>
Stephen Kitt Aug. 6, 2020, 8:12 p.m. UTC | #2
On Thu, 6 Aug 2020 12:15:55 -0700, Guenter Roeck <linux@roeck-us.net> wrote:
> On 8/6/20 9:16 AM, Stephen Kitt wrote:
> > 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 which
> > don't use the id information either.
> > 
> > This avoids scanning the identifier tables during probes.
> > 
> > Additionally, in cases where the id information (driver_data) isn't
> > used, the corresponding declarations are removed from the id_table,
> > and .name is specified explicitly.
> >   
> 
> The ultimate idea seems to be to remove the "old" i2c probe function
> entirely. This means we'll have to touch the various drivers again
> to make that happen if they are not converted to probe_new.
> 
> With that in mind, since we are at it, why not use probe_new() in
> every driver and call i2c_match_id() in cases where it is actually
> needed/used ?

Yes, I was planning on doing that in a second phase, but I can do it right
now (perhaps as a patch series) if that would be better.

> Also, I am not convinced that replacements such as
> 
> -	{ "ipsps1", 0 },
> +	{ .name = "ipsps1" },
> 
> are an improvement. I would suggest to leave that alone for
> consistency (and to make it easier to add more devices to the
> various drivers if that happens in the future).

From reading through all the drivers using id_table, it seems to me that we
could do away with driver_data altogether and move all that to driver-local
structures, in many cases covering more than just an id. By only initialising
the elements of the structure that are really needed, I was hoping to (a)
make it more obvious that driver_data isn’t used, and (b) allow removing it
without touching all the code again.

Regards,

Stephen
Guenter Roeck Aug. 6, 2020, 9:48 p.m. UTC | #3
On 8/6/20 1:12 PM, Stephen Kitt wrote:
> On Thu, 6 Aug 2020 12:15:55 -0700, Guenter Roeck <linux@roeck-us.net> wrote:
>> On 8/6/20 9:16 AM, Stephen Kitt wrote:
>>> 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 which
>>> don't use the id information either.
>>>
>>> This avoids scanning the identifier tables during probes.
>>>
>>> Additionally, in cases where the id information (driver_data) isn't
>>> used, the corresponding declarations are removed from the id_table,
>>> and .name is specified explicitly.
>>>   
>>
>> The ultimate idea seems to be to remove the "old" i2c probe function
>> entirely. This means we'll have to touch the various drivers again
>> to make that happen if they are not converted to probe_new.
>>
>> With that in mind, since we are at it, why not use probe_new() in
>> every driver and call i2c_match_id() in cases where it is actually
>> needed/used ?
> 
> Yes, I was planning on doing that in a second phase, but I can do it right
> now (perhaps as a patch series) if that would be better.
> 
>> Also, I am not convinced that replacements such as
>>
>> -	{ "ipsps1", 0 },
>> +	{ .name = "ipsps1" },
>>
>> are an improvement. I would suggest to leave that alone for
>> consistency (and to make it easier to add more devices to the
>> various drivers if that happens in the future).
> 
> From reading through all the drivers using id_table, it seems to me that we
> could do away with driver_data altogether and move all that to driver-local
> structures, in many cases covering more than just an id. By only initialising
> the elements of the structure that are really needed, I was hoping to (a)
> make it more obvious that driver_data isn’t used, and (b) allow removing it
> without touching all the code again.
> 

I don't see it as an improvement to replace a common data structure with
per-driver data structures. That sounds too much like "let's re-invent
the wheel over and over again". If that is where things are going, I'd
rather have it implemented everywhere else first. I am ok with the other
changes, but not with this.

Guenter
kernel test robot Aug. 6, 2020, 9:57 p.m. UTC | #4
Hi Stephen,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on bcf876870b95592b52519ed4aafcf9d95999bc9c]

url:    https://github.com/0day-ci/linux/commits/Stephen-Kitt/hwmon-pmbus-use-simple-i2c-probe-function/20200807-024648
base:    bcf876870b95592b52519ed4aafcf9d95999bc9c
config: x86_64-randconfig-a013-20200806 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 076b120bebfd727b502208601012a44ab2e1028e)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> drivers/hwmon/pmbus/adm1275.c:794:36: error: too many arguments to function call, expected 2, have 3
           return pmbus_do_probe(client, id, info);
                  ~~~~~~~~~~~~~~             ^~~~
   drivers/hwmon/pmbus/pmbus.h:479:5: note: 'pmbus_do_probe' declared here
   int pmbus_do_probe(struct i2c_client *client, struct pmbus_driver_info *info);
       ^
   1 error generated.

vim +794 drivers/hwmon/pmbus/adm1275.c

87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  464  
83f7649c52871d drivers/hwmon/adm1275.c       Guenter Roeck                           2011-03-17  465  static int adm1275_probe(struct i2c_client *client,
83f7649c52871d drivers/hwmon/adm1275.c       Guenter Roeck                           2011-03-17  466  			 const struct i2c_device_id *id)
83f7649c52871d drivers/hwmon/adm1275.c       Guenter Roeck                           2011-03-17  467  {
6d1d41c075a1a5 drivers/hwmon/pmbus/adm1275.c Chu Lin                                 2020-07-09  468  	s32 (*config_read_fn)(const struct i2c_client *client, u8 reg);
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  469  	u8 block_buffer[I2C_SMBUS_BLOCK_MAX + 1];
c5e6763667ffc9 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-08-02  470  	int config, device_config;
3b33ca41227a54 drivers/hwmon/adm1275.c       Guenter Roeck                           2011-06-30  471  	int ret;
83f7649c52871d drivers/hwmon/adm1275.c       Guenter Roeck                           2011-03-17  472  	struct pmbus_driver_info *info;
c5e6763667ffc9 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-08-02  473  	struct adm1275_data *data;
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  474  	const struct i2c_device_id *mid;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  475  	const struct coefficients *coefficients;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  476  	int vindex = -1, voindex = -1, cindex = -1, pindex = -1;
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  477  	int tindex = -1;
6e5c06ad94115e drivers/hwmon/pmbus/adm1275.c Kun Yi                                  2018-10-17  478  	u32 shunt;
83f7649c52871d drivers/hwmon/adm1275.c       Guenter Roeck                           2011-03-17  479  
83f7649c52871d drivers/hwmon/adm1275.c       Guenter Roeck                           2011-03-17  480  	if (!i2c_check_functionality(client->adapter,
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  481  				     I2C_FUNC_SMBUS_READ_BYTE_DATA
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  482  				     | I2C_FUNC_SMBUS_BLOCK_DATA))
83f7649c52871d drivers/hwmon/adm1275.c       Guenter Roeck                           2011-03-17  483  		return -ENODEV;
83f7649c52871d drivers/hwmon/adm1275.c       Guenter Roeck                           2011-03-17  484  
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  485  	ret = i2c_smbus_read_block_data(client, PMBUS_MFR_ID, block_buffer);
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  486  	if (ret < 0) {
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  487  		dev_err(&client->dev, "Failed to read Manufacturer ID\n");
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  488  		return ret;
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  489  	}
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  490  	if (ret != 3 || strncmp(block_buffer, "ADI", 3)) {
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  491  		dev_err(&client->dev, "Unsupported Manufacturer ID\n");
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  492  		return -ENODEV;
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  493  	}
83f7649c52871d drivers/hwmon/adm1275.c       Guenter Roeck                           2011-03-17  494  
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  495  	ret = i2c_smbus_read_block_data(client, PMBUS_MFR_MODEL, block_buffer);
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  496  	if (ret < 0) {
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  497  		dev_err(&client->dev, "Failed to read Manufacturer Model\n");
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  498  		return ret;
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  499  	}
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  500  	for (mid = adm1275_id; mid->name[0]; mid++) {
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  501  		if (!strncasecmp(mid->name, block_buffer, strlen(mid->name)))
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  502  			break;
3b33ca41227a54 drivers/hwmon/adm1275.c       Guenter Roeck                           2011-06-30  503  	}
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  504  	if (!mid->name[0]) {
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  505  		dev_err(&client->dev, "Unsupported device\n");
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  506  		return -ENODEV;
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  507  	}
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  508  
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  509  	if (id->driver_data != mid->driver_data)
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  510  		dev_notice(&client->dev,
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  511  			   "Device mismatch: Configured %s, detected %s\n",
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  512  			   id->name, mid->name);
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  513  
6d1d41c075a1a5 drivers/hwmon/pmbus/adm1275.c Chu Lin                                 2020-07-09  514  	if (mid->driver_data == adm1272 || mid->driver_data == adm1278 ||
6d1d41c075a1a5 drivers/hwmon/pmbus/adm1275.c Chu Lin                                 2020-07-09  515  	    mid->driver_data == adm1293 || mid->driver_data == adm1294)
6d1d41c075a1a5 drivers/hwmon/pmbus/adm1275.c Chu Lin                                 2020-07-09  516  		config_read_fn = i2c_smbus_read_word_data;
6d1d41c075a1a5 drivers/hwmon/pmbus/adm1275.c Chu Lin                                 2020-07-09  517  	else
6d1d41c075a1a5 drivers/hwmon/pmbus/adm1275.c Chu Lin                                 2020-07-09  518  		config_read_fn = i2c_smbus_read_byte_data;
6d1d41c075a1a5 drivers/hwmon/pmbus/adm1275.c Chu Lin                                 2020-07-09  519  	config = config_read_fn(client, ADM1275_PMON_CONFIG);
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  520  	if (config < 0)
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  521  		return config;
83f7649c52871d drivers/hwmon/adm1275.c       Guenter Roeck                           2011-03-17  522  
6d1d41c075a1a5 drivers/hwmon/pmbus/adm1275.c Chu Lin                                 2020-07-09  523  	device_config = config_read_fn(client, ADM1275_DEVICE_CONFIG);
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  524  	if (device_config < 0)
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  525  		return device_config;
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  526  
8b313ca7f1b982 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2012-02-22  527  	data = devm_kzalloc(&client->dev, sizeof(struct adm1275_data),
8b313ca7f1b982 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2012-02-22  528  			    GFP_KERNEL);
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  529  	if (!data)
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  530  		return -ENOMEM;
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  531  
6e5c06ad94115e drivers/hwmon/pmbus/adm1275.c Kun Yi                                  2018-10-17  532  	if (of_property_read_u32(client->dev.of_node,
6e5c06ad94115e drivers/hwmon/pmbus/adm1275.c Kun Yi                                  2018-10-17  533  				 "shunt-resistor-micro-ohms", &shunt))
6e5c06ad94115e drivers/hwmon/pmbus/adm1275.c Kun Yi                                  2018-10-17  534  		shunt = 1000; /* 1 mOhm if not set via DT */
6e5c06ad94115e drivers/hwmon/pmbus/adm1275.c Kun Yi                                  2018-10-17  535  
6e5c06ad94115e drivers/hwmon/pmbus/adm1275.c Kun Yi                                  2018-10-17  536  	if (shunt == 0)
6e5c06ad94115e drivers/hwmon/pmbus/adm1275.c Kun Yi                                  2018-10-17  537  		return -EINVAL;
6e5c06ad94115e drivers/hwmon/pmbus/adm1275.c Kun Yi                                  2018-10-17  538  
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  539  	data->id = mid->driver_data;
c5e6763667ffc9 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-08-02  540  
c5e6763667ffc9 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-08-02  541  	info = &data->info;
c5e6763667ffc9 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-08-02  542  
83f7649c52871d drivers/hwmon/adm1275.c       Guenter Roeck                           2011-03-17  543  	info->pages = 1;
1061d8518f8bde drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-06-25  544  	info->format[PSC_VOLTAGE_IN] = direct;
1061d8518f8bde drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-06-25  545  	info->format[PSC_VOLTAGE_OUT] = direct;
1061d8518f8bde drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-06-25  546  	info->format[PSC_CURRENT_OUT] = direct;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  547  	info->format[PSC_POWER] = direct;
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  548  	info->format[PSC_TEMPERATURE] = direct;
c83529c17e1204 drivers/hwmon/pmbus/adm1275.c Adamski, Krzysztof (Nokia - PL/Wroclaw  2019-05-29  549) 	info->func[0] = PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT |
c83529c17e1204 drivers/hwmon/pmbus/adm1275.c Adamski, Krzysztof (Nokia - PL/Wroclaw  2019-05-29  550) 			PMBUS_HAVE_SAMPLES;
83f7649c52871d drivers/hwmon/adm1275.c       Guenter Roeck                           2011-03-17  551  
c576e30cd0c981 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-07-09  552  	info->read_word_data = adm1275_read_word_data;
c5e6763667ffc9 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-08-02  553  	info->read_byte_data = adm1275_read_byte_data;
c576e30cd0c981 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-07-09  554  	info->write_word_data = adm1275_write_word_data;
c576e30cd0c981 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-07-09  555  
9048539b7cd6ca drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  556  	switch (data->id) {
9048539b7cd6ca drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  557  	case adm1075:
c5e6763667ffc9 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-08-02  558  		if (device_config & ADM1275_IOUT_WARN2_SELECT)
c5e6763667ffc9 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-08-02  559  			data->have_oc_fault = true;
9048539b7cd6ca drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  560  		else
9048539b7cd6ca drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  561  			data->have_uc_fault = true;
9048539b7cd6ca drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  562  		data->have_pin_max = true;
9048539b7cd6ca drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  563  		data->have_vaux_status = true;
c5e6763667ffc9 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-08-02  564  
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  565  		coefficients = adm1075_coefficients;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  566  		vindex = 0;
927112696654f4 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2012-02-24  567  		switch (config & ADM1075_IRANGE_MASK) {
927112696654f4 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2012-02-24  568  		case ADM1075_IRANGE_25:
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  569  			cindex = 1;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  570  			pindex = 3;
927112696654f4 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2012-02-24  571  			break;
927112696654f4 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2012-02-24  572  		case ADM1075_IRANGE_50:
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  573  			cindex = 2;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  574  			pindex = 4;
927112696654f4 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2012-02-24  575  			break;
927112696654f4 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2012-02-24  576  		default:
927112696654f4 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2012-02-24  577  			dev_err(&client->dev, "Invalid input current range");
927112696654f4 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2012-02-24  578  			break;
927112696654f4 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2012-02-24  579  		}
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  580  
927112696654f4 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2012-02-24  581  		info->func[0] |= PMBUS_HAVE_VIN | PMBUS_HAVE_PIN
927112696654f4 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2012-02-24  582  		  | PMBUS_HAVE_STATUS_INPUT;
927112696654f4 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2012-02-24  583  		if (config & ADM1275_VIN_VOUT_SELECT)
927112696654f4 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2012-02-24  584  			info->func[0] |=
927112696654f4 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2012-02-24  585  			  PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT;
927112696654f4 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2012-02-24  586  		break;
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  587  	case adm1272:
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  588  		data->have_vout = true;
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  589  		data->have_pin_max = true;
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  590  		data->have_temp_max = true;
7d45deb31bec39 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2019-06-12  591  		data->have_power_sampling = true;
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  592  
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  593  		coefficients = adm1272_coefficients;
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  594  		vindex = (config & ADM1275_VRANGE) ? 1 : 0;
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  595  		cindex = (config & ADM1272_IRANGE) ? 3 : 2;
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  596  		/* pindex depends on the combination of the above */
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  597  		switch (config & (ADM1275_VRANGE | ADM1272_IRANGE)) {
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  598  		case 0:
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  599  		default:
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  600  			pindex = 4;
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  601  			break;
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  602  		case ADM1275_VRANGE:
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  603  			pindex = 5;
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  604  			break;
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  605  		case ADM1272_IRANGE:
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  606  			pindex = 6;
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  607  			break;
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  608  		case ADM1275_VRANGE | ADM1272_IRANGE:
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  609  			pindex = 7;
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  610  			break;
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  611  		}
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  612  		tindex = 8;
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  613  
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  614  		info->func[0] |= PMBUS_HAVE_PIN | PMBUS_HAVE_STATUS_INPUT |
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  615  			PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT;
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  616  
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  617  		/* Enable VOUT if not enabled (it is disabled by default) */
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  618  		if (!(config & ADM1278_VOUT_EN)) {
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  619  			config |= ADM1278_VOUT_EN;
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  620  			ret = i2c_smbus_write_byte_data(client,
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  621  							ADM1275_PMON_CONFIG,
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  622  							config);
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  623  			if (ret < 0) {
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  624  				dev_err(&client->dev,
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  625  					"Failed to enable VOUT monitoring\n");
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  626  				return -ENODEV;
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  627  			}
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  628  		}
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  629  
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  630  		if (config & ADM1278_TEMP1_EN)
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  631  			info->func[0] |=
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  632  				PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP;
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  633  		if (config & ADM1278_VIN_EN)
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  634  			info->func[0] |= PMBUS_HAVE_VIN;
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  635  		break;
5cf231a346fb80 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-07-14  636  	case adm1275:
9048539b7cd6ca drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  637  		if (device_config & ADM1275_IOUT_WARN2_SELECT)
9048539b7cd6ca drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  638  			data->have_oc_fault = true;
9048539b7cd6ca drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  639  		else
9048539b7cd6ca drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  640  			data->have_uc_fault = true;
9048539b7cd6ca drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  641  		data->have_vout = true;
9048539b7cd6ca drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  642  
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  643  		coefficients = adm1275_coefficients;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  644  		vindex = (config & ADM1275_VRANGE) ? 0 : 1;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  645  		cindex = 2;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  646  
83f7649c52871d drivers/hwmon/adm1275.c       Guenter Roeck                           2011-03-17  647  		if (config & ADM1275_VIN_VOUT_SELECT)
5cf231a346fb80 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-07-14  648  			info->func[0] |=
5cf231a346fb80 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-07-14  649  			  PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT;
83f7649c52871d drivers/hwmon/adm1275.c       Guenter Roeck                           2011-03-17  650  		else
5cf231a346fb80 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-07-14  651  			info->func[0] |=
5cf231a346fb80 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-07-14  652  			  PMBUS_HAVE_VIN | PMBUS_HAVE_STATUS_INPUT;
5cf231a346fb80 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-07-14  653  		break;
5cf231a346fb80 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-07-14  654  	case adm1276:
9048539b7cd6ca drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  655  		if (device_config & ADM1275_IOUT_WARN2_SELECT)
9048539b7cd6ca drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  656  			data->have_oc_fault = true;
9048539b7cd6ca drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  657  		else
9048539b7cd6ca drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  658  			data->have_uc_fault = true;
9048539b7cd6ca drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  659  		data->have_vout = true;
9048539b7cd6ca drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  660  		data->have_pin_max = true;
9048539b7cd6ca drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  661  
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  662  		coefficients = adm1276_coefficients;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  663  		vindex = (config & ADM1275_VRANGE) ? 0 : 1;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  664  		cindex = 2;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  665  		pindex = (config & ADM1275_VRANGE) ? 3 : 4;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  666  
5cf231a346fb80 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-07-14  667  		info->func[0] |= PMBUS_HAVE_VIN | PMBUS_HAVE_PIN
5cf231a346fb80 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-07-14  668  		  | PMBUS_HAVE_STATUS_INPUT;
5cf231a346fb80 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-07-14  669  		if (config & ADM1275_VIN_VOUT_SELECT)
5cf231a346fb80 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-07-14  670  			info->func[0] |=
5cf231a346fb80 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-07-14  671  			  PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT;
5cf231a346fb80 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-07-14  672  		break;
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  673  	case adm1278:
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  674  		data->have_vout = true;
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  675  		data->have_pin_max = true;
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  676  		data->have_temp_max = true;
7d45deb31bec39 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2019-06-12  677  		data->have_power_sampling = true;
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  678  
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  679  		coefficients = adm1278_coefficients;
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  680  		vindex = 0;
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  681  		cindex = 1;
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  682  		pindex = 2;
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  683  		tindex = 3;
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  684  
2b3d0c19537c1b drivers/hwmon/pmbus/adm1275.c Yi Li                                   2016-10-17  685  		info->func[0] |= PMBUS_HAVE_PIN | PMBUS_HAVE_STATUS_INPUT |
2b3d0c19537c1b drivers/hwmon/pmbus/adm1275.c Yi Li                                   2016-10-17  686  			PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT;
2b3d0c19537c1b drivers/hwmon/pmbus/adm1275.c Yi Li                                   2016-10-17  687  
2b3d0c19537c1b drivers/hwmon/pmbus/adm1275.c Yi Li                                   2016-10-17  688  		/* Enable VOUT if not enabled (it is disabled by default) */
2b3d0c19537c1b drivers/hwmon/pmbus/adm1275.c Yi Li                                   2016-10-17  689  		if (!(config & ADM1278_VOUT_EN)) {
2b3d0c19537c1b drivers/hwmon/pmbus/adm1275.c Yi Li                                   2016-10-17  690  			config |= ADM1278_VOUT_EN;
2b3d0c19537c1b drivers/hwmon/pmbus/adm1275.c Yi Li                                   2016-10-17  691  			ret = i2c_smbus_write_byte_data(client,
2b3d0c19537c1b drivers/hwmon/pmbus/adm1275.c Yi Li                                   2016-10-17  692  							ADM1275_PMON_CONFIG,
2b3d0c19537c1b drivers/hwmon/pmbus/adm1275.c Yi Li                                   2016-10-17  693  							config);
2b3d0c19537c1b drivers/hwmon/pmbus/adm1275.c Yi Li                                   2016-10-17  694  			if (ret < 0) {
2b3d0c19537c1b drivers/hwmon/pmbus/adm1275.c Yi Li                                   2016-10-17  695  				dev_err(&client->dev,
2b3d0c19537c1b drivers/hwmon/pmbus/adm1275.c Yi Li                                   2016-10-17  696  					"Failed to enable VOUT monitoring\n");
2b3d0c19537c1b drivers/hwmon/pmbus/adm1275.c Yi Li                                   2016-10-17  697  				return -ENODEV;
2b3d0c19537c1b drivers/hwmon/pmbus/adm1275.c Yi Li                                   2016-10-17  698  			}
2b3d0c19537c1b drivers/hwmon/pmbus/adm1275.c Yi Li                                   2016-10-17  699  		}
2b3d0c19537c1b drivers/hwmon/pmbus/adm1275.c Yi Li                                   2016-10-17  700  
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  701  		if (config & ADM1278_TEMP1_EN)
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  702  			info->func[0] |=
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  703  				PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP;
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  704  		if (config & ADM1278_VIN_EN)
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  705  			info->func[0] |= PMBUS_HAVE_VIN;
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  706  		break;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  707  	case adm1293:
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  708  	case adm1294:
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  709  		data->have_iout_min = true;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  710  		data->have_pin_min = true;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  711  		data->have_pin_max = true;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  712  		data->have_mfr_vaux_status = true;
7d45deb31bec39 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2019-06-12  713  		data->have_power_sampling = true;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  714  
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  715  		coefficients = adm1293_coefficients;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  716  
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  717  		voindex = 0;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  718  		switch (config & ADM1293_VIN_SEL_MASK) {
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  719  		case ADM1293_VIN_SEL_012:	/* 1.2V */
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  720  			vindex = 0;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  721  			break;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  722  		case ADM1293_VIN_SEL_074:	/* 7.4V */
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  723  			vindex = 1;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  724  			break;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  725  		case ADM1293_VIN_SEL_210:	/* 21V */
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  726  			vindex = 2;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  727  			break;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  728  		default:			/* disabled */
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  729  			break;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  730  		}
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  731  
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  732  		switch (config & ADM1293_IRANGE_MASK) {
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  733  		case ADM1293_IRANGE_25:
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  734  			cindex = 3;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  735  			break;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  736  		case ADM1293_IRANGE_50:
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  737  			cindex = 4;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  738  			break;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  739  		case ADM1293_IRANGE_100:
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  740  			cindex = 5;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  741  			break;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  742  		case ADM1293_IRANGE_200:
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  743  			cindex = 6;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  744  			break;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  745  		}
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  746  
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  747  		if (vindex >= 0)
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  748  			pindex = 7 + vindex * 4 + (cindex - 3);
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  749  
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  750  		if (config & ADM1293_VAUX_EN)
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  751  			info->func[0] |=
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  752  				PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  753  
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  754  		info->func[0] |= PMBUS_HAVE_PIN |
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  755  			PMBUS_HAVE_VIN | PMBUS_HAVE_STATUS_INPUT;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  756  
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  757  		break;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  758  	default:
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  759  		dev_err(&client->dev, "Unsupported device\n");
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  760  		return -ENODEV;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  761  	}
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  762  
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  763  	if (voindex < 0)
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  764  		voindex = vindex;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  765  	if (vindex >= 0) {
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  766  		info->m[PSC_VOLTAGE_IN] = coefficients[vindex].m;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  767  		info->b[PSC_VOLTAGE_IN] = coefficients[vindex].b;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  768  		info->R[PSC_VOLTAGE_IN] = coefficients[vindex].R;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  769  	}
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  770  	if (voindex >= 0) {
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  771  		info->m[PSC_VOLTAGE_OUT] = coefficients[voindex].m;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  772  		info->b[PSC_VOLTAGE_OUT] = coefficients[voindex].b;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  773  		info->R[PSC_VOLTAGE_OUT] = coefficients[voindex].R;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  774  	}
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  775  	if (cindex >= 0) {
6e5c06ad94115e drivers/hwmon/pmbus/adm1275.c Kun Yi                                  2018-10-17  776  		/* Scale current with sense resistor value */
6e5c06ad94115e drivers/hwmon/pmbus/adm1275.c Kun Yi                                  2018-10-17  777  		info->m[PSC_CURRENT_OUT] =
6e5c06ad94115e drivers/hwmon/pmbus/adm1275.c Kun Yi                                  2018-10-17  778  			coefficients[cindex].m * shunt / 1000;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  779  		info->b[PSC_CURRENT_OUT] = coefficients[cindex].b;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  780  		info->R[PSC_CURRENT_OUT] = coefficients[cindex].R;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  781  	}
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  782  	if (pindex >= 0) {
6e5c06ad94115e drivers/hwmon/pmbus/adm1275.c Kun Yi                                  2018-10-17  783  		info->m[PSC_POWER] =
6e5c06ad94115e drivers/hwmon/pmbus/adm1275.c Kun Yi                                  2018-10-17  784  			coefficients[pindex].m * shunt / 1000;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  785  		info->b[PSC_POWER] = coefficients[pindex].b;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  786  		info->R[PSC_POWER] = coefficients[pindex].R;
5cf231a346fb80 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-07-14  787  	}
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  788  	if (tindex >= 0) {
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  789  		info->m[PSC_TEMPERATURE] = coefficients[tindex].m;
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  790  		info->b[PSC_TEMPERATURE] = coefficients[tindex].b;
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  791  		info->R[PSC_TEMPERATURE] = coefficients[tindex].R;
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  792  	}
83f7649c52871d drivers/hwmon/adm1275.c       Guenter Roeck                           2011-03-17  793  
8b313ca7f1b982 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2012-02-22 @794  	return pmbus_do_probe(client, id, info);
83f7649c52871d drivers/hwmon/adm1275.c       Guenter Roeck                           2011-03-17  795  }
83f7649c52871d drivers/hwmon/adm1275.c       Guenter Roeck                           2011-03-17  796  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
kernel test robot Aug. 6, 2020, 11:01 p.m. UTC | #5
Hi Stephen,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on bcf876870b95592b52519ed4aafcf9d95999bc9c]

url:    https://github.com/0day-ci/linux/commits/Stephen-Kitt/hwmon-pmbus-use-simple-i2c-probe-function/20200807-024648
base:    bcf876870b95592b52519ed4aafcf9d95999bc9c
config: m68k-randconfig-r032-20200805 (attached as .config)
compiler: m68k-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=m68k 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/hwmon/pmbus/adm1275.c: In function 'adm1275_probe':
>> drivers/hwmon/pmbus/adm1275.c:794:32: error: passing argument 2 of 'pmbus_do_probe' from incompatible pointer type [-Werror=incompatible-pointer-types]
     794 |  return pmbus_do_probe(client, id, info);
         |                                ^~
         |                                |
         |                                const struct i2c_device_id *
   In file included from drivers/hwmon/pmbus/adm1275.c:19:
   drivers/hwmon/pmbus/pmbus.h:479:73: note: expected 'struct pmbus_driver_info *' but argument is of type 'const struct i2c_device_id *'
     479 | int pmbus_do_probe(struct i2c_client *client, struct pmbus_driver_info *info);
         |                                               ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
>> drivers/hwmon/pmbus/adm1275.c:794:9: error: too many arguments to function 'pmbus_do_probe'
     794 |  return pmbus_do_probe(client, id, info);
         |         ^~~~~~~~~~~~~~
   In file included from drivers/hwmon/pmbus/adm1275.c:19:
   drivers/hwmon/pmbus/pmbus.h:479:5: note: declared here
     479 | int pmbus_do_probe(struct i2c_client *client, struct pmbus_driver_info *info);
         |     ^~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +/pmbus_do_probe +794 drivers/hwmon/pmbus/adm1275.c

87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  464  
83f7649c52871d drivers/hwmon/adm1275.c       Guenter Roeck                           2011-03-17  465  static int adm1275_probe(struct i2c_client *client,
83f7649c52871d drivers/hwmon/adm1275.c       Guenter Roeck                           2011-03-17  466  			 const struct i2c_device_id *id)
83f7649c52871d drivers/hwmon/adm1275.c       Guenter Roeck                           2011-03-17  467  {
6d1d41c075a1a5 drivers/hwmon/pmbus/adm1275.c Chu Lin                                 2020-07-09  468  	s32 (*config_read_fn)(const struct i2c_client *client, u8 reg);
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  469  	u8 block_buffer[I2C_SMBUS_BLOCK_MAX + 1];
c5e6763667ffc9 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-08-02  470  	int config, device_config;
3b33ca41227a54 drivers/hwmon/adm1275.c       Guenter Roeck                           2011-06-30  471  	int ret;
83f7649c52871d drivers/hwmon/adm1275.c       Guenter Roeck                           2011-03-17  472  	struct pmbus_driver_info *info;
c5e6763667ffc9 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-08-02  473  	struct adm1275_data *data;
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  474  	const struct i2c_device_id *mid;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  475  	const struct coefficients *coefficients;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  476  	int vindex = -1, voindex = -1, cindex = -1, pindex = -1;
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  477  	int tindex = -1;
6e5c06ad94115e drivers/hwmon/pmbus/adm1275.c Kun Yi                                  2018-10-17  478  	u32 shunt;
83f7649c52871d drivers/hwmon/adm1275.c       Guenter Roeck                           2011-03-17  479  
83f7649c52871d drivers/hwmon/adm1275.c       Guenter Roeck                           2011-03-17  480  	if (!i2c_check_functionality(client->adapter,
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  481  				     I2C_FUNC_SMBUS_READ_BYTE_DATA
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  482  				     | I2C_FUNC_SMBUS_BLOCK_DATA))
83f7649c52871d drivers/hwmon/adm1275.c       Guenter Roeck                           2011-03-17  483  		return -ENODEV;
83f7649c52871d drivers/hwmon/adm1275.c       Guenter Roeck                           2011-03-17  484  
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  485  	ret = i2c_smbus_read_block_data(client, PMBUS_MFR_ID, block_buffer);
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  486  	if (ret < 0) {
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  487  		dev_err(&client->dev, "Failed to read Manufacturer ID\n");
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  488  		return ret;
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  489  	}
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  490  	if (ret != 3 || strncmp(block_buffer, "ADI", 3)) {
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  491  		dev_err(&client->dev, "Unsupported Manufacturer ID\n");
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  492  		return -ENODEV;
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  493  	}
83f7649c52871d drivers/hwmon/adm1275.c       Guenter Roeck                           2011-03-17  494  
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  495  	ret = i2c_smbus_read_block_data(client, PMBUS_MFR_MODEL, block_buffer);
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  496  	if (ret < 0) {
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  497  		dev_err(&client->dev, "Failed to read Manufacturer Model\n");
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  498  		return ret;
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  499  	}
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  500  	for (mid = adm1275_id; mid->name[0]; mid++) {
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  501  		if (!strncasecmp(mid->name, block_buffer, strlen(mid->name)))
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  502  			break;
3b33ca41227a54 drivers/hwmon/adm1275.c       Guenter Roeck                           2011-06-30  503  	}
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  504  	if (!mid->name[0]) {
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  505  		dev_err(&client->dev, "Unsupported device\n");
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  506  		return -ENODEV;
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  507  	}
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  508  
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  509  	if (id->driver_data != mid->driver_data)
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  510  		dev_notice(&client->dev,
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  511  			   "Device mismatch: Configured %s, detected %s\n",
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  512  			   id->name, mid->name);
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  513  
6d1d41c075a1a5 drivers/hwmon/pmbus/adm1275.c Chu Lin                                 2020-07-09  514  	if (mid->driver_data == adm1272 || mid->driver_data == adm1278 ||
6d1d41c075a1a5 drivers/hwmon/pmbus/adm1275.c Chu Lin                                 2020-07-09  515  	    mid->driver_data == adm1293 || mid->driver_data == adm1294)
6d1d41c075a1a5 drivers/hwmon/pmbus/adm1275.c Chu Lin                                 2020-07-09  516  		config_read_fn = i2c_smbus_read_word_data;
6d1d41c075a1a5 drivers/hwmon/pmbus/adm1275.c Chu Lin                                 2020-07-09  517  	else
6d1d41c075a1a5 drivers/hwmon/pmbus/adm1275.c Chu Lin                                 2020-07-09  518  		config_read_fn = i2c_smbus_read_byte_data;
6d1d41c075a1a5 drivers/hwmon/pmbus/adm1275.c Chu Lin                                 2020-07-09  519  	config = config_read_fn(client, ADM1275_PMON_CONFIG);
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  520  	if (config < 0)
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  521  		return config;
83f7649c52871d drivers/hwmon/adm1275.c       Guenter Roeck                           2011-03-17  522  
6d1d41c075a1a5 drivers/hwmon/pmbus/adm1275.c Chu Lin                                 2020-07-09  523  	device_config = config_read_fn(client, ADM1275_DEVICE_CONFIG);
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  524  	if (device_config < 0)
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  525  		return device_config;
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  526  
8b313ca7f1b982 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2012-02-22  527  	data = devm_kzalloc(&client->dev, sizeof(struct adm1275_data),
8b313ca7f1b982 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2012-02-22  528  			    GFP_KERNEL);
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  529  	if (!data)
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  530  		return -ENOMEM;
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  531  
6e5c06ad94115e drivers/hwmon/pmbus/adm1275.c Kun Yi                                  2018-10-17  532  	if (of_property_read_u32(client->dev.of_node,
6e5c06ad94115e drivers/hwmon/pmbus/adm1275.c Kun Yi                                  2018-10-17  533  				 "shunt-resistor-micro-ohms", &shunt))
6e5c06ad94115e drivers/hwmon/pmbus/adm1275.c Kun Yi                                  2018-10-17  534  		shunt = 1000; /* 1 mOhm if not set via DT */
6e5c06ad94115e drivers/hwmon/pmbus/adm1275.c Kun Yi                                  2018-10-17  535  
6e5c06ad94115e drivers/hwmon/pmbus/adm1275.c Kun Yi                                  2018-10-17  536  	if (shunt == 0)
6e5c06ad94115e drivers/hwmon/pmbus/adm1275.c Kun Yi                                  2018-10-17  537  		return -EINVAL;
6e5c06ad94115e drivers/hwmon/pmbus/adm1275.c Kun Yi                                  2018-10-17  538  
87102808d03948 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-09-30  539  	data->id = mid->driver_data;
c5e6763667ffc9 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-08-02  540  
c5e6763667ffc9 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-08-02  541  	info = &data->info;
c5e6763667ffc9 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-08-02  542  
83f7649c52871d drivers/hwmon/adm1275.c       Guenter Roeck                           2011-03-17  543  	info->pages = 1;
1061d8518f8bde drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-06-25  544  	info->format[PSC_VOLTAGE_IN] = direct;
1061d8518f8bde drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-06-25  545  	info->format[PSC_VOLTAGE_OUT] = direct;
1061d8518f8bde drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-06-25  546  	info->format[PSC_CURRENT_OUT] = direct;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  547  	info->format[PSC_POWER] = direct;
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  548  	info->format[PSC_TEMPERATURE] = direct;
c83529c17e1204 drivers/hwmon/pmbus/adm1275.c Adamski, Krzysztof (Nokia - PL/Wroclaw  2019-05-29  549) 	info->func[0] = PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT |
c83529c17e1204 drivers/hwmon/pmbus/adm1275.c Adamski, Krzysztof (Nokia - PL/Wroclaw  2019-05-29  550) 			PMBUS_HAVE_SAMPLES;
83f7649c52871d drivers/hwmon/adm1275.c       Guenter Roeck                           2011-03-17  551  
c576e30cd0c981 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-07-09  552  	info->read_word_data = adm1275_read_word_data;
c5e6763667ffc9 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-08-02  553  	info->read_byte_data = adm1275_read_byte_data;
c576e30cd0c981 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-07-09  554  	info->write_word_data = adm1275_write_word_data;
c576e30cd0c981 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-07-09  555  
9048539b7cd6ca drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  556  	switch (data->id) {
9048539b7cd6ca drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  557  	case adm1075:
c5e6763667ffc9 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-08-02  558  		if (device_config & ADM1275_IOUT_WARN2_SELECT)
c5e6763667ffc9 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-08-02  559  			data->have_oc_fault = true;
9048539b7cd6ca drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  560  		else
9048539b7cd6ca drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  561  			data->have_uc_fault = true;
9048539b7cd6ca drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  562  		data->have_pin_max = true;
9048539b7cd6ca drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  563  		data->have_vaux_status = true;
c5e6763667ffc9 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-08-02  564  
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  565  		coefficients = adm1075_coefficients;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  566  		vindex = 0;
927112696654f4 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2012-02-24  567  		switch (config & ADM1075_IRANGE_MASK) {
927112696654f4 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2012-02-24  568  		case ADM1075_IRANGE_25:
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  569  			cindex = 1;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  570  			pindex = 3;
927112696654f4 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2012-02-24  571  			break;
927112696654f4 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2012-02-24  572  		case ADM1075_IRANGE_50:
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  573  			cindex = 2;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  574  			pindex = 4;
927112696654f4 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2012-02-24  575  			break;
927112696654f4 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2012-02-24  576  		default:
927112696654f4 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2012-02-24  577  			dev_err(&client->dev, "Invalid input current range");
927112696654f4 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2012-02-24  578  			break;
927112696654f4 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2012-02-24  579  		}
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  580  
927112696654f4 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2012-02-24  581  		info->func[0] |= PMBUS_HAVE_VIN | PMBUS_HAVE_PIN
927112696654f4 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2012-02-24  582  		  | PMBUS_HAVE_STATUS_INPUT;
927112696654f4 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2012-02-24  583  		if (config & ADM1275_VIN_VOUT_SELECT)
927112696654f4 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2012-02-24  584  			info->func[0] |=
927112696654f4 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2012-02-24  585  			  PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT;
927112696654f4 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2012-02-24  586  		break;
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  587  	case adm1272:
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  588  		data->have_vout = true;
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  589  		data->have_pin_max = true;
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  590  		data->have_temp_max = true;
7d45deb31bec39 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2019-06-12  591  		data->have_power_sampling = true;
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  592  
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  593  		coefficients = adm1272_coefficients;
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  594  		vindex = (config & ADM1275_VRANGE) ? 1 : 0;
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  595  		cindex = (config & ADM1272_IRANGE) ? 3 : 2;
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  596  		/* pindex depends on the combination of the above */
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  597  		switch (config & (ADM1275_VRANGE | ADM1272_IRANGE)) {
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  598  		case 0:
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  599  		default:
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  600  			pindex = 4;
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  601  			break;
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  602  		case ADM1275_VRANGE:
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  603  			pindex = 5;
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  604  			break;
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  605  		case ADM1272_IRANGE:
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  606  			pindex = 6;
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  607  			break;
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  608  		case ADM1275_VRANGE | ADM1272_IRANGE:
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  609  			pindex = 7;
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  610  			break;
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  611  		}
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  612  		tindex = 8;
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  613  
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  614  		info->func[0] |= PMBUS_HAVE_PIN | PMBUS_HAVE_STATUS_INPUT |
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  615  			PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT;
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  616  
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  617  		/* Enable VOUT if not enabled (it is disabled by default) */
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  618  		if (!(config & ADM1278_VOUT_EN)) {
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  619  			config |= ADM1278_VOUT_EN;
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  620  			ret = i2c_smbus_write_byte_data(client,
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  621  							ADM1275_PMON_CONFIG,
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  622  							config);
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  623  			if (ret < 0) {
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  624  				dev_err(&client->dev,
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  625  					"Failed to enable VOUT monitoring\n");
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  626  				return -ENODEV;
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  627  			}
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  628  		}
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  629  
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  630  		if (config & ADM1278_TEMP1_EN)
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  631  			info->func[0] |=
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  632  				PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP;
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  633  		if (config & ADM1278_VIN_EN)
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  634  			info->func[0] |= PMBUS_HAVE_VIN;
4ff0ce227a1e65 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2018-03-10  635  		break;
5cf231a346fb80 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-07-14  636  	case adm1275:
9048539b7cd6ca drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  637  		if (device_config & ADM1275_IOUT_WARN2_SELECT)
9048539b7cd6ca drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  638  			data->have_oc_fault = true;
9048539b7cd6ca drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  639  		else
9048539b7cd6ca drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  640  			data->have_uc_fault = true;
9048539b7cd6ca drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  641  		data->have_vout = true;
9048539b7cd6ca drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  642  
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  643  		coefficients = adm1275_coefficients;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  644  		vindex = (config & ADM1275_VRANGE) ? 0 : 1;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  645  		cindex = 2;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  646  
83f7649c52871d drivers/hwmon/adm1275.c       Guenter Roeck                           2011-03-17  647  		if (config & ADM1275_VIN_VOUT_SELECT)
5cf231a346fb80 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-07-14  648  			info->func[0] |=
5cf231a346fb80 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-07-14  649  			  PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT;
83f7649c52871d drivers/hwmon/adm1275.c       Guenter Roeck                           2011-03-17  650  		else
5cf231a346fb80 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-07-14  651  			info->func[0] |=
5cf231a346fb80 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-07-14  652  			  PMBUS_HAVE_VIN | PMBUS_HAVE_STATUS_INPUT;
5cf231a346fb80 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-07-14  653  		break;
5cf231a346fb80 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-07-14  654  	case adm1276:
9048539b7cd6ca drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  655  		if (device_config & ADM1275_IOUT_WARN2_SELECT)
9048539b7cd6ca drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  656  			data->have_oc_fault = true;
9048539b7cd6ca drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  657  		else
9048539b7cd6ca drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  658  			data->have_uc_fault = true;
9048539b7cd6ca drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  659  		data->have_vout = true;
9048539b7cd6ca drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  660  		data->have_pin_max = true;
9048539b7cd6ca drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  661  
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  662  		coefficients = adm1276_coefficients;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  663  		vindex = (config & ADM1275_VRANGE) ? 0 : 1;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  664  		cindex = 2;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  665  		pindex = (config & ADM1275_VRANGE) ? 3 : 4;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  666  
5cf231a346fb80 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-07-14  667  		info->func[0] |= PMBUS_HAVE_VIN | PMBUS_HAVE_PIN
5cf231a346fb80 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-07-14  668  		  | PMBUS_HAVE_STATUS_INPUT;
5cf231a346fb80 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-07-14  669  		if (config & ADM1275_VIN_VOUT_SELECT)
5cf231a346fb80 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-07-14  670  			info->func[0] |=
5cf231a346fb80 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-07-14  671  			  PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT;
5cf231a346fb80 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-07-14  672  		break;
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  673  	case adm1278:
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  674  		data->have_vout = true;
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  675  		data->have_pin_max = true;
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  676  		data->have_temp_max = true;
7d45deb31bec39 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2019-06-12  677  		data->have_power_sampling = true;
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  678  
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  679  		coefficients = adm1278_coefficients;
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  680  		vindex = 0;
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  681  		cindex = 1;
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  682  		pindex = 2;
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  683  		tindex = 3;
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  684  
2b3d0c19537c1b drivers/hwmon/pmbus/adm1275.c Yi Li                                   2016-10-17  685  		info->func[0] |= PMBUS_HAVE_PIN | PMBUS_HAVE_STATUS_INPUT |
2b3d0c19537c1b drivers/hwmon/pmbus/adm1275.c Yi Li                                   2016-10-17  686  			PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT;
2b3d0c19537c1b drivers/hwmon/pmbus/adm1275.c Yi Li                                   2016-10-17  687  
2b3d0c19537c1b drivers/hwmon/pmbus/adm1275.c Yi Li                                   2016-10-17  688  		/* Enable VOUT if not enabled (it is disabled by default) */
2b3d0c19537c1b drivers/hwmon/pmbus/adm1275.c Yi Li                                   2016-10-17  689  		if (!(config & ADM1278_VOUT_EN)) {
2b3d0c19537c1b drivers/hwmon/pmbus/adm1275.c Yi Li                                   2016-10-17  690  			config |= ADM1278_VOUT_EN;
2b3d0c19537c1b drivers/hwmon/pmbus/adm1275.c Yi Li                                   2016-10-17  691  			ret = i2c_smbus_write_byte_data(client,
2b3d0c19537c1b drivers/hwmon/pmbus/adm1275.c Yi Li                                   2016-10-17  692  							ADM1275_PMON_CONFIG,
2b3d0c19537c1b drivers/hwmon/pmbus/adm1275.c Yi Li                                   2016-10-17  693  							config);
2b3d0c19537c1b drivers/hwmon/pmbus/adm1275.c Yi Li                                   2016-10-17  694  			if (ret < 0) {
2b3d0c19537c1b drivers/hwmon/pmbus/adm1275.c Yi Li                                   2016-10-17  695  				dev_err(&client->dev,
2b3d0c19537c1b drivers/hwmon/pmbus/adm1275.c Yi Li                                   2016-10-17  696  					"Failed to enable VOUT monitoring\n");
2b3d0c19537c1b drivers/hwmon/pmbus/adm1275.c Yi Li                                   2016-10-17  697  				return -ENODEV;
2b3d0c19537c1b drivers/hwmon/pmbus/adm1275.c Yi Li                                   2016-10-17  698  			}
2b3d0c19537c1b drivers/hwmon/pmbus/adm1275.c Yi Li                                   2016-10-17  699  		}
2b3d0c19537c1b drivers/hwmon/pmbus/adm1275.c Yi Li                                   2016-10-17  700  
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  701  		if (config & ADM1278_TEMP1_EN)
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  702  			info->func[0] |=
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  703  				PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP;
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  704  		if (config & ADM1278_VIN_EN)
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  705  			info->func[0] |= PMBUS_HAVE_VIN;
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  706  		break;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  707  	case adm1293:
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  708  	case adm1294:
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  709  		data->have_iout_min = true;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  710  		data->have_pin_min = true;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  711  		data->have_pin_max = true;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  712  		data->have_mfr_vaux_status = true;
7d45deb31bec39 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2019-06-12  713  		data->have_power_sampling = true;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  714  
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  715  		coefficients = adm1293_coefficients;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  716  
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  717  		voindex = 0;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  718  		switch (config & ADM1293_VIN_SEL_MASK) {
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  719  		case ADM1293_VIN_SEL_012:	/* 1.2V */
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  720  			vindex = 0;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  721  			break;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  722  		case ADM1293_VIN_SEL_074:	/* 7.4V */
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  723  			vindex = 1;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  724  			break;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  725  		case ADM1293_VIN_SEL_210:	/* 21V */
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  726  			vindex = 2;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  727  			break;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  728  		default:			/* disabled */
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  729  			break;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  730  		}
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  731  
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  732  		switch (config & ADM1293_IRANGE_MASK) {
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  733  		case ADM1293_IRANGE_25:
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  734  			cindex = 3;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  735  			break;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  736  		case ADM1293_IRANGE_50:
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  737  			cindex = 4;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  738  			break;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  739  		case ADM1293_IRANGE_100:
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  740  			cindex = 5;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  741  			break;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  742  		case ADM1293_IRANGE_200:
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  743  			cindex = 6;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  744  			break;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  745  		}
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  746  
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  747  		if (vindex >= 0)
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  748  			pindex = 7 + vindex * 4 + (cindex - 3);
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  749  
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  750  		if (config & ADM1293_VAUX_EN)
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  751  			info->func[0] |=
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  752  				PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  753  
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  754  		info->func[0] |= PMBUS_HAVE_PIN |
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  755  			PMBUS_HAVE_VIN | PMBUS_HAVE_STATUS_INPUT;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  756  
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  757  		break;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  758  	default:
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  759  		dev_err(&client->dev, "Unsupported device\n");
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  760  		return -ENODEV;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  761  	}
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  762  
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  763  	if (voindex < 0)
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  764  		voindex = vindex;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  765  	if (vindex >= 0) {
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  766  		info->m[PSC_VOLTAGE_IN] = coefficients[vindex].m;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  767  		info->b[PSC_VOLTAGE_IN] = coefficients[vindex].b;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  768  		info->R[PSC_VOLTAGE_IN] = coefficients[vindex].R;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  769  	}
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  770  	if (voindex >= 0) {
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  771  		info->m[PSC_VOLTAGE_OUT] = coefficients[voindex].m;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  772  		info->b[PSC_VOLTAGE_OUT] = coefficients[voindex].b;
68a403823600fc drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-03-17  773  		info->R[PSC_VOLTAGE_OUT] = coefficients[voindex].R;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  774  	}
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  775  	if (cindex >= 0) {
6e5c06ad94115e drivers/hwmon/pmbus/adm1275.c Kun Yi                                  2018-10-17  776  		/* Scale current with sense resistor value */
6e5c06ad94115e drivers/hwmon/pmbus/adm1275.c Kun Yi                                  2018-10-17  777  		info->m[PSC_CURRENT_OUT] =
6e5c06ad94115e drivers/hwmon/pmbus/adm1275.c Kun Yi                                  2018-10-17  778  			coefficients[cindex].m * shunt / 1000;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  779  		info->b[PSC_CURRENT_OUT] = coefficients[cindex].b;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  780  		info->R[PSC_CURRENT_OUT] = coefficients[cindex].R;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  781  	}
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  782  	if (pindex >= 0) {
6e5c06ad94115e drivers/hwmon/pmbus/adm1275.c Kun Yi                                  2018-10-17  783  		info->m[PSC_POWER] =
6e5c06ad94115e drivers/hwmon/pmbus/adm1275.c Kun Yi                                  2018-10-17  784  			coefficients[pindex].m * shunt / 1000;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  785  		info->b[PSC_POWER] = coefficients[pindex].b;
904b296f308dc7 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-04  786  		info->R[PSC_POWER] = coefficients[pindex].R;
5cf231a346fb80 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2011-07-14  787  	}
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  788  	if (tindex >= 0) {
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  789  		info->m[PSC_TEMPERATURE] = coefficients[tindex].m;
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  790  		info->b[PSC_TEMPERATURE] = coefficients[tindex].b;
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  791  		info->R[PSC_TEMPERATURE] = coefficients[tindex].R;
709066acdd12c3 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2015-07-05  792  	}
83f7649c52871d drivers/hwmon/adm1275.c       Guenter Roeck                           2011-03-17  793  
8b313ca7f1b982 drivers/hwmon/pmbus/adm1275.c Guenter Roeck                           2012-02-22 @794  	return pmbus_do_probe(client, id, info);
83f7649c52871d drivers/hwmon/adm1275.c       Guenter Roeck                           2011-03-17  795  }
83f7649c52871d drivers/hwmon/adm1275.c       Guenter Roeck                           2011-03-17  796  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Stephen Kitt Aug. 7, 2020, 6:23 a.m. UTC | #6
On Thu, 6 Aug 2020 14:48:58 -0700, Guenter Roeck <linux@roeck-us.net> wrote:
> On 8/6/20 1:12 PM, Stephen Kitt wrote:
> > On Thu, 6 Aug 2020 12:15:55 -0700, Guenter Roeck <linux@roeck-us.net>
> > wrote:  
> >> On 8/6/20 9:16 AM, Stephen Kitt wrote:  
[...]
> >> Also, I am not convinced that replacements such as
> >>
> >> -	{ "ipsps1", 0 },
> >> +	{ .name = "ipsps1" },
> >>
> >> are an improvement. I would suggest to leave that alone for
> >> consistency (and to make it easier to add more devices to the
> >> various drivers if that happens in the future).  
> > 
> > From reading through all the drivers using id_table, it seems to me that
> > we could do away with driver_data altogether and move all that to
> > driver-local structures, in many cases covering more than just an id. By
> > only initialising the elements of the structure that are really needed, I
> > was hoping to (a) make it more obvious that driver_data isn’t used, and
> > (b) allow removing it without touching all the code again.
> >   
> 
> I don't see it as an improvement to replace a common data structure with
> per-driver data structures. That sounds too much like "let's re-invent
> the wheel over and over again". If that is where things are going, I'd
> rather have it implemented everywhere else first. I am ok with the other
> changes, but not with this.

I agree, and I wasn’t intending on encouraging re-inventing the wheel in each
driver. Let’s focus on probe_new for now...

What did you mean by “to make it easier to add more devices to the various
drivers if that happens in the future”? There are already many drivers with
multiple devices but no driver_data, dropping the explicit driver_data
initialisation doesn’t necessarily make it harder to add devices, does it?

Regards,

Stephen
Guenter Roeck Aug. 7, 2020, 2:15 p.m. UTC | #7
On 8/6/20 11:23 PM, Stephen Kitt wrote:
> On Thu, 6 Aug 2020 14:48:58 -0700, Guenter Roeck <linux@roeck-us.net> wrote:
>> On 8/6/20 1:12 PM, Stephen Kitt wrote:
>>> On Thu, 6 Aug 2020 12:15:55 -0700, Guenter Roeck <linux@roeck-us.net>
>>> wrote:  
>>>> On 8/6/20 9:16 AM, Stephen Kitt wrote:  
> [...]
>>>> Also, I am not convinced that replacements such as
>>>>
>>>> -	{ "ipsps1", 0 },
>>>> +	{ .name = "ipsps1" },
>>>>
>>>> are an improvement. I would suggest to leave that alone for
>>>> consistency (and to make it easier to add more devices to the
>>>> various drivers if that happens in the future).  
>>>
>>> From reading through all the drivers using id_table, it seems to me that
>>> we could do away with driver_data altogether and move all that to
>>> driver-local structures, in many cases covering more than just an id. By
>>> only initialising the elements of the structure that are really needed, I
>>> was hoping to (a) make it more obvious that driver_data isn’t used, and
>>> (b) allow removing it without touching all the code again.
>>>   
>>
>> I don't see it as an improvement to replace a common data structure with
>> per-driver data structures. That sounds too much like "let's re-invent
>> the wheel over and over again". If that is where things are going, I'd
>> rather have it implemented everywhere else first. I am ok with the other
>> changes, but not with this.
> 
> I agree, and I wasn’t intending on encouraging re-inventing the wheel in each
> driver. Let’s focus on probe_new for now...
> 
> What did you mean by “to make it easier to add more devices to the various
> drivers if that happens in the future”? There are already many drivers with
> multiple devices but no driver_data, dropping the explicit driver_data
> initialisation doesn’t necessarily make it harder to add devices, does it?
> 
There is an existing mechanism to identify devices based on the device ID,
should that be necessary. I am not inclined to let people invent a
separate per-driver mechanism unless the kernel community decides that
this is the way to go.

Thanks,
Guenter
diff mbox series

Patch

diff --git a/drivers/hwmon/pmbus/bel-pfe.c b/drivers/hwmon/pmbus/bel-pfe.c
index f236e18f45a5..240d86043d75 100644
--- a/drivers/hwmon/pmbus/bel-pfe.c
+++ b/drivers/hwmon/pmbus/bel-pfe.c
@@ -104,7 +104,7 @@  static int pfe_pmbus_probe(struct i2c_client *client,
 		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[] = {
diff --git a/drivers/hwmon/pmbus/ibm-cffps.c b/drivers/hwmon/pmbus/ibm-cffps.c
index 7d300f2f338d..0215e792ec7e 100644
--- a/drivers/hwmon/pmbus/ibm-cffps.c
+++ b/drivers/hwmon/pmbus/ibm-cffps.c
@@ -519,7 +519,7 @@  static int ibm_cffps_probe(struct i2c_client *client,
 	}
 
 	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)
 		return rc;
 
diff --git a/drivers/hwmon/pmbus/inspur-ipsps.c b/drivers/hwmon/pmbus/inspur-ipsps.c
index 42e01549184a..b97848e05ae2 100644
--- a/drivers/hwmon/pmbus/inspur-ipsps.c
+++ b/drivers/hwmon/pmbus/inspur-ipsps.c
@@ -190,15 +190,14 @@  static struct pmbus_platform_data ipsps_pdata = {
 	.flags = PMBUS_SKIP_STATUS_CHECK,
 };
 
-static int ipsps_probe(struct i2c_client *client,
-		       const struct i2c_device_id *id)
+static int ipsps_probe(struct i2c_client *client)
 {
 	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[] = {
-	{ "ipsps1", 0 },
+	{ .name = "ipsps1" },
 	{}
 };
 MODULE_DEVICE_TABLE(i2c, ipsps_id);
@@ -216,7 +215,7 @@  static struct i2c_driver ipsps_driver = {
 		.name = "inspur-ipsps",
 		.of_match_table = of_match_ptr(ipsps_of_match),
 	},
-	.probe = ipsps_probe,
+	.probe_new = ipsps_probe,
 	.remove = pmbus_do_remove,
 	.id_table = ipsps_id,
 };
diff --git a/drivers/hwmon/pmbus/ir35221.c b/drivers/hwmon/pmbus/ir35221.c
index 3eea3e006a96..e7fabafca2f1 100644
--- a/drivers/hwmon/pmbus/ir35221.c
+++ b/drivers/hwmon/pmbus/ir35221.c
@@ -67,8 +67,7 @@  static int ir35221_read_word_data(struct i2c_client *client, int page,
 	return ret;
 }
 
-static int ir35221_probe(struct i2c_client *client,
-			 const struct i2c_device_id *id)
+static int ir35221_probe(struct i2c_client *client)
 {
 	struct pmbus_driver_info *info;
 	u8 buf[I2C_SMBUS_BLOCK_MAX];
@@ -123,11 +122,11 @@  static int ir35221_probe(struct i2c_client *client,
 		| PMBUS_HAVE_STATUS_INPUT | PMBUS_HAVE_STATUS_TEMP;
 	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[] = {
-	{"ir35221", 0},
+	{ .name = "ir35221" },
 	{}
 };
 
@@ -137,7 +136,7 @@  static struct i2c_driver ir35221_driver = {
 	.driver = {
 		.name	= "ir35221",
 	},
-	.probe		= ir35221_probe,
+	.probe_new	= ir35221_probe,
 	.remove		= pmbus_do_remove,
 	.id_table	= ir35221_id,
 };
diff --git a/drivers/hwmon/pmbus/ir38064.c b/drivers/hwmon/pmbus/ir38064.c
index 1820f5077f66..a36ab6cc21d7 100644
--- a/drivers/hwmon/pmbus/ir38064.c
+++ b/drivers/hwmon/pmbus/ir38064.c
@@ -35,14 +35,13 @@  static struct pmbus_driver_info ir38064_info = {
 	    | PMBUS_HAVE_POUT,
 };
 
-static int ir38064_probe(struct i2c_client *client,
-			 const struct i2c_device_id *id)
+static int ir38064_probe(struct i2c_client *client)
 {
-	return pmbus_do_probe(client, id, &ir38064_info);
+	return pmbus_do_probe(client, &ir38064_info);
 }
 
 static const struct i2c_device_id ir38064_id[] = {
-	{"ir38064", 0},
+	{ .name = "ir38064" },
 	{}
 };
 
@@ -53,7 +52,7 @@  static struct i2c_driver ir38064_driver = {
 	.driver = {
 		   .name = "ir38064",
 		   },
-	.probe = ir38064_probe,
+	.probe_new = ir38064_probe,
 	.remove = pmbus_do_remove,
 	.id_table = ir38064_id,
 };
diff --git a/drivers/hwmon/pmbus/irps5401.c b/drivers/hwmon/pmbus/irps5401.c
index d37daa001fb3..828b91567137 100644
--- a/drivers/hwmon/pmbus/irps5401.c
+++ b/drivers/hwmon/pmbus/irps5401.c
@@ -38,14 +38,13 @@  static struct pmbus_driver_info irps5401_info = {
 	.func[4] = IRPS5401_LDO_FUNC,
 };
 
-static int irps5401_probe(struct i2c_client *client,
-			  const struct i2c_device_id *id)
+static int irps5401_probe(struct i2c_client *client)
 {
-	return pmbus_do_probe(client, id, &irps5401_info);
+	return pmbus_do_probe(client, &irps5401_info);
 }
 
 static const struct i2c_device_id irps5401_id[] = {
-	{"irps5401", 0},
+	{ .name = "irps5401" },
 	{}
 };
 
@@ -55,7 +54,7 @@  static struct i2c_driver irps5401_driver = {
 	.driver = {
 		   .name = "irps5401",
 		   },
-	.probe = irps5401_probe,
+	.probe_new = irps5401_probe,
 	.remove = pmbus_do_remove,
 	.id_table = irps5401_id,
 };
diff --git a/drivers/hwmon/pmbus/isl68137.c b/drivers/hwmon/pmbus/isl68137.c
index 0c622711ef7e..2d626ccbc11d 100644
--- a/drivers/hwmon/pmbus/isl68137.c
+++ b/drivers/hwmon/pmbus/isl68137.c
@@ -262,7 +262,7 @@  static int isl68137_probe(struct i2c_client *client,
 		return -ENODEV;
 	}
 
-	return pmbus_do_probe(client, id, info);
+	return pmbus_do_probe(client, info);
 }
 
 static const struct i2c_device_id raa_dmpvr_id[] = {
diff --git a/drivers/hwmon/pmbus/lm25066.c b/drivers/hwmon/pmbus/lm25066.c
index 9e4cf0800186..2d28cddc365f 100644
--- a/drivers/hwmon/pmbus/lm25066.c
+++ b/drivers/hwmon/pmbus/lm25066.c
@@ -487,7 +487,7 @@  static int lm25066_probe(struct i2c_client *client,
 		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[] = {
diff --git a/drivers/hwmon/pmbus/ltc2978.c b/drivers/hwmon/pmbus/ltc2978.c
index 7b0e6b37e247..da6832094676 100644
--- a/drivers/hwmon/pmbus/ltc2978.c
+++ b/drivers/hwmon/pmbus/ltc2978.c
@@ -832,7 +832,7 @@  static int ltc2978_probe(struct i2c_client *client,
 	}
 #endif
 
-	return pmbus_do_probe(client, id, info);
+	return pmbus_do_probe(client, info);
 }
 
 
diff --git a/drivers/hwmon/pmbus/ltc3815.c b/drivers/hwmon/pmbus/ltc3815.c
index 3036263e0a66..0a02fbac127a 100644
--- a/drivers/hwmon/pmbus/ltc3815.c
+++ b/drivers/hwmon/pmbus/ltc3815.c
@@ -143,7 +143,7 @@  static int ltc3815_write_word_data(struct i2c_client *client, int page,
 }
 
 static const struct i2c_device_id ltc3815_id[] = {
-	{"ltc3815", 0},
+	{ .name = "ltc3815" },
 	{ }
 };
 MODULE_DEVICE_TABLE(i2c, ltc3815_id);
@@ -178,8 +178,7 @@  static struct pmbus_driver_info ltc3815_info = {
 	.write_word_data = ltc3815_write_word_data,
 };
 
-static int ltc3815_probe(struct i2c_client *client,
-			 const struct i2c_device_id *id)
+static int ltc3815_probe(struct i2c_client *client)
 {
 	int chip_id;
 
@@ -193,14 +192,14 @@  static int ltc3815_probe(struct i2c_client *client,
 	if ((chip_id & LTC3815_ID_MASK) != LTC3815_ID)
 		return -ENODEV;
 
-	return pmbus_do_probe(client, id, &ltc3815_info);
+	return pmbus_do_probe(client, &ltc3815_info);
 }
 
 static struct i2c_driver ltc3815_driver = {
 	.driver = {
 		   .name = "ltc3815",
 		   },
-	.probe = ltc3815_probe,
+	.probe_new = ltc3815_probe,
 	.remove = pmbus_do_remove,
 	.id_table = ltc3815_id,
 };
diff --git a/drivers/hwmon/pmbus/max16064.c b/drivers/hwmon/pmbus/max16064.c
index 288e93f74c28..e0efc7f6879d 100644
--- a/drivers/hwmon/pmbus/max16064.c
+++ b/drivers/hwmon/pmbus/max16064.c
@@ -85,14 +85,13 @@  static struct pmbus_driver_info max16064_info = {
 	.write_word_data = max16064_write_word_data,
 };
 
-static int max16064_probe(struct i2c_client *client,
-			  const struct i2c_device_id *id)
+static int max16064_probe(struct i2c_client *client)
 {
-	return pmbus_do_probe(client, id, &max16064_info);
+	return pmbus_do_probe(client, &max16064_info);
 }
 
 static const struct i2c_device_id max16064_id[] = {
-	{"max16064", 0},
+	{ .name = "max16064" },
 	{}
 };
 
@@ -103,7 +102,7 @@  static struct i2c_driver max16064_driver = {
 	.driver = {
 		   .name = "max16064",
 		   },
-	.probe = max16064_probe,
+	.probe_new = max16064_probe,
 	.remove = pmbus_do_remove,
 	.id_table = max16064_id,
 };
diff --git a/drivers/hwmon/pmbus/max16601.c b/drivers/hwmon/pmbus/max16601.c
index 51cdfaf9023c..0d4049c29f9c 100644
--- a/drivers/hwmon/pmbus/max16601.c
+++ b/drivers/hwmon/pmbus/max16601.c
@@ -239,8 +239,7 @@  static void max16601_remove(void *_data)
 	i2c_unregister_device(data->vsa);
 }
 
-static int max16601_probe(struct i2c_client *client,
-			  const struct i2c_device_id *id)
+static int max16601_probe(struct i2c_client *client)
 {
 	struct device *dev = &client->dev;
 	u8 buf[I2C_SMBUS_BLOCK_MAX + 1];
@@ -288,11 +287,11 @@  static int max16601_probe(struct i2c_client *client,
 
 	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[] = {
-	{"max16601", 0},
+	{ .name = "max16601" },
 	{}
 };
 
@@ -302,7 +301,7 @@  static struct i2c_driver max16601_driver = {
 	.driver = {
 		   .name = "max16601",
 		   },
-	.probe = max16601_probe,
+	.probe_new = max16601_probe,
 	.remove = pmbus_do_remove,
 	.id_table = max16601_id,
 };
diff --git a/drivers/hwmon/pmbus/max20730.c b/drivers/hwmon/pmbus/max20730.c
index c0bb05487e0e..0abcef2ac649 100644
--- a/drivers/hwmon/pmbus/max20730.c
+++ b/drivers/hwmon/pmbus/max20730.c
@@ -335,7 +335,7 @@  static int max20730_probe(struct i2c_client *client,
 		return 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[] = {
diff --git a/drivers/hwmon/pmbus/max20751.c b/drivers/hwmon/pmbus/max20751.c
index da3c38cb9a5c..8ab666969a77 100644
--- a/drivers/hwmon/pmbus/max20751.c
+++ b/drivers/hwmon/pmbus/max20751.c
@@ -26,14 +26,13 @@  static struct pmbus_driver_info max20751_info = {
 		PMBUS_HAVE_POUT,
 };
 
-static int max20751_probe(struct i2c_client *client,
-			  const struct i2c_device_id *id)
+static int max20751_probe(struct i2c_client *client)
 {
-	return pmbus_do_probe(client, id, &max20751_info);
+	return pmbus_do_probe(client, &max20751_info);
 }
 
 static const struct i2c_device_id max20751_id[] = {
-	{"max20751", 0},
+	{ .name = "max20751" },
 	{}
 };
 
@@ -43,7 +42,7 @@  static struct i2c_driver max20751_driver = {
 	.driver = {
 		   .name = "max20751",
 		   },
-	.probe = max20751_probe,
+	.probe_new = max20751_probe,
 	.remove = pmbus_do_remove,
 	.id_table = max20751_id,
 };
diff --git a/drivers/hwmon/pmbus/max31785.c b/drivers/hwmon/pmbus/max31785.c
index d9aa5c873d21..3e77c79f3f42 100644
--- a/drivers/hwmon/pmbus/max31785.c
+++ b/drivers/hwmon/pmbus/max31785.c
@@ -324,8 +324,7 @@  static int max31785_configure_dual_tach(struct i2c_client *client,
 	return 0;
 }
 
-static int max31785_probe(struct i2c_client *client,
-			  const struct i2c_device_id *id)
+static int max31785_probe(struct i2c_client *client)
 {
 	struct device *dev = &client->dev;
 	struct pmbus_driver_info *info;
@@ -354,7 +353,7 @@  static int max31785_probe(struct i2c_client *client,
 	if (ret == MAX31785A) {
 		dual_tach = true;
 	} 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");
 	} else {
 		return -ENODEV;
@@ -366,12 +365,12 @@  static int max31785_probe(struct i2c_client *client,
 			return ret;
 	}
 
-	return pmbus_do_probe(client, id, info);
+	return pmbus_do_probe(client, info);
 }
 
 static const struct i2c_device_id max31785_id[] = {
-	{ "max31785", 0 },
-	{ "max31785a", 0 },
+	{ .name = "max31785" },
+	{ .name = "max31785a" },
 	{ },
 };
 
@@ -390,7 +389,7 @@  static struct i2c_driver max31785_driver = {
 		.name = "max31785",
 		.of_match_table = max31785_of_match,
 	},
-	.probe = max31785_probe,
+	.probe_new = max31785_probe,
 	.remove = pmbus_do_remove,
 	.id_table = max31785_id,
 };
diff --git a/drivers/hwmon/pmbus/max34440.c b/drivers/hwmon/pmbus/max34440.c
index 18b4e071067f..0205983bd51f 100644
--- a/drivers/hwmon/pmbus/max34440.c
+++ b/drivers/hwmon/pmbus/max34440.c
@@ -480,7 +480,7 @@  static int max34440_probe(struct i2c_client *client,
 			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[] = {
diff --git a/drivers/hwmon/pmbus/max8688.c b/drivers/hwmon/pmbus/max8688.c
index 643ccfc05106..2efce192e6af 100644
--- a/drivers/hwmon/pmbus/max8688.c
+++ b/drivers/hwmon/pmbus/max8688.c
@@ -165,14 +165,13 @@  static struct pmbus_driver_info max8688_info = {
 	.write_word_data = max8688_write_word_data,
 };
 
-static int max8688_probe(struct i2c_client *client,
-			 const struct i2c_device_id *id)
+static int max8688_probe(struct i2c_client *client)
 {
-	return pmbus_do_probe(client, id, &max8688_info);
+	return pmbus_do_probe(client, &max8688_info);
 }
 
 static const struct i2c_device_id max8688_id[] = {
-	{"max8688", 0},
+	{ .name = "max8688" },
 	{ }
 };
 
@@ -183,7 +182,7 @@  static struct i2c_driver max8688_driver = {
 	.driver = {
 		   .name = "max8688",
 		   },
-	.probe = max8688_probe,
+	.probe_new = max8688_probe,
 	.remove = pmbus_do_remove,
 	.id_table = max8688_id,
 };
diff --git a/drivers/hwmon/pmbus/pmbus.c b/drivers/hwmon/pmbus/pmbus.c
index 6d384e8ee1db..7742ce83c99f 100644
--- a/drivers/hwmon/pmbus/pmbus.c
+++ b/drivers/hwmon/pmbus/pmbus.c
@@ -185,7 +185,7 @@  static int pmbus_probe(struct i2c_client *client,
 	info->identify = pmbus_identify;
 	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 = {
diff --git a/drivers/hwmon/pmbus/pmbus.h b/drivers/hwmon/pmbus/pmbus.h
index 18e06fc6c53f..1ff5314287cb 100644
--- a/drivers/hwmon/pmbus/pmbus.h
+++ b/drivers/hwmon/pmbus/pmbus.h
@@ -476,8 +476,7 @@  int pmbus_update_byte_data(struct i2c_client *client, int page, u8 reg,
 void pmbus_clear_faults(struct i2c_client *client);
 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);
-int pmbus_do_probe(struct i2c_client *client, const struct i2c_device_id *id,
-		   struct pmbus_driver_info *info);
+int pmbus_do_probe(struct i2c_client *client, struct pmbus_driver_info *info);
 int pmbus_do_remove(struct i2c_client *client);
 const struct pmbus_driver_info *pmbus_get_driver_info(struct i2c_client
 						      *client);
diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
index 2191575a448b..065a81f6545d 100644
--- a/drivers/hwmon/pmbus/pmbus_core.c
+++ b/drivers/hwmon/pmbus/pmbus_core.c
@@ -2492,8 +2492,7 @@  static int pmbus_init_debugfs(struct i2c_client *client,
 }
 #endif	/* IS_ENABLED(CONFIG_DEBUG_FS) */
 
-int pmbus_do_probe(struct i2c_client *client, const struct i2c_device_id *id,
-		   struct pmbus_driver_info *info)
+int pmbus_do_probe(struct i2c_client *client, struct pmbus_driver_info *info)
 {
 	struct device *dev = &client->dev;
 	const struct pmbus_platform_data *pdata = dev_get_platdata(dev);
diff --git a/drivers/hwmon/pmbus/pxe1610.c b/drivers/hwmon/pmbus/pxe1610.c
index 517584cff3de..732958b2f6b7 100644
--- a/drivers/hwmon/pmbus/pxe1610.c
+++ b/drivers/hwmon/pmbus/pxe1610.c
@@ -78,8 +78,7 @@  static struct pmbus_driver_info pxe1610_info = {
 	.identify = pxe1610_identify,
 };
 
-static int pxe1610_probe(struct i2c_client *client,
-			  const struct i2c_device_id *id)
+static int pxe1610_probe(struct i2c_client *client)
 {
 	struct pmbus_driver_info *info;
 	u8 buf[I2C_SMBUS_BLOCK_MAX];
@@ -115,13 +114,13 @@  static int pxe1610_probe(struct i2c_client *client,
 	if (!info)
 		return -ENOMEM;
 
-	return pmbus_do_probe(client, id, info);
+	return pmbus_do_probe(client, info);
 }
 
 static const struct i2c_device_id pxe1610_id[] = {
-	{"pxe1610", 0},
-	{"pxe1110", 0},
-	{"pxm1310", 0},
+	{ .name = "pxe1610" },
+	{ .name = "pxe1110" },
+	{ .name = "pxm1310" },
 	{}
 };
 
@@ -131,7 +130,7 @@  static struct i2c_driver pxe1610_driver = {
 	.driver = {
 			.name = "pxe1610",
 			},
-	.probe = pxe1610_probe,
+	.probe_new = pxe1610_probe,
 	.remove = pmbus_do_remove,
 	.id_table = pxe1610_id,
 };
diff --git a/drivers/hwmon/pmbus/tps40422.c b/drivers/hwmon/pmbus/tps40422.c
index 2b83dcda964a..d265178c7689 100644
--- a/drivers/hwmon/pmbus/tps40422.c
+++ b/drivers/hwmon/pmbus/tps40422.c
@@ -25,14 +25,13 @@  static struct pmbus_driver_info tps40422_info = {
 		| PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT,
 };
 
-static int tps40422_probe(struct i2c_client *client,
-			  const struct i2c_device_id *id)
+static int tps40422_probe(struct i2c_client *client)
 {
-	return pmbus_do_probe(client, id, &tps40422_info);
+	return pmbus_do_probe(client, &tps40422_info);
 }
 
 static const struct i2c_device_id tps40422_id[] = {
-	{"tps40422", 0},
+	{ .name = "tps40422" },
 	{}
 };
 
@@ -43,7 +42,7 @@  static struct i2c_driver tps40422_driver = {
 	.driver = {
 		   .name = "tps40422",
 		   },
-	.probe = tps40422_probe,
+	.probe_new = tps40422_probe,
 	.remove = pmbus_do_remove,
 	.id_table = tps40422_id,
 };
diff --git a/drivers/hwmon/pmbus/tps53679.c b/drivers/hwmon/pmbus/tps53679.c
index 157c99ffb52b..30832d71102f 100644
--- a/drivers/hwmon/pmbus/tps53679.c
+++ b/drivers/hwmon/pmbus/tps53679.c
@@ -220,7 +220,7 @@  static int tps53679_probe(struct i2c_client *client,
 		return -ENODEV;
 	}
 
-	return pmbus_do_probe(client, id, info);
+	return pmbus_do_probe(client, info);
 }
 
 static const struct i2c_device_id tps53679_id[] = {
diff --git a/drivers/hwmon/pmbus/ucd9000.c b/drivers/hwmon/pmbus/ucd9000.c
index 81f4c4f166cd..d4c74e21c9d2 100644
--- a/drivers/hwmon/pmbus/ucd9000.c
+++ b/drivers/hwmon/pmbus/ucd9000.c
@@ -603,7 +603,7 @@  static int ucd9000_probe(struct i2c_client *client,
 
 	ucd9000_probe_gpio(client, mid, data);
 
-	ret = pmbus_do_probe(client, mid, info);
+	ret = pmbus_do_probe(client, info);
 	if (ret)
 		return ret;
 
diff --git a/drivers/hwmon/pmbus/ucd9200.c b/drivers/hwmon/pmbus/ucd9200.c
index 7c04745a9709..58633bb495fb 100644
--- a/drivers/hwmon/pmbus/ucd9200.c
+++ b/drivers/hwmon/pmbus/ucd9200.c
@@ -192,7 +192,7 @@  static int ucd9200_probe(struct i2c_client *client,
 	if (mid->driver_data == ucd9240)
 		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 */
diff --git a/drivers/hwmon/pmbus/xdpe12284.c b/drivers/hwmon/pmbus/xdpe12284.c
index d5103fc9e269..c05bc13552a7 100644
--- a/drivers/hwmon/pmbus/xdpe12284.c
+++ b/drivers/hwmon/pmbus/xdpe12284.c
@@ -127,8 +127,7 @@  static struct pmbus_driver_info xdpe122_info = {
 	.read_word_data = xdpe122_read_word_data,
 };
 
-static int xdpe122_probe(struct i2c_client *client,
-			 const struct i2c_device_id *id)
+static int xdpe122_probe(struct i2c_client *client)
 {
 	struct pmbus_driver_info *info;
 
@@ -137,12 +136,12 @@  static int xdpe122_probe(struct i2c_client *client,
 	if (!info)
 		return -ENOMEM;
 
-	return pmbus_do_probe(client, id, info);
+	return pmbus_do_probe(client, info);
 }
 
 static const struct i2c_device_id xdpe122_id[] = {
-	{"xdpe12254", 0},
-	{"xdpe12284", 0},
+	{ .name = "xdpe12254" },
+	{ .name = "xdpe12284" },
 	{}
 };
 
@@ -160,7 +159,7 @@  static struct i2c_driver xdpe122_driver = {
 		.name = "xdpe12284",
 		.of_match_table = of_match_ptr(xdpe122_of_match),
 	},
-	.probe = xdpe122_probe,
+	.probe_new = xdpe122_probe,
 	.remove = pmbus_do_remove,
 	.id_table = xdpe122_id,
 };
diff --git a/drivers/hwmon/pmbus/zl6100.c b/drivers/hwmon/pmbus/zl6100.c
index 3a827d0a881d..24b1b0f46a40 100644
--- a/drivers/hwmon/pmbus/zl6100.c
+++ b/drivers/hwmon/pmbus/zl6100.c
@@ -389,7 +389,7 @@  static int zl6100_probe(struct i2c_client *client,
 	info->write_word_data = zl6100_write_word_data;
 	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 = {