From nobody Fri Oct 3 13:34:15 2025 Received: from mail-106111.protonmail.ch (mail-106111.protonmail.ch [79.135.106.111]) (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 756332EDD58; Mon, 1 Sep 2025 07:49:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=79.135.106.111 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756712980; cv=none; b=dTCqa0BddygTM5rcFjZAQ0gcf+OaWWXwF+0N11jCZNDnsG5iIVxyboBbBawvp/oar/JoXIfcbgTf8k9KOXfMc/0/j2tWsPIRY+eruPzf5U2GHA25TNmWCoKytKAHVwENKRaSvghiJfvcPYnSsWcJ88zh6FFk24bZCrx/aZ4WpaU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756712980; c=relaxed/simple; bh=r9nUuwoD87Rj7kZagZ8izL76U2V+u1v93bacmflcxCQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=htT051N4HET2oL+8raty48V/4DduUe4u/E6a7gRuBYUVHXuB3KZeDqA8d/8Xxwj9l0Gyuuk+K6+Rd1GQ4GxcSW40AFyWpKtb/jTwULV3uPIXFvF5y9USzGCvoM6cPCyDJz7hi1lMo3+RKcqNKKGtyZr3BoK5BZWbf/4v5VTti/s= 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=MRPqy7dq; arc=none smtp.client-ip=79.135.106.111 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="MRPqy7dq" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=geanix.com; s=protonmail2; t=1756712975; x=1756972175; bh=sJIvh1vBl0u9m0tMjb9AY4bqs0pUmjpLM1koudDIegA=; 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=MRPqy7dqWi9pAmW58CWkkZLal/H5XZaGzNSZSUP2pXcINutTuTS4z9i/TmOv6/a9x xdUJw20dYA6PsVAMEMMTwG55fpeI78pyjpaWqwPfv/u4BSzV5txmNsYwwDvcF17FZy ENycMlwlfKFLsIeI8jbEgE3gc+Yp7b7pKWoZTGrc3KFwZXeNGGXqHXlVb1c0TDLhHn qaTKLkD+W6UiYSuSJpFq4I8jiKi/4A9LdwVRzb2VmhbjPHWtYlII+snAjW8RxqGUk4 tORjJqkHUAem5gAsYY9B6pFLPDjRRG2Zw8jtTz4L6B42A6qfNh4IXjnMc0EB5SBxFd vM0z8w+NcWi/Q== X-Pm-Submission-Id: 4cFgxp0vc6z1DDC8 From: Sean Nyekjaer Date: Mon, 01 Sep 2025 09:49:16 +0200 Subject: [PATCH v3 4/5] iio: imu: inv_icm42600: Use devm_regulator_get_enable() for vdd regulator 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: <20250901-icm42pmreg-v3-4-ef1336246960@geanix.com> References: <20250901-icm42pmreg-v3-0-ef1336246960@geanix.com> In-Reply-To: <20250901-icm42pmreg-v3-0-ef1336246960@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 The vdd regulator is not used for runtime power management, so it does not need explicit enable/disable handling. Use devm_regulator_get_enable() to let the regulator be managed automatically by devm. This simplifies the code by removing the manual enable and cleanup logic. Signed-off-by: Sean Nyekjaer Reviewed-by: David Lechner --- drivers/iio/imu/inv_icm42600/inv_icm42600.h | 1 - drivers/iio/imu/inv_icm42600/inv_icm42600_core.c | 29 +++++---------------= ---- 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600.h b/drivers/iio/imu/= inv_icm42600/inv_icm42600.h index 1430ab4f1dea5d5ba6277d74275fc44a6cd30eb8..c8b48a5c5ed0677bb35201d3293= 4936faaf7a1a6 100644 --- a/drivers/iio/imu/inv_icm42600/inv_icm42600.h +++ b/drivers/iio/imu/inv_icm42600/inv_icm42600.h @@ -167,7 +167,6 @@ struct inv_icm42600_state { enum inv_icm42600_chip chip; const char *name; struct regmap *map; - struct regulator *vdd_supply; struct regulator *vddio_supply; int irq; struct iio_mount_matrix orientation; diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c b/drivers/iio= /imu/inv_icm42600/inv_icm42600_core.c index ee780f530dc8612cd25dc2216b153ef4e8c32b7b..4bf436c46f1cfd7e7e1bb911d94= a0a566d63e791 100644 --- a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c +++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c @@ -697,17 +697,6 @@ static int inv_icm42600_enable_regulator_vddio(struct = inv_icm42600_state *st) return 0; } =20 -static void inv_icm42600_disable_vdd_reg(void *_data) -{ - struct inv_icm42600_state *st =3D _data; - const struct device *dev =3D regmap_get_device(st->map); - int ret; - - ret =3D regulator_disable(st->vdd_supply); - if (ret) - dev_err(dev, "failed to disable vdd error %d\n", ret); -} - static void inv_icm42600_disable_vddio_reg(void *_data) { struct inv_icm42600_state *st =3D _data; @@ -765,23 +754,17 @@ int inv_icm42600_core_probe(struct regmap *regmap, in= t chip, return ret; } =20 - st->vdd_supply =3D devm_regulator_get(dev, "vdd"); - if (IS_ERR(st->vdd_supply)) - return PTR_ERR(st->vdd_supply); + ret =3D devm_regulator_get_enable(dev, "vdd"); + if (ret) + return dev_err_probe(dev, ret, + "Failed to get vdd regulator\n"); + + msleep(INV_ICM42600_POWER_UP_TIME_MS); =20 st->vddio_supply =3D devm_regulator_get(dev, "vddio"); if (IS_ERR(st->vddio_supply)) return PTR_ERR(st->vddio_supply); =20 - ret =3D regulator_enable(st->vdd_supply); - if (ret) - return ret; - msleep(INV_ICM42600_POWER_UP_TIME_MS); - - ret =3D devm_add_action_or_reset(dev, inv_icm42600_disable_vdd_reg, st); - if (ret) - return ret; - ret =3D inv_icm42600_enable_regulator_vddio(st); if (ret) return ret; --=20 2.50.1