From nobody Sun Oct 5 07:26:03 2025 Received: from mail-0301.mail-europe.com (mail-0301.mail-europe.com [188.165.51.139]) (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 5F1522868B0 for ; Fri, 8 Aug 2025 15:58:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=188.165.51.139 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754668686; cv=none; b=b71behcFknspvu2buRTzuPGs7ZeahPqd1i+dpkPVave0NUFbenDG8WmMK7y2Ib3aSP59MLXXIowszwUWllib3Ff6ykejRy/bSjEqdd+SFZ++VFJUy6KoaACs/zrj9xQ9ajVkBao5T790bg6tNzfxd8kFBgQb4A26ACn0gjxiW/A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754668686; c=relaxed/simple; bh=uYqP9SSVha25TgfnfTcKOUq9hhB9ISoe8o7K384Zaus=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dhj04R8TztozErC9Wcmy970zXfrdSNBzFmVf5C8kCTRia862BNGO3dQk549fP3I9pD8UL5r0LFHpk76teLab87JhzX5Dv63kMvmK7sJJ0nt6miWvCfkkq1sha/gCFExUq8c+R99r0pMhCOtZQvbpL0LPqcosMG3p4omzMP9A8zs= 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=QK/HRNHS; arc=none smtp.client-ip=188.165.51.139 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="QK/HRNHS" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=geanix.com; s=protonmail; t=1754668673; x=1754927873; bh=2dzssqd2MPlmKUNBjcZT8UxbSJiIXNPn042fkwsXbyw=; 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=QK/HRNHSrtJOCLaafumIF/fvpz6xpUkr1c0J5xArbykXjHdFMY5nvwJGZ9E32AeMV 4aT6P0ztgTl/aeno6fsWAOpmlCe4MrVZEqtygmd9Z5Pz48DpsvPM9xPizoEus3lUa3 +Mf/WeplA+UwlJJ2qfXyzFfq9Ys2SFAxPg1ceC0NpgWEMb4yVxfy7xjoeOZ/ECFb1X 3nuGK61Qtxyud85wlyy4sbkNNW7/J/bCQt0u2Su70Z4RmbHwCIAUbO0/BT9249abe7 Cb9Hnm7wm76+HZequk6K0gOeJnkpOm15NhO7pnMMZJp3W9voz/0hnE4hsHkUqlcNtM kqnWUD0p1crCw== X-Pm-Submission-Id: 4bz7wG4xX2z1DDBg From: Sean Nyekjaer Date: Fri, 08 Aug 2025 17:57:43 +0200 Subject: [PATCH v2 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: <20250808-icm42pmreg-v2-3-a480279e7721@geanix.com> References: <20250808-icm42pmreg-v2-0-a480279e7721@geanix.com> In-Reply-To: <20250808-icm42pmreg-v2-0-a480279e7721@geanix.com> To: Jean-Baptiste Maneyrol , Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko Cc: linux-iio@vger.kernel.org, linux-kernel@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 bb0dbbb7ad03bb57ffd3180785a686f2cdb5c845..39ba94e2e473abe7af64c655f03= 99bd756ddfe11 100644 --- a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c +++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c @@ -835,17 +835,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) { @@ -898,10 +896,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