Re: [PATCH v2 1/3] i2c: designware: Initialize adapter name only when not set

Randy Dunlap
2025-06-03T22:50:36Z

On 6/3/25 2:40 PM, Pratap Nirujogi wrote:
> Check if the adapter name is already set in the driver prior
> to initializing with generic name in i2c_dw_probe_master().

That explains what but not why. Commits should also explain
why they are doing something.

>
> Signed-off-by: Pratap Nirujogi <pratap.nirujogi@amd.com>

Tested-by: Randy Dunlap <rdunlap@infradead.org>

Thanks.

> ---
> drivers/i2c/busses/i2c-designware-master.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-designware-master.c b/drivers/i2c/busses/i2c-designware-master.c
> index c5394229b77f..9d7d9e47564a 100644
> --- a/drivers/i2c/busses/i2c-designware-master.c
> +++ b/drivers/i2c/busses/i2c-designware-master.c
> @@ -1042,8 +1042,9 @@ int i2c_dw_probe_master(struct dw_i2c_dev *dev)
> if (ret)
> return ret;
>
> - snprintf(adap->name, sizeof(adap->name),
> - "Synopsys DesignWare I2C adapter");
> + if (!adap->name[0])
> + scnprintf(adap->name, sizeof(adap->name),
> + "Synopsys DesignWare I2C adapter");
> adap->retries = 3;
> adap->algo = &i2c_dw_algo;
> adap->quirks = &i2c_dw_quirks;

--
~Randy