mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Peter Rosin <peda@lysator.liu.se>
Cc: Andi Shyti <andi.shyti@kernel.org>,
	Wolfram Sang <wsa+renesas@sang-engineering.com>,
	linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
	Bart Van Assche <bvanassche@acm.org>
Subject: [PATCH 3/3] i2c: mux: pca954x: Report deselect failures
Date: Fri,  6 Nov 2026 12:33:22 -0800	[thread overview]
Message-ID: <b7b0ecf4d922595ac1b4b2672405f28189afc889.1793997098.git.bvanassche@acm.org> (raw)
In-Reply-To: <cover.1793997098.git.bvanassche@acm.org>

The i2c-mux core ignores the return value of the deselect callback.
Hence, if programming the mux into its idle state fails, the failure
goes unnoticed and a channel may remain connected until the next
transfer reprograms the mux. Log a rate-limited warning if
pca954x_deselect_mux() fails.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/i2c/muxes/i2c-mux-pca954x.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c
index 91df2d2fa2b7..45a7d841e7cf 100644
--- a/drivers/i2c/muxes/i2c-mux-pca954x.c
+++ b/drivers/i2c/muxes/i2c-mux-pca954x.c
@@ -359,7 +359,21 @@ static int pca954x_set_idle_state(struct i2c_mux_core *muxc)
 
 static int pca954x_deselect_mux(struct i2c_mux_core *muxc, u32 chan)
 {
-	return pca954x_set_idle_state(muxc);
+	struct pca954x *data = i2c_mux_priv(muxc);
+	int ret;
+
+	ret = pca954x_set_idle_state(muxc);
+	/*
+	 * The i2c-mux core ignores the deselect return value. Report failures
+	 * since these may leave a channel connected until the next transfer
+	 * reprograms the mux.
+	 */
+	if (ret < 0)
+		dev_warn_ratelimited(&data->client->dev,
+				     "failed to deselect channel %u: %d\n",
+				     chan, ret);
+
+	return ret;
 }
 
 static ssize_t idle_state_show(struct device *dev,

      parent reply	other threads:[~2026-11-06 20:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06 20:33 [PATCH 0/3] i2c: mux: pca954x: Track unknown mux state and report " Bart Van Assche
2026-11-06 20:33 ` [PATCH 1/3] i2c: mux: pca954x: Track unknown channel state Bart Van Assche
2026-11-06 20:33 ` [PATCH 2/3] i2c: mux: pca954x: Introduce pca954x_set_idle_state() Bart Van Assche
2026-11-06 20:33 ` Bart Van Assche [this message]

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=b7b0ecf4d922595ac1b4b2672405f28189afc889.1793997098.git.bvanassche@acm.org \
    --to=bvanassche@acm.org \
    --cc=andi.shyti@kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peda@lysator.liu.se \
    --cc=wsa+renesas@sang-engineering.com \
    /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

all inboxes | Powered by JetHome®