public inbox for linux-i3c@lists.infradead.org
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: "Jorge Marques" <jorge.marques@analog.com>,
	"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
	"Frank Li" <Frank.Li@nxp.com>,
	"Przemysław Gaj" <pgaj@cadence.com>
Cc: <linux-i3c@lists.infradead.org>, <linux-kernel@vger.kernel.org>,
	"Dan Carpenter" <dan.carpenter@linaro.org>,
	Jonathan Cameron <jic23@kernel.org>
Subject: Re: [PATCH 3/5] i3c: master: Move bus_init error suppression
Date: Tue, 10 Mar 2026 21:14:30 +0200	[thread overview]
Message-ID: <6d526ec8-af80-460c-9663-67ed7ceb78bb@intel.com> (raw)
In-Reply-To: <20260308-ad4062-positive-error-fix-v1-3-72d3c5290b4a@analog.com>

On 08/03/2026 18:47, Jorge Marques wrote:
> The CCC DISEC to broadcast address is invoked with
> i3c_master_enec_disec_locked and yields error I3C_ERROR_M2 if there are
> no devices active on the bus. This is expected at the bus initialization
> stage, where it is not known yet that there are no active devices on the
> bus.
> 
> Handle inside i3c_master_enec_disec_locked the exact corner case to not
> require propagating positive Mx error codes.

Commit message has the same issues as patch 1

> 
> Signed-off-by: Jorge Marques <jorge.marques@analog.com>
> ---
>  drivers/i3c/master.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
> index ce1898345810..3e465587c9c7 100644
> --- a/drivers/i3c/master.c
> +++ b/drivers/i3c/master.c
> @@ -1078,6 +1078,15 @@ static int i3c_master_enec_disec_locked(struct i3c_master_controller *master,
>  	ret = i3c_master_send_ccc_cmd_locked(master, &cmd);
>  	i3c_ccc_cmd_dest_cleanup(&dest);
>  
> +	/*
> +	 * If the addr is I3C_BROADCAST_ADDR and enable is false, the return
> +	 * error is cleared if the Mx error is I3C_ERROR_M2, to match the
> +	 * initialization state where there is no active device on the bus.
> +	 */
> +	if (ret && addr == I3C_BROADCAST_ADDR && !enable &&
> +	    cmd.err == I3C_ERROR_M2)
> +		ret = 0;

Seems a bit ugly.  Maybe it would be better to pass down a parameter
to specify caller's requirement for M2 errors e.g.

static int i3c_master_enec_disec_locked(struct i3c_master_controller *master,
					u8 addr, bool enable, u8 evts, bool suppress_m2)
...
	if (ret && suppress_m2 && cmd.err == I3C_ERROR_M2)
		ret = 0;

> +
>  	return ret;
>  }
>  
> @@ -2112,7 +2121,7 @@ static int i3c_master_bus_init(struct i3c_master_controller *master)
>  	ret = i3c_master_disec_locked(master, I3C_BROADCAST_ADDR,
>  				      I3C_CCC_EVENT_SIR | I3C_CCC_EVENT_MR |
>  				      I3C_CCC_EVENT_HJ);
> -	if (ret && ret != I3C_ERROR_M2)
> +	if (ret)
>  		goto err_bus_cleanup;
>  
>  	/*
> 


-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

  reply	other threads:[~2026-03-10 19:14 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-08 16:47 [PATCH 0/5] Fix paths unexpectedly returning Mx error codes Jorge Marques
2026-03-08 16:47 ` [PATCH 1/5] i3c: master: Move rstdaa error suppression Jorge Marques
2026-03-09 11:39   ` Adrian Hunter
2026-03-09 12:17     ` Jorge Marques
2026-03-09 12:34       ` Adrian Hunter
2026-03-10  8:05         ` Jorge Marques
2026-03-10 19:13           ` Adrian Hunter
2026-03-10 19:13   ` Adrian Hunter
2026-03-08 16:47 ` [PATCH 2/5] i3c: master: Move entdaa " Jorge Marques
2026-03-10 19:13   ` Adrian Hunter
2026-03-08 16:47 ` [PATCH 3/5] i3c: master: Move bus_init " Jorge Marques
2026-03-10 19:14   ` Adrian Hunter [this message]
2026-03-08 16:47 ` [PATCH 4/5] i3c: master: Negative error codes at send_ccc_cmd Jorge Marques
2026-03-10 19:14   ` Adrian Hunter
2026-03-08 16:47 ` [PATCH 5/5] i3c: master: adi: Return xfer->ret at send CCC Jorge Marques
2026-03-10 19:15   ` Adrian Hunter
2026-03-12 15:50     ` Jorge Marques

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=6d526ec8-af80-460c-9663-67ed7ceb78bb@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=Frank.Li@nxp.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=dan.carpenter@linaro.org \
    --cc=jic23@kernel.org \
    --cc=jorge.marques@analog.com \
    --cc=linux-i3c@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pgaj@cadence.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