From: Sascha Hauer <s.hauer@pengutronix.de>
To: "open list:BAREBOX" <barebox@lists.infradead.org>
Subject: [PATCH 1/3] i2c: set adapter.nr explicitly to -1
Date: Fri, 25 Oct 2024 09:30:24 +0200 [thread overview]
Message-ID: <20241025-i2c-busnum-v1-1-332d9257eafe@pengutronix.de> (raw)
In-Reply-To: <20241025-i2c-busnum-v1-0-332d9257eafe@pengutronix.de>
dev->id will always be -1 for device tree instantiated devices. Instead
of setting adapter.nr to dev->id, set it to -1 explicitly for all I2C
bus drivers that are purely instantiated from device tree.
This is done for clarity just to show that all I2C bus numbers are
really dynamically assigned.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/i2c/busses/i2c-at91.c | 2 +-
drivers/i2c/busses/i2c-bcm283x.c | 2 +-
drivers/i2c/busses/i2c-cadence.c | 2 +-
drivers/i2c/busses/i2c-designware.c | 2 +-
drivers/i2c/busses/i2c-imx.c | 2 +-
drivers/i2c/busses/i2c-mv64xxx.c | 2 +-
drivers/i2c/busses/i2c-rockchip.c | 2 +-
drivers/i2c/busses/i2c-stm32.c | 2 +-
drivers/i2c/busses/i2c-tegra.c | 2 +-
9 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
index 5b1f456187..dbc5aa4ddf 100644
--- a/drivers/i2c/busses/i2c-at91.c
+++ b/drivers/i2c/busses/i2c-at91.c
@@ -558,7 +558,7 @@ static int at91_twi_probe(struct device *dev)
i2c_at91->adapter.master_xfer = at91_twi_xfer;
i2c_at91->adapter.dev.parent = dev;
- i2c_at91->adapter.nr = dev->id;
+ i2c_at91->adapter.nr = -1;
i2c_at91->adapter.dev.of_node = dev->of_node;
rc = i2c_add_numbered_adapter(&i2c_at91->adapter);
diff --git a/drivers/i2c/busses/i2c-bcm283x.c b/drivers/i2c/busses/i2c-bcm283x.c
index b40918932f..fb69515825 100644
--- a/drivers/i2c/busses/i2c-bcm283x.c
+++ b/drivers/i2c/busses/i2c-bcm283x.c
@@ -306,7 +306,7 @@ static int bcm283x_i2c_probe(struct device *dev)
}
bcm_i2c->adapter.master_xfer = bcm283x_i2c_xfer;
- bcm_i2c->adapter.nr = dev->id;
+ bcm_i2c->adapter.nr = -1;
bcm_i2c->adapter.dev.parent = dev;
bcm_i2c->adapter.dev.of_node = np;
diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c
index bf9ec30994..8551cd05da 100644
--- a/drivers/i2c/busses/i2c-cadence.c
+++ b/drivers/i2c/busses/i2c-cadence.c
@@ -422,7 +422,7 @@ static int cdns_i2c_probe(struct device *dev)
return err;
i2c->adapter.master_xfer = cdns_i2c_xfer;
- i2c->adapter.nr = dev->id;
+ i2c->adapter.nr = -1;
i2c->adapter.dev.parent = dev;
i2c->adapter.dev.of_node = np;
diff --git a/drivers/i2c/busses/i2c-designware.c b/drivers/i2c/busses/i2c-designware.c
index 152b795c37..3ba10e172a 100644
--- a/drivers/i2c/busses/i2c-designware.c
+++ b/drivers/i2c/busses/i2c-designware.c
@@ -525,7 +525,7 @@ static int i2c_dw_probe(struct device *pdev)
}
dw->adapter.master_xfer = i2c_dw_xfer;
- dw->adapter.nr = pdev->id;
+ dw->adapter.nr = -1;
dw->adapter.dev.parent = pdev;
dw->adapter.dev.of_node = pdev->of_node;
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index 981db015ea..eabb8252ae 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -592,7 +592,7 @@ static int __init i2c_fsl_probe(struct device *pdev)
/* Setup i2c_fsl driver structure */
i2c_fsl->adapter.master_xfer = i2c_fsl_xfer;
- i2c_fsl->adapter.nr = pdev->id;
+ i2c_fsl->adapter.nr = -1;
i2c_fsl->adapter.dev.parent = pdev;
i2c_fsl->adapter.dev.of_node = pdev->of_node;
iores = dev_request_mem_resource(pdev, 0);
diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
index 44f1fd4ce6..6629e65b48 100644
--- a/drivers/i2c/busses/i2c-mv64xxx.c
+++ b/drivers/i2c/busses/i2c-mv64xxx.c
@@ -625,7 +625,7 @@ mv64xxx_i2c_probe(struct device *pd)
drv_data->adapter.master_xfer = mv64xxx_i2c_xfer;
drv_data->adapter.dev.parent = pd;
- drv_data->adapter.nr = pd->id;
+ drv_data->adapter.nr = -1;
drv_data->adapter.dev.of_node = pd->of_node;
mv64xxx_i2c_hw_init(drv_data);
diff --git a/drivers/i2c/busses/i2c-rockchip.c b/drivers/i2c/busses/i2c-rockchip.c
index ce029d148f..a7bd66781f 100644
--- a/drivers/i2c/busses/i2c-rockchip.c
+++ b/drivers/i2c/busses/i2c-rockchip.c
@@ -432,7 +432,7 @@ static int rk_i2c_probe(struct device *dev)
return dev_err_probe(dev, PTR_ERR(i2c->clk), "Can't get bus clk\n");
i2c->adapter.master_xfer = rockchip_i2c_xfer;
- i2c->adapter.nr = dev->id;
+ i2c->adapter.nr = -1;
i2c->adapter.dev.parent = dev;
i2c->adapter.dev.of_node = np;
diff --git a/drivers/i2c/busses/i2c-stm32.c b/drivers/i2c/busses/i2c-stm32.c
index 1be52b3dd9..4d40ca3b51 100644
--- a/drivers/i2c/busses/i2c-stm32.c
+++ b/drivers/i2c/busses/i2c-stm32.c
@@ -941,7 +941,7 @@ static int __init stm32_i2c_probe(struct device *dev)
/* Setup stm32_i2c driver structure */
stm32_i2c->adapter.master_xfer = stm32_i2c_xfer;
- stm32_i2c->adapter.nr = dev->id;
+ stm32_i2c->adapter.nr = -1;
stm32_i2c->adapter.dev.parent = dev;
stm32_i2c->adapter.dev.of_node = dev->of_node;
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index f86f64f573..4271a22f83 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -654,7 +654,7 @@ static int tegra_i2c_probe(struct device *dev)
i2c_dev->adapter.master_xfer = tegra_i2c_xfer;
i2c_dev->adapter.dev.parent = dev;
- i2c_dev->adapter.nr = dev->id;
+ i2c_dev->adapter.nr = -1;
i2c_dev->adapter.dev.of_node = dev->of_node;
ret = i2c_add_numbered_adapter(&i2c_dev->adapter);
--
2.39.5
next prev parent reply other threads:[~2024-10-25 7:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-25 7:30 [PATCH 0/3] I2C: assign bus numbers from device tree Sascha Hauer
2024-10-25 7:30 ` Sascha Hauer [this message]
2024-10-25 13:43 ` [PATCH 1/3] i2c: set adapter.nr explicitly to -1 Alexander Shiyan
2024-10-28 12:11 ` Sascha Hauer
2024-10-25 7:30 ` [PATCH 2/3] i2c: get adapter.nr from device tree Sascha Hauer
2024-10-25 7:30 ` [PATCH 3/3] i2c: start dynamic I2C bus numbers at 32 Sascha Hauer
2024-10-28 12:11 ` [PATCH 0/3] I2C: assign bus numbers from device tree Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241025-i2c-busnum-v1-1-332d9257eafe@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox