]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
i2c: designware: Initialize adapter name only when not set
authorPratap Nirujogi <pratap.nirujogi@amd.com>
Mon, 9 Jun 2025 15:53:55 +0000 (11:53 -0400)
committerAndi Shyti <andi.shyti@kernel.org>
Wed, 25 Jun 2025 21:38:29 +0000 (23:38 +0200)
Check if the adapter name is already set in the driver prior to
initializing with generic name in i2c_dw_probe_master(). This
check allows to retain the unique adapter name driver has
initialized, which platform driver can use to distinguish it
from other i2c designware adapters.

Tested-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Pratap Nirujogi <pratap.nirujogi@amd.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20250609155601.1477055-2-pratap.nirujogi@amd.com
drivers/i2c/busses/i2c-designware-master.c

index c5394229b77f57d3490c4ba288e98b6ef90e35a4..9d7d9e47564a166b64e7749da6b6cf0dfe8f8f23 100644 (file)
@@ -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;