From nobody Sun Jun 14 00:15:00 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 94F0E3C277F; Tue, 5 May 2026 07:31:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777966308; cv=none; b=SbzD6K0MO8YIPXFOiNHhMLzeUk3VZAQrfYGq18fxJ1089Yevjz2+t/K61Z9mXN9ed7nwks9WDntK+BsJanoN1gUPNm0D6Q9AsNvTvohnytzHCnTzTy3pkEh1wGPuLf0oW525uoASoZVVV9jEwcZs0fmBRAjg+z0mG8AvOd0Bl/w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777966308; c=relaxed/simple; bh=w+gBC9LzLfUEZ39E2NnGtPODhMvwLIgz7oHW/1UC2ec=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BqYEJUMVJVh7KpkClw1rJkslzBfSXcxhwcl63ixfFN6fOGrL3Ghg05tyV5SI56+22VFwmBVsvTv1EvfvTOzMnQDYxYza2o47vMtPoJmyjDKmQsULfHe1xgfi550/Atj00yDOAjhjbps78lY9TbdejaUjioY5Zb4n/2jeWDOTa7g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=C5Sp5j0F; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="C5Sp5j0F" Received: by smtp.kernel.org (Postfix) with ESMTPS id 5E0B5C2BCC7; Tue, 5 May 2026 07:31:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777966308; bh=w+gBC9LzLfUEZ39E2NnGtPODhMvwLIgz7oHW/1UC2ec=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=C5Sp5j0F11PZU0U9ufLorYuBOUuyxOG0KpiG72pihJj65zbuN/6WEH5Li1TjaC4e0 0LcN18P6LX3H8ZSXbgH2vMUzXthjDZEGYySfRagnYnYQT7ftRZdt45hyI9izMBuz2D KG9W9ie1ub6WB0wdET47qsMmi7gB2yMeLUzqa6MsWN7Fk+PuEyu0/JluBNlvS+ehtX XYTQGTwSt9nfEjl/hn26i4YAF20SQlEhtrNaOe/4OSfsi2NKF+eHYjunwnFCEtR2nk E04jNEjam4iD1DfySWdHeKxmUohpTNnp+8iU1UhxrJyPtVr+Oc786TgdjX8XTmtOXg gcMdTlnZt3gTg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5123CCD13DA; Tue, 5 May 2026 07:31:48 +0000 (UTC) From: Joshua Crofts via B4 Relay Date: Tue, 05 May 2026 09:31:26 +0200 Subject: [PATCH v5 1/8] iio: light: si1133: reset counter to prevent race condition 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: <20260505-si1133-checkup-v5-1-5df86a9024ed@gmail.com> References: <20260505-si1133-checkup-v5-0-5df86a9024ed@gmail.com> In-Reply-To: <20260505-si1133-checkup-v5-0-5df86a9024ed@gmail.com> To: Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko , Jean-Francois Dagenais , =?utf-8?q?Maxime_Roussin-B=C3=A9langer?= Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Joshua Crofts , Jonathan Cameron , sashiko-bot X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1777966306; l=1385; i=joshua.crofts1@gmail.com; s=20260422; h=from:subject:message-id; bh=rNb20PuoCqb49JFiqKumgMP6bKNErm8C2bsZ39xzPjA=; b=fPBuOnIc113xkJSOTRBQsMc/4rSYmEbRXoPXrycmyJnPwejfbc0izKvkkwvLOA+o3TDqx/QOe NOu8sbaXdhRC/48XfCgBRofxZ0fdFnqzgGP9RyMFGz9c/4zj3U0g63T X-Developer-Key: i=joshua.crofts1@gmail.com; a=ed25519; pk=Xd+UVoRPiiI0K3LHQ2XIcXmO0jvVuFTv9eTx3lgBphI= X-Endpoint-Received: by B4 Relay for joshua.crofts1@gmail.com/20260422 with auth_id=746 X-Original-From: Joshua Crofts Reply-To: joshua.crofts1@gmail.com From: Joshua Crofts Sashiko reported a potential race condition happening when the driver returns an errno after a timeout in the si1133_command() function. The premature exit causes the hardware and software counters to become out of sync by not updating data->rsp_seq, therefore the internal hardware counter keeps incrementing. Fix this by adding a call to si1133_cmd_reset_counter() before returning from timeout. Fixes: e01e7eaf37d8 ("iio: light: introduce si1133") Reported-by: sashiko-bot Closes: https://sashiko.dev/#/message/20260428-si1133-checkup-v2-5-70ad14bf= efe2%40gmail.com Assisted-by: gemini:gemini-3.1-pro-preview Signed-off-by: Joshua Crofts --- drivers/iio/light/si1133.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/iio/light/si1133.c b/drivers/iio/light/si1133.c index 44fa152dbd24c26c97cc778cbe641d92ecd56afa..c88c79202be2e21abb72067426e= 31b6bf97c61cf 100644 --- a/drivers/iio/light/si1133.c +++ b/drivers/iio/light/si1133.c @@ -427,6 +427,11 @@ static int si1133_command(struct si1133_data *data, u8= cmd) dev_warn(dev, "Failed to read command 0x%02x, ret=3D%d\n", cmd, err); + /* + * Reset counter on err to prevent software and hardware + * counters being out of sync. + */ + si1133_cmd_reset_counter(data); goto out; } } --=20 2.47.3 From nobody Sun Jun 14 00:15:00 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A2D463DBD7E; Tue, 5 May 2026 07:31:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777966308; cv=none; b=LDmfBUbMov9h1f/gT82hFfi+W3brp0KmPsKfbXe6RKQWMknJALVgvgxDJ111ddk7WDd8PpeiX6FFnAwZn3jD8anUrEGeK8juV2h9w/4RcZopqHeSGyGIKRAni2QUvc4Xt2hvliGBqNO6uBg/CmGnBaTpyEPPYzupZjtFs443H6Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777966308; c=relaxed/simple; bh=wqz0bKGlNUuLDdzAuyBaUgHWch1GriKqzUUO2K+OxAk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=sFt7A6yBFaVsLaYOziaDMvrY1FhiTZl0PFXxTF5Us4nprNZXL04BClEqPhcsjT+mF3GljyWWqFH/gCrEdtO1yyEjcq7MB9SqOf1H2xTkcQm8tRvA8H6PkBqFWd/HEEYut3UqSnMOYFEmnS70LKNGN4dCvvrifAdhnHFmmnBs05w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=q41P0PKZ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="q41P0PKZ" Received: by smtp.kernel.org (Postfix) with ESMTPS id 6D533C2BCF4; Tue, 5 May 2026 07:31:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777966308; bh=wqz0bKGlNUuLDdzAuyBaUgHWch1GriKqzUUO2K+OxAk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=q41P0PKZe541hRyG1Uy5hUVArCjrITCsXSqOMLclIV/ms0FkoO+TO7K+Q2RfjNpeb kLgkoUi56h8CHvFk6lAi2pvHUqeqTPD3D24knQ2ZxKZjC2dLHhUscJ0OGqWMayw9Ne BBObiuX5XVDWXlIE+NwbDmvPljhz4ZQdITkaOaNOPTnfLWWJOU31GcuYmrYMMb+bkZ V487j6pHzxZThurZM3rmdZwOo/41q0789CF/xGcQ9EZdRSW6oY121F0XOHstOtpVvR MAB/kkbmVWsHzA321Xapwwxdt7cdRvGRcKSgklFqf1IUONtp5RmhnsPY0Hxa4AlfaE v0mA807RibiyA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60B2CFF885A; Tue, 5 May 2026 07:31:48 +0000 (UTC) From: Joshua Crofts via B4 Relay Date: Tue, 05 May 2026 09:31:27 +0200 Subject: [PATCH v5 2/8] iio: light: si1133: prevent race condition on timeout 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: <20260505-si1133-checkup-v5-2-5df86a9024ed@gmail.com> References: <20260505-si1133-checkup-v5-0-5df86a9024ed@gmail.com> In-Reply-To: <20260505-si1133-checkup-v5-0-5df86a9024ed@gmail.com> To: Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko , Jean-Francois Dagenais , =?utf-8?q?Maxime_Roussin-B=C3=A9langer?= Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Joshua Crofts , Jonathan Cameron , sashiko-bot X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1777966306; l=2070; i=joshua.crofts1@gmail.com; s=20260422; h=from:subject:message-id; bh=oL3iK2flDthV/Ohs5rDoVs2xKZo+kx/muq+vmqyUtqM=; b=yHWDw1Q0Rl0UeV0q07guyZThgbvIeEqn7zPX2iJNzNUoXq2304o7wqde7xNZP9wyI5ZlOa4TQ 81EgZephMKUDOXoS8RgDWcs0LiXmn8qht7451R3pk7eSONNNFDiGF0C X-Developer-Key: i=joshua.crofts1@gmail.com; a=ed25519; pk=Xd+UVoRPiiI0K3LHQ2XIcXmO0jvVuFTv9eTx3lgBphI= X-Endpoint-Received: by B4 Relay for joshua.crofts1@gmail.com/20260422 with auth_id=746 X-Original-From: Joshua Crofts Reply-To: joshua.crofts1@gmail.com From: Joshua Crofts Sashiko reported a bug where the si1133_command exits on timeout without halting the sensor or masking the interrupt. If the sensor completes the command later, any subsequent command to the sensor will cause the IRQ handler to complete immediately, returning stale data to the driver all while the command hasn't finished yet, shifting all potential reads in the future. Fix this by masking the IRQ if wait_for_completion_timeout() fails. When initiating a new command, do a dummy read of the IRQ_STATUS register and turn the IRQ back on. Fixes: e01e7eaf37d8 ("iio: light: introduce si1133") Reported-by: sashiko-bot Closes: https://sashiko.dev/#/message/20260428-si1133-checkup-v2-5-70ad14bf= efe2%40gmail.com Assisted-by: gemini:gemini-3.1-pro-preview Signed-off-by: Joshua Crofts --- drivers/iio/light/si1133.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/iio/light/si1133.c b/drivers/iio/light/si1133.c index c88c79202be2e21abb72067426e31b6bf97c61cf..bf7bf0f1631d49a1d04b89f1726= 46e4afaf46438 100644 --- a/drivers/iio/light/si1133.c +++ b/drivers/iio/light/si1133.c @@ -395,8 +395,14 @@ static int si1133_command(struct si1133_data *data, u8= cmd) =20 expected_seq =3D (data->rsp_seq + 1) & SI1133_MAX_CMD_CTR; =20 - if (cmd =3D=3D SI1133_CMD_FORCE) + if (cmd =3D=3D SI1133_CMD_FORCE) { + /* Flush pending IRQs from a previous timeout. */ + regmap_read(data->regmap, SI1133_REG_IRQ_STATUS, &resp); + regmap_write(data->regmap, SI1133_REG_IRQ_ENABLE, + SI1133_IRQ_CHANNEL_ENABLE); + reinit_completion(&data->completion); + } =20 err =3D regmap_write(data->regmap, SI1133_REG_COMMAND, cmd); if (err) { @@ -409,6 +415,7 @@ static int si1133_command(struct si1133_data *data, u8 = cmd) /* wait for irq */ if (!wait_for_completion_timeout(&data->completion, msecs_to_jiffies(SI1133_COMPLETION_TIMEOUT_MS))) { + regmap_write(data->regmap, SI1133_REG_IRQ_ENABLE, 0); err =3D -ETIMEDOUT; goto out; } --=20 2.47.3 From nobody Sun Jun 14 00:15:00 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A44A63DCDA0; Tue, 5 May 2026 07:31:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777966308; cv=none; b=H9btBX+XIUyl82CjDYuvYXxOvW7Ddkk1FA4FUhFL7s/xi2eGhWpZBRW3D2AXQCaoOcLjcorblygDe4NmSa1+tA8pe12NTLISmgfVKso/2SW5qLLsl7+DBviROgvXto3nrrLp8H8VjELBDp3S7VVIg2ihH8wMfavJNhQO0lvvONk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777966308; c=relaxed/simple; bh=9nPDJMjD5krGbgW/NDTBmSr6zU+lGhs9sW3ch11JrR4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NN00uC9jpqxqKmAyGDbjzrprKveigCbr3qFV9Qh5u3CUnfmGl2edQYoxRfbHYohdelAMYh3hQlFSpOHy2mz7EdNcQiuC/OzBcdpZhzu5nE2GnNfTxbJ8TwIhfkx+kWT4HD5gngGCBCge0pyQ6qsF8UhmfCobBcds2AzmcRzgBbU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CPcyxC0Q; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CPcyxC0Q" Received: by smtp.kernel.org (Postfix) with ESMTPS id 79225C2BCFA; Tue, 5 May 2026 07:31:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777966308; bh=9nPDJMjD5krGbgW/NDTBmSr6zU+lGhs9sW3ch11JrR4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=CPcyxC0Q18KWWy6vdruZXKB/jc9yy0qf54isOmfhCRS3FIDGZecFys2Ty2ZnWcD21 U2pYKaxdeIn24s9N6Q8h482kDoHIQBD9Kx9f49c4YWFK9D8Q6/G6q3yK1gdhnL3OOb /EhLJq7XhdWvyOlIx8O6hiA08r6GBxai6cVWnHbU6kI5b66c85OiEZFOE86cQZMJAh ZkNq+f+G6TF+I2qUfIsgX06YndwaNrpcWE1KWARwDji80KUUOMPeS5225Fx/uEhmt+ 1NVqu3KsBR9/4A/3Bqd0vk22nM6ZG/xrif7kwnQsHV0DiAUXjLSAb1PzPGnNzVdMIQ qoOBlpPQpVDlA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6FF94CD3439; Tue, 5 May 2026 07:31:48 +0000 (UTC) From: Joshua Crofts via B4 Relay Date: Tue, 05 May 2026 09:31:28 +0200 Subject: [PATCH v5 3/8] iio: light: si1133: remove unused macros 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: <20260505-si1133-checkup-v5-3-5df86a9024ed@gmail.com> References: <20260505-si1133-checkup-v5-0-5df86a9024ed@gmail.com> In-Reply-To: <20260505-si1133-checkup-v5-0-5df86a9024ed@gmail.com> To: Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko , Jean-Francois Dagenais , =?utf-8?q?Maxime_Roussin-B=C3=A9langer?= Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Joshua Crofts , Jonathan Cameron , Andy Shevchenko X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1777966306; l=1112; i=joshua.crofts1@gmail.com; s=20260422; h=from:subject:message-id; bh=rX7kt+GWclRAq56MxMRYvzG3J4ijOi/XQxyRJ1r3WFc=; b=nLuZ1+sreBH/jHGa0mPLFZ909O4YgL6om/lKIUQv9XIi6c4Ob35BgKLLS1PQKi9x4tP0qE7TG N3JEEY/F0jKB2Lej79CA4bJWTC6IieS/R8PE1YAHG5CcxUk8mVascLI X-Developer-Key: i=joshua.crofts1@gmail.com; a=ed25519; pk=Xd+UVoRPiiI0K3LHQ2XIcXmO0jvVuFTv9eTx3lgBphI= X-Endpoint-Received: by B4 Relay for joshua.crofts1@gmail.com/20260422 with auth_id=746 X-Original-From: Joshua Crofts Reply-To: joshua.crofts1@gmail.com From: Joshua Crofts Remove unused macros unrelated to hardware definition. No functional change. Suggested-by: Andy Shevchenko Reviewed-by: Andy Shevchenko Signed-off-by: Joshua Crofts --- drivers/iio/light/si1133.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/iio/light/si1133.c b/drivers/iio/light/si1133.c index bf7bf0f1631d49a1d04b89f172646e4afaf46438..ed9b3e0a12d66d749f09f570de1= ccdda2174b6ba 100644 --- a/drivers/iio/light/si1133.c +++ b/drivers/iio/light/si1133.c @@ -86,13 +86,9 @@ #define SI1133_CMD_MINSLEEP_US_LOW 5000 #define SI1133_CMD_MINSLEEP_US_HIGH 7500 #define SI1133_CMD_TIMEOUT_MS 25 -#define SI1133_CMD_LUX_TIMEOUT_MS 5000 -#define SI1133_CMD_TIMEOUT_US SI1133_CMD_TIMEOUT_MS * 1000 =20 #define SI1133_REG_HOSTOUT(x) (x) + 0x13 =20 -#define SI1133_MEASUREMENT_FREQUENCY 1250 - #define SI1133_X_ORDER_MASK 0x0070 #define SI1133_Y_ORDER_MASK 0x0007 #define si1133_get_x_order(m) ((m) & SI1133_X_ORDER_MASK) >> 4 --=20 2.47.3 From nobody Sun Jun 14 00:15:00 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A5BF13DDDA3; Tue, 5 May 2026 07:31:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777966308; cv=none; b=Xrz5wKacy33qQgK+9DH6v6/LLvpkw/bEkAugFijImNM8IUqMd8LQ1RJ1duHg48KL1U9DyzKSRJze3n2J/UGejN9rlRXn9iH/8NHNAtDcZkrBItnbL8DdlvT2RmlWPlep9JjX7ZJezekeYpeu+oJF6UUQ8AaBnAgNV8GLwcw37/Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777966308; c=relaxed/simple; bh=a1HtXrmHWmwg6iqEF4PwgsHX2yIgthT2lPb8Qd9AHjI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oECba+4qqV1t4QbDMKQ24EdMiolgxax+gyMYL2YcTWIcZc0akBhMF1vS7NIcsjKyufP0aBr/ivfbQ+WnlxOks8GVhEH/ernyNYwG9vl8BD8hxkVOx/dYzVAd/sfj/iVmr2ikmUF3HWwCFp2Wx7zGV0vOlsMLuCE50bwuI+vADes= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HtlZeZAv; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="HtlZeZAv" Received: by smtp.kernel.org (Postfix) with ESMTPS id 847E3C2BCFB; Tue, 5 May 2026 07:31:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777966308; bh=a1HtXrmHWmwg6iqEF4PwgsHX2yIgthT2lPb8Qd9AHjI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=HtlZeZAv4dmBrRm0DoUaZL0aapxPoiy8ZPyEEotHn+/n+ob71l8SHieqpC8J8OLvT rWpEdJZvgCSSao9NMNW1KvnNMuKYsj6VD6fknPO+bbiL53EPUMcbq3hdTTW0+BwkCd x8BzM1VkXSnZz7x6f0qG1G+KDMfQe7LuiVMGv8NF1dWkp5aV9m0oqTjMeFbwDQR6Y8 UAkWHFHCjzxc9ebYYoZ9+dNID677nHmjpguofVQhtV5Zfy45TexVkfNKw72DMD+G6c v7OGOb9iKR+cZSL1d6lSRnPUVxIVjLYnjXC1SEC3WxpG5cEwXRbfm60kfuzb813Naq 0WJxC2kR5zEzw== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7EF45CD3430; Tue, 5 May 2026 07:31:48 +0000 (UTC) From: Joshua Crofts via B4 Relay Date: Tue, 05 May 2026 09:31:29 +0200 Subject: [PATCH v5 4/8] iio: light: si1133: prefer complex macros enclosed in parenthesis 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: <20260505-si1133-checkup-v5-4-5df86a9024ed@gmail.com> References: <20260505-si1133-checkup-v5-0-5df86a9024ed@gmail.com> In-Reply-To: <20260505-si1133-checkup-v5-0-5df86a9024ed@gmail.com> To: Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko , Jean-Francois Dagenais , =?utf-8?q?Maxime_Roussin-B=C3=A9langer?= Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Joshua Crofts , Jonathan Cameron , Andy Shevchenko X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1777966306; l=2311; i=joshua.crofts1@gmail.com; s=20260422; h=from:subject:message-id; bh=6QJNBw8jW5Iua3EfpJQ1pjs23dcqQGKaFu93Wls4YTs=; b=Kq9L9prMT4yVXUV8dzD4/AJzkoLYjUdCslkzUaJ2NjUae5NB5ZOCg7RQOUKU907+d0h2LHiyj IPt7rSTxzmAA4mEtWusTxkgNfMr2j4noKDRhtAVjdyz7RdOGhieYDUC X-Developer-Key: i=joshua.crofts1@gmail.com; a=ed25519; pk=Xd+UVoRPiiI0K3LHQ2XIcXmO0jvVuFTv9eTx3lgBphI= X-Endpoint-Received: by B4 Relay for joshua.crofts1@gmail.com/20260422 with auth_id=746 X-Original-From: Joshua Crofts Reply-To: joshua.crofts1@gmail.com From: Joshua Crofts Enclose complex macros in parenthesis per checkpatch.pl error to improve code style. Reviewed-by: Andy Shevchenko Signed-off-by: Joshua Crofts --- drivers/iio/light/si1133.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/iio/light/si1133.c b/drivers/iio/light/si1133.c index ed9b3e0a12d66d749f09f570de1ccdda2174b6ba..9abc0a7e2ecf0d2fb1bd3af88eb= 675e9f1be4665 100644 --- a/drivers/iio/light/si1133.c +++ b/drivers/iio/light/si1133.c @@ -50,23 +50,23 @@ #define SI1133_MAX_CMD_CTR 0xF =20 #define SI1133_PARAM_REG_CHAN_LIST 0x01 -#define SI1133_PARAM_REG_ADCCONFIG(x) ((x) * 4) + 2 -#define SI1133_PARAM_REG_ADCSENS(x) ((x) * 4) + 3 -#define SI1133_PARAM_REG_ADCPOST(x) ((x) * 4) + 4 +#define SI1133_PARAM_REG_ADCCONFIG(x) (((x) * 4) + 2) +#define SI1133_PARAM_REG_ADCSENS(x) (((x) * 4) + 3) +#define SI1133_PARAM_REG_ADCPOST(x) (((x) * 4) + 4) =20 #define SI1133_ADCMUX_MASK 0x1F =20 -#define SI1133_ADCCONFIG_DECIM_RATE(x) (x) << 5 +#define SI1133_ADCCONFIG_DECIM_RATE(x) ((x) << 5) =20 #define SI1133_ADCSENS_SCALE_MASK 0x70 #define SI1133_ADCSENS_SCALE_SHIFT 4 #define SI1133_ADCSENS_HSIG_MASK BIT(7) #define SI1133_ADCSENS_HSIG_SHIFT 7 #define SI1133_ADCSENS_HW_GAIN_MASK 0xF -#define SI1133_ADCSENS_NB_MEAS(x) fls(x) << SI1133_ADCSENS_SCALE_SHIFT +#define SI1133_ADCSENS_NB_MEAS(x) (fls(x) << SI1133_ADCSENS_SCALE_SHIFT) =20 #define SI1133_ADCPOST_24BIT_EN BIT(6) -#define SI1133_ADCPOST_POSTSHIFT_BITQTY(x) (x & GENMASK(2, 0)) << 3 +#define SI1133_ADCPOST_POSTSHIFT_BITQTY(x) (((x) & GENMASK(2, 0)) << 3) =20 #define SI1133_PARAM_ADCMUX_SMALL_IR 0x0 #define SI1133_PARAM_ADCMUX_MED_IR 0x1 @@ -87,11 +87,11 @@ #define SI1133_CMD_MINSLEEP_US_HIGH 7500 #define SI1133_CMD_TIMEOUT_MS 25 =20 -#define SI1133_REG_HOSTOUT(x) (x) + 0x13 +#define SI1133_REG_HOSTOUT(x) ((x) + 0x13) =20 #define SI1133_X_ORDER_MASK 0x0070 #define SI1133_Y_ORDER_MASK 0x0007 -#define si1133_get_x_order(m) ((m) & SI1133_X_ORDER_MASK) >> 4 +#define si1133_get_x_order(m) (((m) & SI1133_X_ORDER_MASK) >> 4) #define si1133_get_y_order(m) ((m) & SI1133_Y_ORDER_MASK) =20 #define SI1133_LUX_ADC_MASK 0xE --=20 2.47.3 From nobody Sun Jun 14 00:15:00 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 BCAFF3DFC89; Tue, 5 May 2026 07:31:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777966308; cv=none; b=ByoqVpnzvqrst7NIyEIiJVhCEk11v6I7Zha0E/uSLk/W7ZsULAWRRXGHNdaUkyIxXoTbt0SvTmBiicTORkAl94NerdBfY90TCqrnCD36WHWIFtVf4512kvSwJJ0p9Bab00y1KxCUndehzBzMBt+4mGgJMPbNphdZNKvEid443J0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777966308; c=relaxed/simple; bh=XWni74MDyFatFGyUOYnaQ09SDXms4jLkldIN5i8sZ+s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=o1ZbyvS7opiHREo20eZgBOQUOq80Evb2bHSKZA3uWJ0BaKcYa7fjgr4UqSi6PC2pRQFiFN4iN//eMtRUOV/+EFtmdfMSHRfC9om34XMdWeXreCj3jK/z9oEbqkK6v0Qtuao7fZTaCC50EXfnfwQ5Jb6rucNTi+ab+j2hq5GE7Ew= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=q3z7njpV; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="q3z7njpV" Received: by smtp.kernel.org (Postfix) with ESMTPS id 955A7C2BCF6; Tue, 5 May 2026 07:31:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777966308; bh=XWni74MDyFatFGyUOYnaQ09SDXms4jLkldIN5i8sZ+s=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=q3z7njpV2s4ytYWAWAhaNKuviAsmofmBWUieLHSs+/EB91RPHYdGUrs7pr9rSL0ey B6pkr4pYUaWh/eIGhtpLxI0kX+RT/cSALmSagPo3WhA2NODqIGgMk/OuMyF0S8errL kw1at5+Sli94BALNB4N1w50uI/YA3550NuNXeTMlCo3Ou8l6YbGerI6Xjgh+uKFp1u gmkFTeCd3cVZOj4LE0KwvQkG2J4TWoA1phzrN2FugpvYSl2Uw27snMM/12ptW1yQMy z5aHqkvGOjLINBVuUn3nNUFfOVQNWG4KpWtlssLEi+cw0c8WkIu7F08RBBjo0D7hAr lFfkcFQyEbz6Q== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8DAB8CD342F; Tue, 5 May 2026 07:31:48 +0000 (UTC) From: Joshua Crofts via B4 Relay Date: Tue, 05 May 2026 09:31:30 +0200 Subject: [PATCH v5 5/8] iio: light: si1133: add missing include headers 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: <20260505-si1133-checkup-v5-5-5df86a9024ed@gmail.com> References: <20260505-si1133-checkup-v5-0-5df86a9024ed@gmail.com> In-Reply-To: <20260505-si1133-checkup-v5-0-5df86a9024ed@gmail.com> To: Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko , Jean-Francois Dagenais , =?utf-8?q?Maxime_Roussin-B=C3=A9langer?= Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Joshua Crofts , Jonathan Cameron , Andy Shevchenko X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1777966306; l=1271; i=joshua.crofts1@gmail.com; s=20260422; h=from:subject:message-id; bh=CeOtWRyLAnt/yeaI6Z3dA80zv4Xs6KXVN4dHxPRCD+A=; b=N2nRz16e3NubkB15kCZ6CGC7VeBjMl4UvP/DPKrVN7D3tmRlHNMQlSQLgDeFaXNG4b5Wehg4t i+4VrZ0aCJuDM8j3n8wOJf8kqt2mRaQFqy6peg775yMvk2AIkx8nGDF X-Developer-Key: i=joshua.crofts1@gmail.com; a=ed25519; pk=Xd+UVoRPiiI0K3LHQ2XIcXmO0jvVuFTv9eTx3lgBphI= X-Endpoint-Received: by B4 Relay for joshua.crofts1@gmail.com/20260422 with auth_id=746 X-Original-From: Joshua Crofts Reply-To: joshua.crofts1@gmail.com From: Joshua Crofts Add missing include headers to prevent compilation relying on transient dependencies (array_size.h, bitops.h, completion.h, dev_printk.h, err.h, jiffies.h, math.h, mod_devicetable.h, mutex.h, types.h). Reviewed-by: Andy Shevchenko Signed-off-by: Joshua Crofts --- drivers/iio/light/si1133.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/iio/light/si1133.c b/drivers/iio/light/si1133.c index 9abc0a7e2ecf0d2fb1bd3af88eb675e9f1be4665..ab66a5a9ffb4a89bbba7474b6e9= 84ddb61cfeebe 100644 --- a/drivers/iio/light/si1133.c +++ b/drivers/iio/light/si1133.c @@ -6,11 +6,21 @@ * Copyright 2018 Maxime Roussin-Belanger */ =20 +#include +#include +#include #include +#include +#include #include #include +#include +#include +#include #include +#include #include +#include =20 #include #include --=20 2.47.3 From nobody Sun Jun 14 00:15:00 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 CB5D93E0C54; Tue, 5 May 2026 07:31:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777966308; cv=none; b=MEPq7UwTqsJZe9xgv3d9quMwPxi/h7yJqCZP99rEGPChA/gEFV0iuaakJzESZM0rih2z8RCEbHgGKoXKDwxsC5O6poleMPk23gpz6XlIS/qU2x5Boc5rT1WKyWmFJB0WPqCYRjdSO91DqZTFrtTIEhVGKRpX+swRXGEV/pHuZSM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777966308; c=relaxed/simple; bh=QYAYGJEwMW7Jf0TxlLN7LIeOzPE0BP4v8GEXu9kKBR8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gYf5oXkF1WNq/jiRGLt3PCZ3ghMKQ1ip9QPeRxGtZ+WvvtMOPPatKMEvyej/S50bludEES4RUJf/a4g0+NhVpRxZVy0HcwnXenZ2HOntX24pUcH2MGMZasCg1alBN1bjgb43GONY8S9Gme8l+cbmdzsqDWjR+2CABbXuiDsPJ+I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LPIT58oK; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LPIT58oK" Received: by smtp.kernel.org (Postfix) with ESMTPS id A0A7BC2BCF7; Tue, 5 May 2026 07:31:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777966308; bh=QYAYGJEwMW7Jf0TxlLN7LIeOzPE0BP4v8GEXu9kKBR8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=LPIT58oK4KddT//BaESYpCJx8uIBWr+Djgatozq8s8ScE/dCQbLRZqsHDKXzTtHNy +HZBQpE8htZZJZTMIdTZcLLfImX4vAkPFIOAVMJmcWvkE39XU/uGmK0fLmYJvl3Lsi AUd4vTT9WBM+m6fnrmy1v8+8fOoEd8CWcWqSXy0ycm3XWzjuMW/PdNfnipfJXbnhKM tx38rcd9TnPHOYrTEB8rIlsh3o0AoajZkRvrIVxd7vLRUX5z1aAhTRpGU5OTW7UDTq iu9RRu9GMEQfokZsIXYflUXzyWvI14/19noGvG+AzZmg1wXd9Ic8PyMXz989jrDvQT GKSA4+dMBg10Q== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9CB67FF885A; Tue, 5 May 2026 07:31:48 +0000 (UTC) From: Joshua Crofts via B4 Relay Date: Tue, 05 May 2026 09:31:31 +0200 Subject: [PATCH v5 6/8] iio: light: si1133: group generic headers 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: <20260505-si1133-checkup-v5-6-5df86a9024ed@gmail.com> References: <20260505-si1133-checkup-v5-0-5df86a9024ed@gmail.com> In-Reply-To: <20260505-si1133-checkup-v5-0-5df86a9024ed@gmail.com> To: Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko , Jean-Francois Dagenais , =?utf-8?q?Maxime_Roussin-B=C3=A9langer?= Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Joshua Crofts , Jonathan Cameron , Andy Shevchenko X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1777966306; l=967; i=joshua.crofts1@gmail.com; s=20260422; h=from:subject:message-id; bh=CyDeEKtkFccpwJ3bAqhSZpMHdjVdEnGrKvEeSFlutZs=; b=UvL6fjz2EWCNauJqsLzZy3tO4q6Kcq5xo4G5XqljinORp7KAnbhH2Y3m9IFBdjxrFYGMCyloB Bazw7FygYZcAMobnKxH8voSbrHPW2IWNNl6e9PRpyN/+rjpfaLV4KGG X-Developer-Key: i=joshua.crofts1@gmail.com; a=ed25519; pk=Xd+UVoRPiiI0K3LHQ2XIcXmO0jvVuFTv9eTx3lgBphI= X-Endpoint-Received: by B4 Relay for joshua.crofts1@gmail.com/20260422 with auth_id=746 X-Original-From: Joshua Crofts Reply-To: joshua.crofts1@gmail.com From: Joshua Crofts Group generic include headers to improve code style. No functional change. Reviewed-by: Andy Shevchenko Signed-off-by: Joshua Crofts --- drivers/iio/light/si1133.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/iio/light/si1133.c b/drivers/iio/light/si1133.c index ab66a5a9ffb4a89bbba7474b6e984ddb61cfeebe..fdffdee16e493277d95c369ec2f= 6c0678cf9f61c 100644 --- a/drivers/iio/light/si1133.c +++ b/drivers/iio/light/si1133.c @@ -21,14 +21,12 @@ #include #include #include +#include +#include =20 #include #include =20 -#include - -#include - #define SI1133_REG_PART_ID 0x00 #define SI1133_REG_REV_ID 0x01 #define SI1133_REG_MFR_ID 0x02 --=20 2.47.3 From nobody Sun Jun 14 00:15:00 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 D4B633E1219; Tue, 5 May 2026 07:31:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777966308; cv=none; b=oGs84ehbxoM4PrEoow2/l6CS/CBRPKp5q5lrggbwZPGVbhN1yUOCpzqKabVeLs1Y+4vtDM43+W8XgZ//WAxGOj93zG2ZGdyKwD5YkjiqWAmGdCTeYlg1yfy5XOtOjQSVL8ZOB29yVYx42KTlrN2OwOw8/16Nz0047RRE4hlv7W0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777966308; c=relaxed/simple; bh=pmpyJeIflePapL/RApE/hkgCQoa1DmdL+rEhiYpEbeg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jb+DYll1UKr1JQgE3HOPxOEMC+D4glJMVUXJlBE9PNn4NIMKx7/7j2IY7/LNzZgp7riH7lrO4DDkhrEticChiUjdAK9Mg6ChqB3UgME5k0VR7mJujFH+u9RDYpGECe3lPjv35rViF7s81T/1dTq6iXxv2mb0cJI0fyIb/spN+zM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=g2mETwdV; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="g2mETwdV" Received: by smtp.kernel.org (Postfix) with ESMTPS id B177FC2BCFD; Tue, 5 May 2026 07:31:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777966308; bh=pmpyJeIflePapL/RApE/hkgCQoa1DmdL+rEhiYpEbeg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=g2mETwdV2DXvMTi8pGpPrj8y4gkd53hNC/hEgTm5KPns2L54ELYa32n9KifBDHZPY q+b9DIYEjfQ/CM9Zxz9Es/SZbgupd6VCk9+33ETL4ao6MKpMV7ZuXDVZ+qtMC453fG zjD4F/M6Ofhf0HaI68Yib3vsyx5q/bU4c4QgRC7QTdSXR57fSa//Z1kFuEkjMbHrTb 472+P86jixqLVkdZa1Ed6rLhL5IC9sDnhWTt0D7eFIJZZUh0tQi6L0uVRAHvgYbPRN dyuDPeMEphU5AgTh3SfPtJ/oZJd6csIWvNDYitP1op+gguq7G3LNdO9TUlWZpUGP5e dkUYiQ5AOFdog== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB652CD3439; Tue, 5 May 2026 07:31:48 +0000 (UTC) From: Joshua Crofts via B4 Relay Date: Tue, 05 May 2026 09:31:32 +0200 Subject: [PATCH v5 7/8] iio: light: si1133: add local variable for timeout 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: <20260505-si1133-checkup-v5-7-5df86a9024ed@gmail.com> References: <20260505-si1133-checkup-v5-0-5df86a9024ed@gmail.com> In-Reply-To: <20260505-si1133-checkup-v5-0-5df86a9024ed@gmail.com> To: Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko , Jean-Francois Dagenais , =?utf-8?q?Maxime_Roussin-B=C3=A9langer?= Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Joshua Crofts , Jonathan Cameron X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1777966306; l=1250; i=joshua.crofts1@gmail.com; s=20260422; h=from:subject:message-id; bh=/XJFGcdvil+2we7+TC+ip157GN0rAXA5yY6shTe6uEY=; b=0C7lCRmCfOweFgiVXLhrhvNfCyI0u26mSlQ8O++RVhUHIz35bIcTcpJk/ZJVaqhBIQ9boHZxs AiaKs2OKqsaB61zoA1MJoxxCLHakBnYUycxbbdU49jZYlxMNBo2d8OQ X-Developer-Key: i=joshua.crofts1@gmail.com; a=ed25519; pk=Xd+UVoRPiiI0K3LHQ2XIcXmO0jvVuFTv9eTx3lgBphI= X-Endpoint-Received: by B4 Relay for joshua.crofts1@gmail.com/20260422 with auth_id=746 X-Original-From: Joshua Crofts Reply-To: joshua.crofts1@gmail.com From: Joshua Crofts Add local variable for timeout to improve readability. No functional change. Suggested-by: Jonathan Cameron Signed-off-by: Joshua Crofts --- drivers/iio/light/si1133.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/light/si1133.c b/drivers/iio/light/si1133.c index fdffdee16e493277d95c369ec2f6c0678cf9f61c..a3e4ab25acdc105d3800994f439= 1a7e4291e1c74 100644 --- a/drivers/iio/light/si1133.c +++ b/drivers/iio/light/si1133.c @@ -390,6 +390,7 @@ static int si1133_cmd_reset_counter(struct si1133_data = *data) =20 static int si1133_command(struct si1133_data *data, u8 cmd) { + unsigned long timeout =3D msecs_to_jiffies(SI1133_COMPLETION_TIMEOUT_MS); struct device *dev =3D &data->client->dev; u32 resp; int err; @@ -417,8 +418,7 @@ static int si1133_command(struct si1133_data *data, u8 = cmd) =20 if (cmd =3D=3D SI1133_CMD_FORCE) { /* wait for irq */ - if (!wait_for_completion_timeout(&data->completion, - msecs_to_jiffies(SI1133_COMPLETION_TIMEOUT_MS))) { + if (!wait_for_completion_timeout(&data->completion, timeout)) { regmap_write(data->regmap, SI1133_REG_IRQ_ENABLE, 0); err =3D -ETIMEDOUT; goto out; --=20 2.47.3 From nobody Sun Jun 14 00:15:00 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 0194E3E5ECB; Tue, 5 May 2026 07:31:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777966309; cv=none; b=h1w9r8dfMWNUhBcLqxSujQ22xoiw7RSkiyH3DKYPD78XMAcp+kYPWDzexHZv5FUJxMvs7pqF90CXxk66pDE/XzNh1lvL3HKQh7HjfJsvF/vbYJJTtYCdqbTQQiOtcVKY9ZQo22wSEDzG4CZf9b01jYdGi2r7QAAZq1rQJcaXPo4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777966309; c=relaxed/simple; bh=XB5hQM+QnSdZ7tu7UzZwj6js1QbIpCzsw/liFug3EA8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=I+d4RjK4upEUm/7xt3y6C85gYMa9O2/kcfiGj/5Uy6G2B2qU+xVEj047XwZX2BM0KGrNFg+PKHMRhuAJDHeiEQC4sHiqD834OwCUoFpzymG20k1Ape5ZAhuUqW0FOV8vCR6VZvyJ2FfikSNvY/ZHMkoTWaSp7ynSUjVMfkmT8sc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZeJwF0mM; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZeJwF0mM" Received: by smtp.kernel.org (Postfix) with ESMTPS id D976FC2BCB4; Tue, 5 May 2026 07:31:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777966308; bh=XB5hQM+QnSdZ7tu7UzZwj6js1QbIpCzsw/liFug3EA8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=ZeJwF0mMrq7Ijg3HGk/o9y/6iS3NOM6t+ZNj0zewm/QzIJ+owB4fQ2NkM+a9eFupF ovC8loZ2Lg23zzBcOBwhki5wlogAJhgn3QI2l7M+JQlbnLIGz3cwvQSoczlzEEy+vz 3jh2bInIjV58ia68w3TpEuRm2Jv2y9KHQ3O/4BEzOfWNTSB/2X+o2CnxRO00nagczC u7kCDrmIvalr5ckgdLKOUWzFBiqh4Sp9mWXiBK0W+zLtlf0Oqde+zTOxMvPj48gd4R Fh72KCrslaCK0iZcphQKV56oogx22pjd3IFXL5Iy1O5t6hqZ8s8bbO98HpLQFny3/P tE2sQdKayf8gg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4565FF885A; Tue, 5 May 2026 07:31:48 +0000 (UTC) From: Joshua Crofts via B4 Relay Date: Tue, 05 May 2026 09:31:33 +0200 Subject: [PATCH v5 8/8] iio: light: si1133: use guard(mutex)() macro 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: <20260505-si1133-checkup-v5-8-5df86a9024ed@gmail.com> References: <20260505-si1133-checkup-v5-0-5df86a9024ed@gmail.com> In-Reply-To: <20260505-si1133-checkup-v5-0-5df86a9024ed@gmail.com> To: Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko , Jean-Francois Dagenais , =?utf-8?q?Maxime_Roussin-B=C3=A9langer?= Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Joshua Crofts , Jonathan Cameron , Andy Shevchenko X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1777966306; l=2133; i=joshua.crofts1@gmail.com; s=20260422; h=from:subject:message-id; bh=q9fHJV5P2E/vSw5lDP/3o1uwN8xdWKVmo0vsI+GT2Fw=; b=mW+2K4J6BbmiguHUsxU1fmqeB8QYVI+8lOg0/pKnvKDKOQS8vuc93Sd7LBiedqgWw/Q+IdPA+ 2jVQldFpe1CDTFxcrO0y1WEnydoq38XMRZ+et2oUeq8nf7B1cLATtDK X-Developer-Key: i=joshua.crofts1@gmail.com; a=ed25519; pk=Xd+UVoRPiiI0K3LHQ2XIcXmO0jvVuFTv9eTx3lgBphI= X-Endpoint-Received: by B4 Relay for joshua.crofts1@gmail.com/20260422 with auth_id=746 X-Original-From: Joshua Crofts Reply-To: joshua.crofts1@gmail.com From: Joshua Crofts Remove mutex_lock()/mutex_unlock() and goto instances and add guard(mutex)() macro to modernize driver and improve mutex handling. Reviewed-by: Andy Shevchenko Signed-off-by: Joshua Crofts --- drivers/iio/light/si1133.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/iio/light/si1133.c b/drivers/iio/light/si1133.c index a3e4ab25acdc105d3800994f4391a7e4291e1c74..55660dccfc7956e77b1d8105b72= 61221176c1736 100644 --- a/drivers/iio/light/si1133.c +++ b/drivers/iio/light/si1133.c @@ -8,6 +8,7 @@ =20 #include #include +#include #include #include #include @@ -396,7 +397,7 @@ static int si1133_command(struct si1133_data *data, u8 = cmd) int err; int expected_seq; =20 - mutex_lock(&data->mutex); + guard(mutex)(&data->mutex); =20 expected_seq =3D (data->rsp_seq + 1) & SI1133_MAX_CMD_CTR; =20 @@ -413,19 +414,18 @@ static int si1133_command(struct si1133_data *data, u= 8 cmd) if (err) { dev_warn(dev, "Failed to write command 0x%02x, ret=3D%d\n", cmd, err); - goto out; + return err; } =20 if (cmd =3D=3D SI1133_CMD_FORCE) { /* wait for irq */ if (!wait_for_completion_timeout(&data->completion, timeout)) { regmap_write(data->regmap, SI1133_REG_IRQ_ENABLE, 0); - err =3D -ETIMEDOUT; - goto out; + return -ETIMEDOUT; } err =3D regmap_read(data->regmap, SI1133_REG_RESPONSE0, &resp); if (err) - goto out; + return err; } else { err =3D regmap_read_poll_timeout(data->regmap, SI1133_REG_RESPONSE0, resp, @@ -443,7 +443,7 @@ static int si1133_command(struct si1133_data *data, u8 = cmd) * counters being out of sync. */ si1133_cmd_reset_counter(data); - goto out; + return err; } } =20 @@ -454,9 +454,6 @@ static int si1133_command(struct si1133_data *data, u8 = cmd) data->rsp_seq =3D expected_seq; } =20 -out: - mutex_unlock(&data->mutex); - return err; } =20 --=20 2.47.3