[PATCH 3/5] i3c: master: Move bus_init error suppression

Adrian Hunter adrian.hunter at intel.com
Tue Mar 10 12:14:30 PDT 2026


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 at 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;
>  
>  	/*
> 




More information about the linux-i3c mailing list