Skip to content

Commit 91430a8

Browse files
abdurrahman-nexthopAndi Shyti
authored andcommitted
i2c: xiic: use numbered adapter registration
Switch from i2c_add_adapter() to i2c_add_numbered_adapter() to enable platforms to specify fixed I2C bus numbers via the platform device ID. This allows systems to maintain consistent bus numbering across reboots. On platforms where the device ID is PLATFORM_DEVID_NONE (the default), the adapter falls back to dynamic allocation, preserving backward compatibility. Signed-off-by: Abdurrahman Hussain <abdurrahman@nexthop.ai> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20260223-i2c-xiic-v12-6-b6c9ce4e4f3c@nexthop.ai
1 parent f715b05 commit 91430a8

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

drivers/i2c/busses/i2c-xiic.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1451,6 +1451,7 @@ static int xiic_i2c_probe(struct platform_device *pdev)
14511451
/* hook up driver to tree */
14521452
platform_set_drvdata(pdev, i2c);
14531453
i2c->adap = xiic_adapter;
1454+
i2c->adap.nr = pdev->id;
14541455
i2c_set_adapdata(&i2c->adap, i2c);
14551456
i2c->adap.dev.parent = &pdev->dev;
14561457
device_set_node(&i2c->adap.dev, fwnode);
@@ -1507,7 +1508,7 @@ static int xiic_i2c_probe(struct platform_device *pdev)
15071508
return dev_err_probe(dev, ret, "Cannot xiic_reinit\n");
15081509

15091510
/* add i2c adapter to i2c tree */
1510-
ret = i2c_add_adapter(&i2c->adap);
1511+
ret = i2c_add_numbered_adapter(&i2c->adap);
15111512
if (ret) {
15121513
xiic_deinit(i2c);
15131514
return ret;

0 commit comments

Comments
 (0)