From nobody Fri Oct 3 01:10:47 2025 Received: from mail-43172.protonmail.ch (mail-43172.protonmail.ch [185.70.43.172]) (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 431B13081A1 for ; Tue, 9 Sep 2025 07:11:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.70.43.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757401899; cv=none; b=nn2hQGiC6YSRUN4T41zcOywvPMRpP0+xEFWqGHKl+skaVzSoELfMCI99dDic3HzEaw5h2D/1YPchizacuhYX8FYBVaR+qAnQh1IWz9fKkrVolmisPKTxJG+mPZHWd3jr8tLXCCc0ZLxFMNYwdzb/Sdk4pgaFKHEs9RDMZa/tLoM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757401899; c=relaxed/simple; bh=OL3zTc++fWocVV76N9Qrx3mPmqq+2NTo3NP+aQUzDpI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CQ2N/ZuakWAYr7iUUv6Wlc7q8vROLyCDLmDw+1Kdg3xeIrTUuaV5WdMl9VeLhNF0X0ELCKRMUbRfLURUpdmyPkGyjyFuk+06D/qFRP+MX6l4qW+soFplWk+VbHUpCWBgdo4GmxTpSM1bQaCkPc0C75PTHocXoMsps3pr5mgCLG8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=geanix.com; spf=pass smtp.mailfrom=geanix.com; dkim=pass (2048-bit key) header.d=geanix.com header.i=@geanix.com header.b=iFDQVoRg; arc=none smtp.client-ip=185.70.43.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=geanix.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=geanix.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=geanix.com header.i=@geanix.com header.b="iFDQVoRg" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=geanix.com; s=protonmail2; t=1757401891; x=1757661091; bh=tceitGNVxLxyezCWiChxK4zQKtJl6rtYJ4s3FymhP8g=; h=From:Date:Subject:Message-Id:References:In-Reply-To:To:Cc:From:To: Cc:Date:Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=iFDQVoRgFHYP2++0Dl2aN7UgDIawbjp7S9qyyqgZF5NsFyPgI6vaYgFKr4QeVaMI1 H/HcOBRsrEV1fYfOP8AQOI8xU8z2QBWZNkWhR/IDUbfM0mqdLO7ZIXLD2+iuCwp0UL penLtq0sZpeqHv5C//KrVtQ7Yubt9X1JoFiJ+0gbHew+gXg4rIn+eH2gNNNVQMNjF2 qV3Yeqqo5TkwfsKQaLoawidO1793XoxZz4DsuuUNlEraza4MDw368n4hfRznOpTD4d DaKk/rA07sXT26YbDXaa4mJg92/87aMXJvDGeoHas9DEKxBJxJ+zj9fLwLw70TwXRX U3WdJ0NGCG/eA== X-Pm-Submission-Id: 4cLZk85pLMz1DDs1 From: Sean Nyekjaer Date: Tue, 09 Sep 2025 09:11:09 +0200 Subject: [PATCH v4 3/5] iio: imu: inv_icm42600: Avoid configuring if already pm_runtime suspended 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: <20250909-icm42pmreg-v4-3-2bf763662c5c@geanix.com> References: <20250909-icm42pmreg-v4-0-2bf763662c5c@geanix.com> In-Reply-To: <20250909-icm42pmreg-v4-0-2bf763662c5c@geanix.com> To: Jean-Baptiste Maneyrol , rafael@kernel.org, Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Jean-Baptiste Maneyrol , Jonathan Cameron , Sean Nyekjaer X-Mailer: b4 0.14.2 Do as in suspend, skip resume configuration steps if the device is already pm_runtime suspended. This avoids reconfiguring a device that is already in the correct low-power state and ensures that pm_runtime handles the power state transitions properly. Fixes: 31c24c1e93c3 ("iio: imu: inv_icm42600: add core of new inv_icm42600 = driver") Signed-off-by: Sean Nyekjaer --- drivers/iio/imu/inv_icm42600/inv_icm42600_core.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c b/drivers/iio= /imu/inv_icm42600/inv_icm42600_core.c index 41b275ecc7e25ea0b8cdf59be514cdf8a4957ab4..ee780f530dc8612cd25dc2216b1= 53ef4e8c32b7b 100644 --- a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c +++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c @@ -837,17 +837,15 @@ static int inv_icm42600_suspend(struct device *dev) struct device *accel_dev; bool wakeup; int accel_conf; - int ret; + int ret =3D 0; =20 mutex_lock(&st->lock); =20 st->suspended.gyro =3D st->conf.gyro.mode; st->suspended.accel =3D st->conf.accel.mode; st->suspended.temp =3D st->conf.temp_en; - if (pm_runtime_suspended(dev)) { - ret =3D 0; + if (pm_runtime_suspended(dev)) goto out_unlock; - } =20 /* disable FIFO data streaming */ if (st->fifo.on) { @@ -900,10 +898,13 @@ static int inv_icm42600_resume(struct device *dev) struct inv_icm42600_sensor_state *accel_st =3D iio_priv(st->indio_accel); struct device *accel_dev; bool wakeup; - int ret; + int ret =3D 0; =20 mutex_lock(&st->lock); =20 + if (pm_runtime_suspended(dev)) + goto out_unlock; + /* check wakeup capability */ accel_dev =3D &st->indio_accel->dev; wakeup =3D st->apex.on && device_may_wakeup(accel_dev); --=20 2.50.1