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

From: Nirujogi, Pratap
Date: Tue Jun 03 2025 - 22:27:10 EST




On 6/3/2025 6:50 PM, Randy Dunlap wrote:
Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.


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.

Thanks Randy. I will take care of updating the commit text explaining why this change is needed in the next patch.


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

Tested-by: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>

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