aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses/i2c-gpio.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/i2c/busses/i2c-gpio.c')
-rw-r--r--drivers/i2c/busses/i2c-gpio.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c
index f4355b17bfbf..d83b19a37fd6 100644
--- a/drivers/i2c/busses/i2c-gpio.c
+++ b/drivers/i2c/busses/i2c-gpio.c
@@ -428,7 +428,9 @@ static int i2c_gpio_probe(struct platform_device *pdev)
adap->dev.parent = dev;
device_set_node(&adap->dev, fwnode);
- adap->nr = pdev->id;
+ if (pdev->id != PLATFORM_DEVID_NONE || !pdev->dev.of_node ||
+ of_property_read_u32(pdev->dev.of_node, "reg", &adap->nr))
+ adap->nr = pdev->id;
ret = i2c_bit_add_numbered_bus(adap);
if (ret)
return ret;