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

From: Guenter Roeck

Date: Fri Mar 06 2026 - 11:32:23 EST


On Thu, Mar 05, 2026 at 01:56:39PM -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().
>
> 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.

The patch does not actually remove the forward declaration or move
the i2c_device_id table. At the very least this is misleading.
The same applies to other patches of the series as well.

> * 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/tps53679.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/hwmon/pmbus/tps53679.c b/drivers/hwmon/pmbus/tps53679.c
> index ca2bfa25eb04c..df2726659a4ed 100644
> --- a/drivers/hwmon/pmbus/tps53679.c
> +++ b/drivers/hwmon/pmbus/tps53679.c
> @@ -253,10 +253,7 @@ static int tps53679_probe(struct i2c_client *client)
> struct pmbus_driver_info *info;
> enum chips chip_id;
>
> - if (dev->of_node)
> - chip_id = (uintptr_t)of_device_get_match_data(dev);
> - else
> - chip_id = i2c_match_id(tps53679_id, client)->driver_data;
> + chip_id = (uintptr_t)i2c_get_match_data(client);
>
> info = devm_kmemdup(dev, &tps53679_info, sizeof(*info), GFP_KERNEL);
> if (!info)