From nobody Fri Apr 3 17:37:38 2026 Received: from mx0a-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 542393B19AC for ; Mon, 23 Mar 2026 16:12:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.135.77 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774282329; cv=none; b=DIZuXqZtg+43FRfNZ5UlWafPStUItK/MoVck+vIu1modIpEfq0RpWcOl+Gvgf1gpCL9SzIR93dzrxnL4v43efIXrCnw/JTKEVzo8OXo9PcZgpwVuf1iq4xrZU9NEO8i9w8GhpEychOrzjtkIH0QMYhE5mgdd88j32D4RsZQ2x+I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774282329; c=relaxed/simple; bh=3Pb2fafyWjb4Ni826KHR4JgIYz8ThnNJh5Q6cXJbGqE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=JRgH3ysNPfEjDxdSZbPHvA/nZ5iorQe1pUcQdREjDxa6MN2HXVpxUmk2v8GbvCrgM+gGMvU07qDvP8tP0WSQeSj9GKL63+rdsqV02wxLLQUXkzJ6XITfQ2YW1QBFlH2ou7kpH4ENm2BOjnvo5+boPYLZu5uM3iU6kNdXlGfpE7c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=analog.com; spf=pass smtp.mailfrom=analog.com; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b=s5WodNUr; arc=none smtp.client-ip=148.163.135.77 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=analog.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=analog.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b="s5WodNUr" Received: from pps.filterd (m0516787.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62NETu6c2269582; Mon, 23 Mar 2026 12:11:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=DKIM; bh=jqQ01 oRDr35TiwU4wo4xjhtddDhKPHKqduRPfZ8Lx7s=; b=s5WodNUrzJb/8OvBvrNUL Ca/d474f5uOOI03ITXZZY+rYXNDWx40PCZIAk10c7aWDwcLgJckZ4Ezt3BtkLW6s XbmCId+BDYwOJUO8gIiy7x3xpYi2xsDsXRJPQmaiPaOOF3OOUUzDNH67b/rgwNXs O4KkoPAcUmpFTZHDSPCQpsfLpVaH9JpYikPrFaPhf8OM2F/ptJOqiQE/hpZ7cohA 30dZelulx56+PEhcKV783So9KspAWpERaVmIplWbVSLKkSFR4t1CMaXJ2VG1O46i YZ8MKOXuz6iPACEs3FmEkFqNaOhEG57snpbjk8k74ei1bwq05ndSCcAn1TlEaI5h A== Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 4d2cnew41g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Mar 2026 12:11:53 -0400 (EDT) Received: from ASHBMBX8.ad.analog.com (ASHBMBX8.ad.analog.com [10.64.17.5]) by nwd2mta4.analog.com (8.14.7/8.14.7) with ESMTP id 62NGBqDF044712 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 23 Mar 2026 12:11:52 -0400 Received: from ASHBCASHYB4.ad.analog.com (10.64.17.132) by ASHBMBX8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.37; Mon, 23 Mar 2026 12:11:51 -0400 Received: from ASHBMBX9.ad.analog.com (10.64.17.10) by ASHBCASHYB4.ad.analog.com (10.64.17.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.37; Mon, 23 Mar 2026 12:11:51 -0400 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server id 15.2.1748.37 via Frontend Transport; Mon, 23 Mar 2026 12:11:51 -0400 Received: from HYB-DlYm71t3hSl.ad.analog.com (HYB-DlYm71t3hSl.ad.analog.com [10.44.3.69] (may be forged)) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 62NGBYnt019356; Mon, 23 Mar 2026 12:11:48 -0400 From: Jorge Marques Date: Mon, 23 Mar 2026 17:11:31 +0100 Subject: [PATCH v3 3/5] i3c: master: Move bus_init error suppression Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260323-ad4062-positive-error-fix-v3-3-30bdc68004be@analog.com> References: <20260323-ad4062-positive-error-fix-v3-0-30bdc68004be@analog.com> In-Reply-To: <20260323-ad4062-positive-error-fix-v3-0-30bdc68004be@analog.com> To: Alexandre Belloni , Frank Li , =?utf-8?q?Przemys=C5=82aw_Gaj?= CC: , , "Dan Carpenter" , Jonathan Cameron , Jorge Marques , Adrian Hunter X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1774282294; l=3409; i=jorge.marques@analog.com; s=20250303; h=from:subject:message-id; bh=3Pb2fafyWjb4Ni826KHR4JgIYz8ThnNJh5Q6cXJbGqE=; b=f5V8y8/jg6vSxWtZXhI+qJqLtHol0PYp+sP9lKFx/UVVrRH1II66iijG8l+5plhXMkvIzgt2T AlJoR8VxdLYBGfiQ2Eo8whuFiTNfILCU/wN3bBzWklAWszB6dpuq3PW X-Developer-Key: i=jorge.marques@analog.com; a=ed25519; pk=NUR1IZZMH0Da3QbJ2tBSznSPVfRpuoWdhBzKGSpAdbg= X-ADIRuleOP-NewSCL: Rule Triggered X-Authority-Analysis: v=2.4 cv=UcVciaSN c=1 sm=1 tr=0 ts=69c16649 cx=c_pps a=3WNzaoukacrqR9RwcOSAdA==:117 a=3WNzaoukacrqR9RwcOSAdA==:17 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=0sLvza09kfJOxVLZPwjg:22 a=OmVn7CZJonkx5R5zMQLL:22 a=8AirrxEcAAAA:8 a=QyXUC8HyAAAA:8 a=gAnH3GRIAAAA:8 a=dlK5iWcZi1ZAZcL_4pgA:9 a=QEXdDO2ut3YA:10 a=ST-jHhOKWsTCqRlWije3:22 X-Proofpoint-ORIG-GUID: c6rMEoqYcBcZxjeOtRHM4RHyHXU1PDPw X-Proofpoint-GUID: c6rMEoqYcBcZxjeOtRHM4RHyHXU1PDPw X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzIzMDEyMyBTYWx0ZWRfX8ao5wzvbMO9A jtx5G7CBqgJS2802xpFcvpgm98cXmOh3ANsmJAigqsXAbTCK1s7D3cHnee01VV2QbFYrX8j97/R C/N60djFrLPW3DxZ8ZtR6HMaz0uf6mNsOEXJLryqj5HK11Zy18qVFPt5CAFYPb6Jpi24RNe1kE+ HQrBv9Rk2L3PMysrZuBiM8vQhHj/227TNbfK3L/hJbm/sha3Wg8PoDybPGJ8dtt9fE3QbrHjggx i1m7ZO2stiLeCXOS++Nj4SeS+kJmXqm6kvA9NKbaXBCdsCLzdvZsaxvQf6YNRU5pLhbXmuwrY9J fr+JeGC5EaTraDhOTOisNbP8zNbBS6JobJmqm44leNXCZ8cPgv3PTqqUd643VkyPfRH/XGX0RN1 JHgQVQQWZrrEpvWAYvPhJh+mNyTq5o+jwHc2TTj54FGniPO1+QdaL+RsdnHARIxer3p6Y/fTVWb D2d/Dj+UxaFRqoH/1ZQ== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-23_04,2026-03-23_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=0 phishscore=0 malwarescore=0 spamscore=0 clxscore=1011 bulkscore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2603050001 definitions=main-2603230123 Prepare to fix improper Mx positive error propagation in later commits by handling Mx error codes where the i3c_ccc_cmd command is allocated. 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. Add bool suppress_m2 argument to i3c_master_enec_disec_locked() and update the call site at i3c_master_bus_init() with the exact corner case to not require propagating positive Mx error codes. Other call site should not suppress the error code, for example, if a driver requests to peripheral to disable events and the transfer is not acknowledged, this is an error and should not proceed. Reviewed-by: Frank Li Reviewed-by: Adrian Hunter Signed-off-by: Jorge Marques --- drivers/i3c/master.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index 1e2c086a24ac2..b80f7528948ab 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -1059,7 +1059,8 @@ int i3c_master_entdaa_locked(struct i3c_master_contro= ller *master) EXPORT_SYMBOL_GPL(i3c_master_entdaa_locked); =20 static int i3c_master_enec_disec_locked(struct i3c_master_controller *mast= er, - u8 addr, bool enable, u8 evts) + u8 addr, bool enable, u8 evts, + bool suppress_m2) { struct i3c_ccc_events *events; struct i3c_ccc_cmd_dest dest; @@ -1079,6 +1080,9 @@ static int i3c_master_enec_disec_locked(struct i3c_ma= ster_controller *master, ret =3D i3c_master_send_ccc_cmd_locked(master, &cmd); i3c_ccc_cmd_dest_cleanup(&dest); =20 + if (suppress_m2 && ret && cmd.err =3D=3D I3C_ERROR_M2) + ret =3D 0; + return ret; } =20 @@ -1099,7 +1103,7 @@ static int i3c_master_enec_disec_locked(struct i3c_ma= ster_controller *master, int i3c_master_disec_locked(struct i3c_master_controller *master, u8 addr, u8 evts) { - return i3c_master_enec_disec_locked(master, addr, false, evts); + return i3c_master_enec_disec_locked(master, addr, false, evts, false); } EXPORT_SYMBOL_GPL(i3c_master_disec_locked); =20 @@ -1120,7 +1124,7 @@ EXPORT_SYMBOL_GPL(i3c_master_disec_locked); int i3c_master_enec_locked(struct i3c_master_controller *master, u8 addr, u8 evts) { - return i3c_master_enec_disec_locked(master, addr, true, evts); + return i3c_master_enec_disec_locked(master, addr, true, evts, false); } EXPORT_SYMBOL_GPL(i3c_master_enec_locked); =20 @@ -2107,11 +2111,14 @@ static int i3c_master_bus_init(struct i3c_master_co= ntroller *master) goto err_bus_cleanup; } =20 - /* Disable all slave events before starting DAA. */ - ret =3D i3c_master_disec_locked(master, I3C_BROADCAST_ADDR, - I3C_CCC_EVENT_SIR | I3C_CCC_EVENT_MR | - I3C_CCC_EVENT_HJ); - if (ret && ret !=3D I3C_ERROR_M2) + /* + * Disable all slave events before starting DAA. When no active device + * is on the bus, returns Mx error code M2, this error is ignored. + */ + ret =3D i3c_master_enec_disec_locked(master, I3C_BROADCAST_ADDR, false, + I3C_CCC_EVENT_SIR | I3C_CCC_EVENT_MR | + I3C_CCC_EVENT_HJ, true); + if (ret) goto err_bus_cleanup; =20 /* --=20 2.51.1