mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: "open list:BAREBOX" <barebox@lists.infradead.org>
Subject: [PATCH 3/3] i2c: start dynamic I2C bus numbers at 32
Date: Fri, 25 Oct 2024 09:30:26 +0200	[thread overview]
Message-ID: <20241025-i2c-busnum-v1-3-332d9257eafe@pengutronix.de> (raw)
In-Reply-To: <20241025-i2c-busnum-v1-0-332d9257eafe@pengutronix.de>

To avoid clashes with bus numbers derived from device tree let's start
the dynamically assigned bus numbers at 32.

Usually the SoC internal I2C controllers with fixed bus numbers are
registered before any other controllers, but with deep probe support
this is no longer always true. In my case I saw a HDMI internal I2C
controller registered before some SoC controller messing up the
numbering.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/i2c/i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/i2c.c b/drivers/i2c/i2c.c
index 4eed7fb5c6..d19506af26 100644
--- a/drivers/i2c/i2c.c
+++ b/drivers/i2c/i2c.c
@@ -711,7 +711,7 @@ int i2c_add_numbered_adapter(struct i2c_adapter *adapter)
 	if (adapter->nr < 0) {
 		int nr;
 
-		for (nr = 0;; nr++)
+		for (nr = 32;; nr++)
 			if (!i2c_get_adapter(nr))
 				break;
 		adapter->nr = nr;

-- 
2.39.5




  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 ` [PATCH 1/3] i2c: set adapter.nr explicitly to -1 Sascha Hauer
2024-10-25 13:43   ` 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 ` Sascha Hauer [this message]
2024-10-28 12:11 ` [PATCH 0/3] I2C: assign bus numbers " 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-3-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