Re: [PATCH 11/11] hwmon: (pmbus/max16601) Remove use of i2c_match_id()

From: Guenter Roeck

Date: Fri Mar 06 2026 - 11:22:54 EST


On Thu, Mar 05, 2026 at 01:56:42PM -0600, Andrew Davis wrote:
> The function i2c_match_id() is used to fetch the matching ID from
> the i2c_device_id table. This is often used to then retrieve the
> matching driver_data. This can be done in one step with the helper
> i2c_get_match_data().

... but the code below doesn;t actually call i2c_get_match_data().

>
> This helper has a couple other benefits:
> * It doesn't need the i2c_device_id passed in so we do not need
> to have that forward declared, allowing us to remove those or
> move the i2c_device_id table down to its more natural spot
> with the other module info.

... but it doesn't do that.

> * It also checks for device match data, which allows for OF and
> ACPI based probing. That means we do not have to manually check
> those first and can remove those checks.
>
> Signed-off-by: Andrew Davis <afd@xxxxxx>
> ---
> drivers/hwmon/pmbus/max16601.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/hwmon/pmbus/max16601.c b/drivers/hwmon/pmbus/max16601.c
> index d696e506aafba..36dc13424d929 100644
> --- a/drivers/hwmon/pmbus/max16601.c
> +++ b/drivers/hwmon/pmbus/max16601.c
> @@ -318,7 +318,7 @@ static int max16601_probe(struct i2c_client *client)
> if (chip_id < 0)
> return chip_id;
>
> - id = i2c_match_id(max16601_id, client);
> + id = i2c_client_get_device_id(client);
> if (chip_id != id->driver_data)
> dev_warn(&client->dev,
> "Device mismatch: Configured %s (%d), detected %d\n",
> --
> 2.39.2
>