From nobody Mon Feb 9 10:47:57 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (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 1DFED3D7D87 for ; Tue, 20 Jan 2026 09:28:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768901311; cv=none; b=ttpw40Lm4WNNaK+k4TqvOXr9No3IOhkL7at8iqXE7pL5JCNEwA70mNqj6HlE5pqGoOGcBCH6cTsOXV3honFHqWfETBQys+SHy6ryyb30jVDn2MP9z4F/5wFJJ0E5z0o2uEejggUFqxPM94pH4L++JO1PQZpomYHKA8p98yeh96s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768901311; c=relaxed/simple; bh=PVjM2PNzXGXwoYiSLYJT3sWx9HO/aEYFc1+gwEBuGe4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kMFs5b6fhNXCmGhLYKlmjHOueuWvEk3tZvZ5/e9GIVr0SeUS+XwPrkUyMWSoMiXmVk22R7ICB24pOoCUGHD3CdmPlNBgowidbIedwxTzrZunx0W+l8zKIUQCN2c4Er4ZoP+4roXUAXqUkpnVkGZREvDvfmMFrRMdpSj39Oyo0YY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=q6fD+OKt; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="q6fD+OKt" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id AC8DC4E421A6; Tue, 20 Jan 2026 09:28:27 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 81052606AB; Tue, 20 Jan 2026 09:28:27 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 5425F10B6B33B; Tue, 20 Jan 2026 10:28:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1768901306; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=VRA9vpqgY5ftQq8JWOqSr8fWfVsmED17ACQSBqKGVlY=; b=q6fD+OKtVoDjdR01g/HeINntblYokHPqJ/Akd9NQzo4Y3pgCT2VXO1KaaSjciKBzR/VKCu vGar8Gchv4TlpDzeqTWUpSn/aDruYvbelFx6Qq5+40l7MaC0n0/yQNmQT7eux+sYONrNPE u+sQFISobo/879jwOdKWMCcnmdUYRQ/jC5Tz1f+aAwQHpHcNXpG5DvnNQoRQxY/jwo1hmX LNC0muGohnHAKJHbQMJS1z57n5ZHveE2Nozo5jjvy6zSFqUaybKihQ6hfCT5Tn335Tpugv amz5v5cX0HE6Pq0wKIGArYY199UXsPtjuRf9wkOuLaNg5pEdjQzOD9PPHHNuUA== From: =?utf-8?q?Beno=C3=AEt_Monin?= Date: Tue, 20 Jan 2026 10:28:05 +0100 Subject: [PATCH v5 5/6] i2c: designware: Use runtime PM macro for auto-cleanup 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: <20260120-i2c-dw-v5-5-0e34d6d9455c@bootlin.com> References: <20260120-i2c-dw-v5-0-0e34d6d9455c@bootlin.com> In-Reply-To: <20260120-i2c-dw-v5-0-0e34d6d9455c@bootlin.com> To: Andi Shyti , Mika Westerberg , Andy Shevchenko , Jan Dabros , Sebastian Andrzej Siewior , Clark Williams , Steven Rostedt Cc: Thomas Petazzoni , Gregory CLEMENT , =?utf-8?q?Th=C3=A9o_Lebrun?= , Tawfik Bayouk , Vladimir Kondratiev , Dmitry Guzman , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev, =?utf-8?q?Beno=C3=AEt_Monin?= X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 Simplify runtime PM handling in i2c_dw_xfer() by using the pm_runtime_active_auto_try guard. This adds the proper handling for runtime PM resume errors and allows us to get rid of the done and done_nolock labels. Signed-off-by: Beno=C3=AEt Monin Reviewed-by: Andy Shevchenko --- drivers/i2c/busses/i2c-designware-master.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/i2c/busses/i2c-designware-master.c b/drivers/i2c/busse= s/i2c-designware-master.c index a0ff0e2db065..ebebd8e0409c 100644 --- a/drivers/i2c/busses/i2c-designware-master.c +++ b/drivers/i2c/busses/i2c-designware-master.c @@ -912,11 +912,13 @@ i2c_dw_xfer(struct i2c_adapter *adap, struct i2c_msg = *msgs, int num) =20 dev_dbg(dev->dev, "msgs: %d\n", num); =20 - pm_runtime_get_sync(dev->dev); + ACQUIRE(pm_runtime_active_auto_try, pm)(dev->dev); + if (ACQUIRE_ERR(pm_runtime_active_auto_try, &pm)) + return -ENXIO; =20 ret =3D i2c_dw_acquire_lock(dev); if (ret) - goto done_nolock; + return ret; =20 /* * If the I2C_M_STOP is present in some the messages, @@ -930,13 +932,15 @@ i2c_dw_xfer(struct i2c_adapter *adap, struct i2c_msg = *msgs, int num) for (cnt =3D 1; ; cnt++) { if (!i2c_dw_msg_is_valid(dev, msgs_part, cnt - 1)) { ret =3D -EINVAL; - goto done; + break; } =20 if ((msgs_part[cnt - 1].flags & I2C_M_STOP) || (msgs_part + cnt =3D=3D msgs + num)) break; } + if (ret < 0) + break; =20 /* transfer one part up to a STOP */ ret =3D __i2c_dw_xfer_one_part(dev, msgs_part, cnt); @@ -944,12 +948,8 @@ i2c_dw_xfer(struct i2c_adapter *adap, struct i2c_msg *= msgs, int num) break; } =20 -done: i2c_dw_release_lock(dev); =20 -done_nolock: - pm_runtime_put_autosuspend(dev->dev); - if (ret < 0) return ret; return num; --=20 2.52.0