From nobody Fri Jun 12 21:31:55 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 32B613839B0; Tue, 12 May 2026 10:57:53 +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=1778583473; cv=none; b=K/GDz4s9PiBRYVLQG+YeAPAgL1zYkqNJLpOxiMSRajk1E4CwTIsWCr0FR4t7N8izU1Xxtq9Gl0qLgq1PJpQfX1PHTgnh6DIvxgUzYLNd8uielHcBRqkS2vJPoPuSnsGefjQJJMFUUHlodAkU94UdV/kx45Ju7EPJM6Jcl8z4p94= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778583473; c=relaxed/simple; bh=6rT0wjV5Mp5NJt3Q/yrwp0wtVx6Rtz1rqHLINeyPuxQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=k2j61av5qrm3i/+gdwBKRmdbsTT98j4Ze2h8zPnextC7ZO0UbmFx/YB97FhfY7Txpf6M5tLy4FV/rfvYdQOJjR/XxPSPG4/NEwwbv0uU+bIOVAWYjb8+AH4wzeQzW+SKgj6Ybulj1sXrsyiGMmKDZdUY5xutgT+v4dnLkH8Lnlc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Jt2Y0lid; 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="Jt2Y0lid" Received: by smtp.kernel.org (Postfix) with ESMTPS id D58C9C2BCF6; Tue, 12 May 2026 10:57:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778583472; bh=6rT0wjV5Mp5NJt3Q/yrwp0wtVx6Rtz1rqHLINeyPuxQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=Jt2Y0lidVjFeLy0gLCJTqFKFhi86CHGKiIiBWVGExUZf1G3awfLxkjhFypzcBWG7n xvCXfv5TU82/U72QIiDeTffYPXjFjfRLIBx+YDKEqMQK5W131LG1lPcKgP0sDpHgmV gUaXRLnPWzRRw/GbpcqYFYoH0Dr7jBUIyndWUB0xD80jnYWK0OVxnw2mcDR/TBNhLn AHxUWIEi5SevBg75uS/c4ZjyEoZ5tS0MR6k0WwAd5xzaU3sDO8M3YHljxVnv1KXC5T gk2UTKiPKsDxyDR8HRt1ft4TAmnrL4CBIxJ7rRchLGRr/NTafXy+1psZXLNZ/aUokg J4UjQB53RLC7g== 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 C378BCD4F21; Tue, 12 May 2026 10:57:52 +0000 (UTC) From: Joshua Crofts via B4 Relay Date: Tue, 12 May 2026 12:57:21 +0200 Subject: [PATCH v2 01/10] iio: light: opt3001: move device registration to end of probe() 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: <20260512-opt3001-cleanup-v2-1-8018cf3a8a0a@gmail.com> References: <20260512-opt3001-cleanup-v2-0-8018cf3a8a0a@gmail.com> In-Reply-To: <20260512-opt3001-cleanup-v2-0-8018cf3a8a0a@gmail.com> To: Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko , Alexander Koch , Michael Hornung Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Joshua Crofts , Sashiko X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1778583471; l=1566; i=joshua.crofts1@gmail.com; s=20260422; h=from:subject:message-id; bh=nHPjQtXZ5RMpyhB4rSm3vBLNZNU5C/mIRnD5ecXS1Bc=; b=6/PIMfcUOxDdRs2DP/ReF8xt/OCjoTdSTgKXfqc2UBjW2HlCSmYeWie3lz4JmV8DWdY0bQi+U QIGFQodeiaDA3FKg4h/dkJvoOCJ0wRwW+F05WMK8lB2RhMAhO2r+VBQ 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 Move devm_iio_device_register() to end of the opt3001_probe() function to prevent a race condition where userspace could interact with the device before the hardware IRQ was set up. Fixes: ac663db3678a ("iio: light: opt3001: enable operation w/o IRQ") Reported-by: Jonathan Cameron Reported-by: Sashiko Closes: https://sashiko.dev/#/patchset/20260511-opt3001-cleanup-v1-0-f7879d= c3455c%40gmail.com?part=3D7 Signed-off-by: Joshua Crofts --- drivers/iio/light/opt3001.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/iio/light/opt3001.c b/drivers/iio/light/opt3001.c index 53bc455b7bad142695d9fecc6cabb934fb3ace0c..3c79e0c4ca32fedf33e318d047d= 6ab3f62b6c03b 100644 --- a/drivers/iio/light/opt3001.c +++ b/drivers/iio/light/opt3001.c @@ -874,12 +874,6 @@ static int opt3001_probe(struct i2c_client *client) iio->modes =3D INDIO_DIRECT_MODE; iio->info =3D &opt3001_info; =20 - ret =3D devm_iio_device_register(dev, iio); - if (ret) { - dev_err(dev, "failed to register IIO device\n"); - return ret; - } - /* Make use of INT pin only if valid IRQ no. is given */ if (irq > 0) { ret =3D request_threaded_irq(irq, NULL, opt3001_irq, @@ -894,6 +888,10 @@ static int opt3001_probe(struct i2c_client *client) dev_dbg(opt->dev, "enabling interrupt-less operation\n"); } =20 + ret =3D devm_iio_device_register(dev, iio); + if (ret) + return dev_err(dev, "failed to register IIO device\n"); + return 0; } =20 --=20 2.47.3 From nobody Fri Jun 12 21:31:55 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 329DE28504D; Tue, 12 May 2026 10:57:53 +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=1778583473; cv=none; b=fdFqwCLD/MmOnI26p4kC7SnjF/UBSiOdeAwM8/Y9pTGAIhSXRt6y0fUZ41gann7dDcJAFHxLMffcGZCS3Y9b9Hlbe5115B0pnNEYEh2hqtRoLjaw3sFbJTwzxnCPO5jVlgPPo1v19d6/pc4T9lE/vOPu6OMYK8dNath2iIDNO4s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778583473; c=relaxed/simple; bh=tlItUifFWfsj0zDd20KYALisIhu+0W+XIM1LsxMLKfg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bFSYP7KCnumPDalHHPNzP3CDbEYwkieI2yKRRgo5fW6dxqINv+7Ew9q2SP5EWRu2SfxipO7erGfpMokC7/nLTXoqOxu6mwyuJB1N9d3gOcSownG06e8lz+z3sYqw6qf6waKXlUf0RjqRe/F2+G3Vn4JNo3XbwKNIKTtLOTWN6mo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LEXNU4dG; 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="LEXNU4dG" Received: by smtp.kernel.org (Postfix) with ESMTPS id E62FBC2BCF5; Tue, 12 May 2026 10:57:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778583473; bh=tlItUifFWfsj0zDd20KYALisIhu+0W+XIM1LsxMLKfg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=LEXNU4dGU8orJWdBdghuGB++EvPUVuZulxNN+rVWv1wcEv1mdCh02zNWJ8vYE8+AZ NOqcLhGcJHsm3/+ts7eekiKElTjKycgkkNu5Nkje7vdKxQXXId33dVMGJY5lIRTf3q sxFxjME58xMfsagaih9yFLLpLFovNPC5Hbx1F86NwxGABAFWg3IKlxgE0WeGUHRmzJ 4m3/1ClyzC6t64NGDTn/lxgVMpmUdGZN0htEaezF1cFIjgHG6uCEXGvMD3aG3AmoI+ /Z/pL5at27r3bTLG3C+AVmxj6kxPZV+GW8r9QxRQtfw2o8yBZzhlSaq2DE8ChvXHJE McsPLSNGcB86w== 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 D6194CD4851; Tue, 12 May 2026 10:57:52 +0000 (UTC) From: Joshua Crofts via B4 Relay Date: Tue, 12 May 2026 12:57:22 +0200 Subject: [PATCH v2 02/10] iio: light: opt3001: make headers conform to iwyu 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: <20260512-opt3001-cleanup-v2-2-8018cf3a8a0a@gmail.com> References: <20260512-opt3001-cleanup-v2-0-8018cf3a8a0a@gmail.com> In-Reply-To: <20260512-opt3001-cleanup-v2-0-8018cf3a8a0a@gmail.com> To: Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko , Alexander Koch , Michael Hornung Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Joshua Crofts X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1778583471; l=1404; i=joshua.crofts1@gmail.com; s=20260422; h=from:subject:message-id; bh=ijeiUs5HBQdNjkWh4WwS9ZTfUT28aBbKAdKEloUkhy8=; b=lakw/ozJZMdiTR1Qbov+ph0nozd1LImRurYgk4l4JQN0i5KH1A/gVh40gXV4RjTVX8FkLegEN I+rmj16iR5pDTuMdTK086ctOFE5KBYjY94rQd2UjRB5jWm7og3Uh/l2 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 kernel.h proxy header, device.h, irq.h, slab.h as they are unnecessary and add missing headers (array_size.h, dev_printk.h, errno.h, jiffies.h, wait.h) to enforce IWYU principle and reduce transitive dependencies. Also, replace bitops.h with bits.h as only the BIT() macro is used. Signed-off-by: Joshua Crofts --- drivers/iio/light/opt3001.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/iio/light/opt3001.c b/drivers/iio/light/opt3001.c index 3c79e0c4ca32fedf33e318d047d6ab3f62b6c03b..7efd92875c3f8c86b00a8aff8fa= b664457399983 100644 --- a/drivers/iio/light/opt3001.c +++ b/drivers/iio/light/opt3001.c @@ -8,18 +8,19 @@ * Based on previous work from: Felipe Balbi */ =20 -#include +#include +#include #include -#include +#include +#include #include #include -#include -#include -#include +#include #include +#include #include -#include #include +#include =20 #include #include --=20 2.47.3 From nobody Fri Jun 12 21:31:55 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 32A7238398B; Tue, 12 May 2026 10:57:53 +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=1778583473; cv=none; b=ohAAl0Zy/LmslWxrm9s1K4xXJ90zCAEzC4lP/24Oy5vusD3IIIKiglghNgDYJAXvOeWs6JJ7pb6Agb1/6ZtwnjYLoByjXs1Ng397VRxfvyzJjvssWpdCsFUlOrQ+iS4sv5w1njC4+zxRBB6XSE+bcpL3QAdaG6ZaKWGOLUmcFuo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778583473; c=relaxed/simple; bh=QHbSxCdazSBxzl8Hq6xYTxEwaoXrcPTFT4d0vykRE/U=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oSlKBe9YJ4JhEe6MjStFaXZAxWWDXkZYrial2TWNNlbc2aKlBDRU8Vv5P6eQJSnjo3ZfEWBXCxrDxpMTCg9fjz6IVAei6CU3CwQFayi5JJJ1C1HHelOHJiyshFb5oDrODqLj1905ofQuI6HZnwghtQUf7bEe3A1CB6qFYA0idpw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SrUJ/b6y; 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="SrUJ/b6y" Received: by smtp.kernel.org (Postfix) with ESMTPS id 0285FC2BCFB; Tue, 12 May 2026 10:57:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778583473; bh=QHbSxCdazSBxzl8Hq6xYTxEwaoXrcPTFT4d0vykRE/U=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=SrUJ/b6yRw/4gx6HsRKwgAIuA74/EgSZO4YN39BkfjO6/7L3I5GkyzmD7YodpZGwU aVhR3URF0yYu1wA7oZ9mhDabkhkzDBN0hZ58dLVPeApW4CL9Hpvtza5pckqBjibMcw wIBxIdWDioUmZKh5T5udzA3nla8j3bnIJD30QYFILA/uP/s+vnTkwHH8fmlER7RFiS CxaEBCVZruyeahpapqjzAsEXZoonPq+Ua7AqCK1yE5mz4eRnCmr8bI2rDW38hzw0h3 nNW7+DnS+1B0OqypR1Vucql2vZOo8e0lwTIEt99BNqBP1KeQIsxoaqcI0aMh5q+VcR GeQ6jzOypFlVQ== 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 EC279CD4F37; Tue, 12 May 2026 10:57:52 +0000 (UTC) From: Joshua Crofts via B4 Relay Date: Tue, 12 May 2026 12:57:23 +0200 Subject: [PATCH v2 03/10] iio: light: opt3001: use macros from bits.h header 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: <20260512-opt3001-cleanup-v2-3-8018cf3a8a0a@gmail.com> References: <20260512-opt3001-cleanup-v2-0-8018cf3a8a0a@gmail.com> In-Reply-To: <20260512-opt3001-cleanup-v2-0-8018cf3a8a0a@gmail.com> To: Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko , Alexander Koch , Michael Hornung Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Joshua Crofts X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1778583471; l=1632; i=joshua.crofts1@gmail.com; s=20260422; h=from:subject:message-id; bh=iX892qeHeNekGLCGmiyvjOL4SHT70l99mvgbcZasL0o=; b=zYDfszESnQe9kQW6ceqWv41z72XjEdoSp5wSCO69CxigjrDT3mPULSYtTHElmMPKsMxgC0A+f 0caXr8acBPNBVqleBIgTwrz4ci4bR3Xi7p+d/subqUdeyy4Yp/P2ljV 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 Use GENMASK() and BIT() macros from bits.h header where it makes sense. While at it, remove unused macro. No functional change. Signed-off-by: Joshua Crofts --- drivers/iio/light/opt3001.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/iio/light/opt3001.c b/drivers/iio/light/opt3001.c index 7efd92875c3f8c86b00a8aff8fab664457399983..6ce1a2d7647a3b9cd8964a27687= 8630d31f61794 100644 --- a/drivers/iio/light/opt3001.c +++ b/drivers/iio/light/opt3001.c @@ -33,17 +33,16 @@ #define OPT3001_MANUFACTURER_ID 0x7e #define OPT3001_DEVICE_ID 0x7f =20 -#define OPT3001_CONFIGURATION_RN_MASK (0xf << 12) +#define OPT3001_CONFIGURATION_RN_MASK GENMASK(15, 12) #define OPT3001_CONFIGURATION_RN_AUTO (0xc << 12) =20 #define OPT3001_CONFIGURATION_CT BIT(11) =20 -#define OPT3001_CONFIGURATION_M_MASK (3 << 9) +#define OPT3001_CONFIGURATION_M_MASK GENMASK(10, 9) #define OPT3001_CONFIGURATION_M_SHUTDOWN (0 << 9) #define OPT3001_CONFIGURATION_M_SINGLE (1 << 9) #define OPT3001_CONFIGURATION_M_CONTINUOUS (2 << 9) /* also 3 << 9 */ =20 -#define OPT3001_CONFIGURATION_OVF BIT(8) #define OPT3001_CONFIGURATION_CRF BIT(7) #define OPT3001_CONFIGURATION_FH BIT(6) #define OPT3001_CONFIGURATION_FL BIT(5) @@ -51,7 +50,7 @@ #define OPT3001_CONFIGURATION_POL BIT(3) #define OPT3001_CONFIGURATION_ME BIT(2) =20 -#define OPT3001_CONFIGURATION_FC_MASK (3 << 0) +#define OPT3001_CONFIGURATION_FC_MASK GENMASK(1, 0) =20 /* The end-of-conversion enable is located in the low-limit register */ #define OPT3001_LOW_LIMIT_EOC_ENABLE 0xc000 --=20 2.47.3 From nobody Fri Jun 12 21:31:55 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 3DAC03839B9; Tue, 12 May 2026 10:57:53 +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=1778583473; cv=none; b=h/3y/O/6isvEqk0/vIKpU5r/QxuQho3A6x82IVhUG+0ueMTIz7YdNh4r7V2wDR7olHubZlAA1a+xsHFpC15OKYFrell+q1JKHPFb4zzxpxxxzWhF1qmrooA1gFkt0GBbjRcetJLD4Tt4neUQNOqvrDBM5sgYJS5a7iUaaW//SWI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778583473; c=relaxed/simple; bh=39wWtrgo0RAPyJym1LAUfomYkJ3GOE1+Fm/W1AN3sM0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=g5sF1rPZZZNdGLsO20fkYX0mNX87aercS9iARa0DTk4XAfRqxCTq5Fj5s+NMVwQDHtp30DEHo6gWvXKpKhwpvC0LBlLoa4En6J7fKOFyvtvsjQ1DcSDzcKK1sFLkamlOmMN44ZYNr0O5BmFLwBMF4tkPmEKC+vzjHFYllYrQOtA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=D8D2PnrU; 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="D8D2PnrU" Received: by smtp.kernel.org (Postfix) with ESMTPS id 198D6C4AF0C; Tue, 12 May 2026 10:57:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778583473; bh=39wWtrgo0RAPyJym1LAUfomYkJ3GOE1+Fm/W1AN3sM0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=D8D2PnrUbi0WE7ArQWBvmBxJaR/nH++/IhiAO6l7Lxqsku+4y3iQcWVGJWL2S09N2 gj2t8CpuqKTZ3/4VCW+XwSB+XOePM1eZNkoaUxMyZxn5ZwLhlFtGp+iYci/TQF0WJk bhwsOFOYXrf6t2p5ULSwU8emfioRleJkPgeuKJMB1lL8pTXf3NNWAoZw1iqc5QTl0o dJgX9RVk2EsP9iB9g5c9x3lwUVaLsIhXKxtf/ErYNMtJMXn5OoPUPQ3BPwXoXiLPYc Vg6V7iGuvE0+QVQO361UVnnlcM53RC/EYpWYvuBKUkkfrx9tFVpiCyZ+Njp6Vuge9d jgDjVzyohYQSQ== 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 0C410CD4F35; Tue, 12 May 2026 10:57:53 +0000 (UTC) From: Joshua Crofts via B4 Relay Date: Tue, 12 May 2026 12:57:24 +0200 Subject: [PATCH v2 04/10] iio: light: opt3001: use local struct device and i2c_client variables 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: <20260512-opt3001-cleanup-v2-4-8018cf3a8a0a@gmail.com> References: <20260512-opt3001-cleanup-v2-0-8018cf3a8a0a@gmail.com> In-Reply-To: <20260512-opt3001-cleanup-v2-0-8018cf3a8a0a@gmail.com> To: Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko , Alexander Koch , Michael Hornung Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Joshua Crofts , Andy Shevchenko X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1778583471; l=13132; i=joshua.crofts1@gmail.com; s=20260422; h=from:subject:message-id; bh=n9X8FvvW2gp4AIL5sDgYDgQM74cfBtmwn4ULrWzCkdk=; b=DAnVbVhavYgRSLYAIObNBFC9D38HG3RXOke83YSOhnYeGibdZCPa2rg3RCN1o4+b85MGRn/p1 /XIwA44L7OMBIRxW5ycf10CjLzQ8/zWUfRmT9a8suWH3uqx0AKeFHs+ 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 Switch the driver to use local variables for struct device and struct i2c_client to improve code style. While at it, ensure that parentheses alignment is correct in functions that were changed in this patch. No functional change. Suggested-by: Andy Shevchenko Signed-off-by: Joshua Crofts --- drivers/iio/light/opt3001.c | 147 +++++++++++++++++++++++-----------------= ---- 1 file changed, 78 insertions(+), 69 deletions(-) diff --git a/drivers/iio/light/opt3001.c b/drivers/iio/light/opt3001.c index 6ce1a2d7647a3b9cd8964a276878630d31f61794..0de8ef4f3e68e6380b47d27e358= 82c604563377c 100644 --- a/drivers/iio/light/opt3001.c +++ b/drivers/iio/light/opt3001.c @@ -313,6 +313,8 @@ static const struct iio_chan_spec opt3002_channels[] = =3D { =20 static int opt3001_get_processed(struct opt3001 *opt, int *val, int *val2) { + struct i2c_client *client =3D opt->client; + struct device *dev =3D opt->dev; int ret; u16 mantissa; u16 reg; @@ -326,12 +328,12 @@ static int opt3001_get_processed(struct opt3001 *opt,= int *val, int *val2) * doing so will overwrite the low-level limit value however we * will restore this value later on. */ - ret =3D i2c_smbus_write_word_swapped(opt->client, - OPT3001_LOW_LIMIT, - OPT3001_LOW_LIMIT_EOC_ENABLE); + ret =3D i2c_smbus_write_word_swapped(client, + OPT3001_LOW_LIMIT, + OPT3001_LOW_LIMIT_EOC_ENABLE); if (ret < 0) { - dev_err(opt->dev, "failed to write register %02x\n", - OPT3001_LOW_LIMIT); + dev_err(dev, "failed to write register %02x\n", + OPT3001_LOW_LIMIT); return ret; } =20 @@ -343,21 +345,20 @@ static int opt3001_get_processed(struct opt3001 *opt,= int *val, int *val2) opt->result_ready =3D false; =20 /* Configure for single-conversion mode and start a new conversion */ - ret =3D i2c_smbus_read_word_swapped(opt->client, OPT3001_CONFIGURATION); + ret =3D i2c_smbus_read_word_swapped(client, OPT3001_CONFIGURATION); if (ret < 0) { - dev_err(opt->dev, "failed to read register %02x\n", - OPT3001_CONFIGURATION); + dev_err(dev, "failed to read register %02x\n", + OPT3001_CONFIGURATION); goto err; } =20 reg =3D ret; opt3001_set_mode(opt, ®, OPT3001_CONFIGURATION_M_SINGLE); =20 - ret =3D i2c_smbus_write_word_swapped(opt->client, OPT3001_CONFIGURATION, - reg); + ret =3D i2c_smbus_write_word_swapped(client, OPT3001_CONFIGURATION, reg); if (ret < 0) { - dev_err(opt->dev, "failed to write register %02x\n", - OPT3001_CONFIGURATION); + dev_err(dev, "failed to write register %02x\n", + OPT3001_CONFIGURATION); goto err; } =20 @@ -375,10 +376,9 @@ static int opt3001_get_processed(struct opt3001 *opt, = int *val, int *val2) msleep(timeout); =20 /* Check result ready flag */ - ret =3D i2c_smbus_read_word_swapped(opt->client, - OPT3001_CONFIGURATION); + ret =3D i2c_smbus_read_word_swapped(client, OPT3001_CONFIGURATION); if (ret < 0) { - dev_err(opt->dev, "failed to read register %02x\n", + dev_err(dev, "failed to read register %02x\n", OPT3001_CONFIGURATION); goto err; } @@ -389,9 +389,9 @@ static int opt3001_get_processed(struct opt3001 *opt, i= nt *val, int *val2) } =20 /* Obtain value */ - ret =3D i2c_smbus_read_word_swapped(opt->client, OPT3001_RESULT); + ret =3D i2c_smbus_read_word_swapped(client, OPT3001_RESULT); if (ret < 0) { - dev_err(opt->dev, "failed to read register %02x\n", + dev_err(dev, "failed to read register %02x\n", OPT3001_RESULT); goto err; } @@ -416,12 +416,12 @@ static int opt3001_get_processed(struct opt3001 *opt,= int *val, int *val2) * bit-overlap and therefore can't be done. */ value =3D (opt->low_thresh_exp << 12) | opt->low_thresh_mantissa; - ret =3D i2c_smbus_write_word_swapped(opt->client, + ret =3D i2c_smbus_write_word_swapped(client, OPT3001_LOW_LIMIT, value); if (ret < 0) { - dev_err(opt->dev, "failed to write register %02x\n", - OPT3001_LOW_LIMIT); + dev_err(dev, "failed to write register %02x\n", + OPT3001_LOW_LIMIT); return ret; } } @@ -444,13 +444,15 @@ static int opt3001_get_int_time(struct opt3001 *opt, = int *val, int *val2) =20 static int opt3001_set_int_time(struct opt3001 *opt, int time) { + struct i2c_client *client =3D opt->client; + struct device *dev =3D opt->dev; int ret; u16 reg; =20 - ret =3D i2c_smbus_read_word_swapped(opt->client, OPT3001_CONFIGURATION); + ret =3D i2c_smbus_read_word_swapped(client, OPT3001_CONFIGURATION); if (ret < 0) { - dev_err(opt->dev, "failed to read register %02x\n", - OPT3001_CONFIGURATION); + dev_err(dev, "failed to read register %02x\n", + OPT3001_CONFIGURATION); return ret; } =20 @@ -469,8 +471,7 @@ static int opt3001_set_int_time(struct opt3001 *opt, in= t time) return -EINVAL; } =20 - return i2c_smbus_write_word_swapped(opt->client, OPT3001_CONFIGURATION, - reg); + return i2c_smbus_write_word_swapped(client, OPT3001_CONFIGURATION, reg); } =20 static int opt3001_read_raw(struct iio_dev *iio, @@ -565,6 +566,8 @@ static int opt3001_write_event_value(struct iio_dev *ii= o, int val, int val2) { struct opt3001 *opt =3D iio_priv(iio); + struct i2c_client *client =3D opt->client; + struct device *dev =3D opt->dev; int ret; int whole; int integer; @@ -583,7 +586,7 @@ static int opt3001_write_event_value(struct iio_dev *ii= o, =20 ret =3D opt3001_find_scale(opt, val, val2, &exponent); if (ret < 0) { - dev_err(opt->dev, "can't find scale for %d.%06u\n", val, val2); + dev_err(dev, "can't find scale for %d.%06u\n", val, val2); goto err; } =20 @@ -611,9 +614,9 @@ static int opt3001_write_event_value(struct iio_dev *ii= o, goto err; } =20 - ret =3D i2c_smbus_write_word_swapped(opt->client, reg, value); + ret =3D i2c_smbus_write_word_swapped(client, reg, value); if (ret < 0) { - dev_err(opt->dev, "failed to write register %02x\n", reg); + dev_err(dev, "failed to write register %02x\n", reg); goto err; } =20 @@ -637,6 +640,8 @@ static int opt3001_write_event_config(struct iio_dev *i= io, enum iio_event_direction dir, bool state) { struct opt3001 *opt =3D iio_priv(iio); + struct i2c_client *client =3D opt->client; + struct device *dev =3D opt->dev; int ret; u16 mode; u16 reg; @@ -652,21 +657,20 @@ static int opt3001_write_event_config(struct iio_dev = *iio, mode =3D state ? OPT3001_CONFIGURATION_M_CONTINUOUS : OPT3001_CONFIGURATION_M_SHUTDOWN; =20 - ret =3D i2c_smbus_read_word_swapped(opt->client, OPT3001_CONFIGURATION); + ret =3D i2c_smbus_read_word_swapped(client, OPT3001_CONFIGURATION); if (ret < 0) { - dev_err(opt->dev, "failed to read register %02x\n", - OPT3001_CONFIGURATION); + dev_err(dev, "failed to read register %02x\n", + OPT3001_CONFIGURATION); goto err; } =20 reg =3D ret; opt3001_set_mode(opt, ®, mode); =20 - ret =3D i2c_smbus_write_word_swapped(opt->client, OPT3001_CONFIGURATION, - reg); + ret =3D i2c_smbus_write_word_swapped(client, OPT3001_CONFIGURATION, reg); if (ret < 0) { - dev_err(opt->dev, "failed to write register %02x\n", - OPT3001_CONFIGURATION); + dev_err(dev, "failed to write register %02x\n", + OPT3001_CONFIGURATION); goto err; } =20 @@ -688,44 +692,48 @@ static const struct iio_info opt3001_info =3D { =20 static int opt3001_read_id(struct opt3001 *opt) { + struct i2c_client *client =3D opt->client; + struct device *dev =3D opt->dev; char manufacturer[2]; u16 device_id; int ret; =20 - ret =3D i2c_smbus_read_word_swapped(opt->client, OPT3001_MANUFACTURER_ID); + ret =3D i2c_smbus_read_word_swapped(client, OPT3001_MANUFACTURER_ID); if (ret < 0) { - dev_err(opt->dev, "failed to read register %02x\n", - OPT3001_MANUFACTURER_ID); + dev_err(dev, "failed to read register %02x\n", + OPT3001_MANUFACTURER_ID); return ret; } =20 manufacturer[0] =3D ret >> 8; manufacturer[1] =3D ret & 0xff; =20 - ret =3D i2c_smbus_read_word_swapped(opt->client, OPT3001_DEVICE_ID); + ret =3D i2c_smbus_read_word_swapped(client, OPT3001_DEVICE_ID); if (ret < 0) { - dev_err(opt->dev, "failed to read register %02x\n", + dev_err(dev, "failed to read register %02x\n", OPT3001_DEVICE_ID); return ret; } =20 device_id =3D ret; =20 - dev_info(opt->dev, "Found %c%c OPT%04x\n", manufacturer[0], - manufacturer[1], device_id); + dev_info(dev, "Found %c%c OPT%04x\n", manufacturer[0], manufacturer[1], + device_id); =20 return 0; } =20 static int opt3001_configure(struct opt3001 *opt) { + struct i2c_client *client =3D opt->client; + struct device *dev =3D opt->dev; int ret; u16 reg; =20 - ret =3D i2c_smbus_read_word_swapped(opt->client, OPT3001_CONFIGURATION); + ret =3D i2c_smbus_read_word_swapped(client, OPT3001_CONFIGURATION); if (ret < 0) { - dev_err(opt->dev, "failed to read register %02x\n", - OPT3001_CONFIGURATION); + dev_err(dev, "failed to read register %02x\n", + OPT3001_CONFIGURATION); return ret; } =20 @@ -750,28 +758,27 @@ static int opt3001_configure(struct opt3001 *opt) reg &=3D ~OPT3001_CONFIGURATION_ME; reg &=3D ~OPT3001_CONFIGURATION_FC_MASK; =20 - ret =3D i2c_smbus_write_word_swapped(opt->client, OPT3001_CONFIGURATION, - reg); + ret =3D i2c_smbus_write_word_swapped(client, OPT3001_CONFIGURATION, reg); if (ret < 0) { - dev_err(opt->dev, "failed to write register %02x\n", - OPT3001_CONFIGURATION); + dev_err(dev, "failed to write register %02x\n", + OPT3001_CONFIGURATION); return ret; } =20 - ret =3D i2c_smbus_read_word_swapped(opt->client, OPT3001_LOW_LIMIT); + ret =3D i2c_smbus_read_word_swapped(client, OPT3001_LOW_LIMIT); if (ret < 0) { - dev_err(opt->dev, "failed to read register %02x\n", - OPT3001_LOW_LIMIT); + dev_err(dev, "failed to read register %02x\n", + OPT3001_LOW_LIMIT); return ret; } =20 opt->low_thresh_mantissa =3D OPT3001_REG_MANTISSA(ret); opt->low_thresh_exp =3D OPT3001_REG_EXPONENT(ret); =20 - ret =3D i2c_smbus_read_word_swapped(opt->client, OPT3001_HIGH_LIMIT); + ret =3D i2c_smbus_read_word_swapped(client, OPT3001_HIGH_LIMIT); if (ret < 0) { - dev_err(opt->dev, "failed to read register %02x\n", - OPT3001_HIGH_LIMIT); + dev_err(dev, "failed to read register %02x\n", + OPT3001_HIGH_LIMIT); return ret; } =20 @@ -785,6 +792,8 @@ static irqreturn_t opt3001_irq(int irq, void *_iio) { struct iio_dev *iio =3D _iio; struct opt3001 *opt =3D iio_priv(iio); + struct i2c_client *client =3D opt->client; + struct device *dev =3D opt->dev; int ret; bool wake_result_ready_queue =3D false; enum iio_chan_type chan_type =3D opt->chip_info->chan_type; @@ -793,10 +802,10 @@ static irqreturn_t opt3001_irq(int irq, void *_iio) if (!ok_to_ignore_lock) mutex_lock(&opt->lock); =20 - ret =3D i2c_smbus_read_word_swapped(opt->client, OPT3001_CONFIGURATION); + ret =3D i2c_smbus_read_word_swapped(client, OPT3001_CONFIGURATION); if (ret < 0) { - dev_err(opt->dev, "failed to read register %02x\n", - OPT3001_CONFIGURATION); + dev_err(dev, "failed to read register %02x\n", + OPT3001_CONFIGURATION); goto out; } =20 @@ -815,10 +824,10 @@ static irqreturn_t opt3001_irq(int irq, void *_iio) IIO_EV_DIR_FALLING), iio_get_time_ns(iio)); } else if (ret & OPT3001_CONFIGURATION_CRF) { - ret =3D i2c_smbus_read_word_swapped(opt->client, OPT3001_RESULT); + ret =3D i2c_smbus_read_word_swapped(client, OPT3001_RESULT); if (ret < 0) { - dev_err(opt->dev, "failed to read register %02x\n", - OPT3001_RESULT); + dev_err(dev, "failed to read register %02x\n", + OPT3001_RESULT); goto out; } opt->result =3D ret; @@ -885,7 +894,7 @@ static int opt3001_probe(struct i2c_client *client) } opt->use_irq =3D true; } else { - dev_dbg(opt->dev, "enabling interrupt-less operation\n"); + dev_dbg(dev, "enabling interrupt-less operation\n"); } =20 ret =3D devm_iio_device_register(dev, iio); @@ -899,27 +908,27 @@ static void opt3001_remove(struct i2c_client *client) { struct iio_dev *iio =3D i2c_get_clientdata(client); struct opt3001 *opt =3D iio_priv(iio); + struct device *dev =3D opt->dev; int ret; u16 reg; =20 if (opt->use_irq) free_irq(client->irq, iio); =20 - ret =3D i2c_smbus_read_word_swapped(opt->client, OPT3001_CONFIGURATION); + ret =3D i2c_smbus_read_word_swapped(client, OPT3001_CONFIGURATION); if (ret < 0) { - dev_err(opt->dev, "failed to read register %02x\n", - OPT3001_CONFIGURATION); + dev_err(dev, "failed to read register %02x\n", + OPT3001_CONFIGURATION); return; } =20 reg =3D ret; opt3001_set_mode(opt, ®, OPT3001_CONFIGURATION_M_SHUTDOWN); =20 - ret =3D i2c_smbus_write_word_swapped(opt->client, OPT3001_CONFIGURATION, - reg); + ret =3D i2c_smbus_write_word_swapped(client, OPT3001_CONFIGURATION, reg); if (ret < 0) { - dev_err(opt->dev, "failed to write register %02x\n", - OPT3001_CONFIGURATION); + dev_err(dev, "failed to write register %02x\n", + OPT3001_CONFIGURATION); } } =20 --=20 2.47.3 From nobody Fri Jun 12 21:31:55 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 5C39838E8A4; Tue, 12 May 2026 10:57:53 +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=1778583473; cv=none; b=az9QQz81AaT01yD56nJJMpZOMq/Thl9K22C4ibiXYGOllGqxxFuCq0yfPWws/jEGAlACW8Bbymw8A5aahWBvw8UhP4mp321EF8pl7dsE5JGAoOKT6wc4QDIO+JI0sX9cQ4EXrgMvCL5K7tvcwKmKqBhJhnnmiODc3GqTDz53ZWg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778583473; c=relaxed/simple; bh=Z4O6GkTuKQB/e7bauJi5Ryhm5rs/lEpPitvy77eCgSM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=n9nvoXtta9ys9sVpEnEo8MdThxwWZIk/9e1sHFKeBIBNw/Y7OjRDmtBMOZYlIsoymNUM4eV1ZwvY/fdkCrFMefyanlyg1TGS9vLlDG201nBbEW14hBdKevaNp2G3VxWI6ny4TNr7gWNpjIQjNIhhGBjYEbpaaklj+BBS+NYTPZM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SmbeuDov; 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="SmbeuDov" Received: by smtp.kernel.org (Postfix) with ESMTPS id 30B15C2BD01; Tue, 12 May 2026 10:57:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778583473; bh=Z4O6GkTuKQB/e7bauJi5Ryhm5rs/lEpPitvy77eCgSM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=SmbeuDov3matpevTJ+0Gx2LI4YQuHDGKNgKr7fF28zoytJqInaNpnbfJAxhWJ6DAM FTAEcWuPhyPMApdRYpvv6sYmgQR9ATFFjg4/JaovbaI/amUGXEHQmgteJ3UXf45ZRW XF4eWMXSzTlFQKUcypdiBO7jO5Ynp6G1DIIkX9+j8Kr02M8YlLY3QU9B2tsfdyvyJo Tb8f6+xqAicrJAHLi7qyfe1HPUUs3RKCNF4sjVt5AMRi3tQT+/yueZrqmmsaW2ZVzc jYDkL+Y5KOgr6YBv1+x3LmCe+3b4DqRzASjSN8vVzfQ8AUrnDH0b3cJarbApsi/zHh zQCKq4glqjGHg== 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 26DBDCD4855; Tue, 12 May 2026 10:57:53 +0000 (UTC) From: Joshua Crofts via B4 Relay Date: Tue, 12 May 2026 12:57:25 +0200 Subject: [PATCH v2 05/10] iio: light: opt3001: ensure correct parenthesis alignment 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: <20260512-opt3001-cleanup-v2-5-8018cf3a8a0a@gmail.com> References: <20260512-opt3001-cleanup-v2-0-8018cf3a8a0a@gmail.com> In-Reply-To: <20260512-opt3001-cleanup-v2-0-8018cf3a8a0a@gmail.com> To: Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko , Alexander Koch , Michael Hornung Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Joshua Crofts , Andy Shevchenko X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1778583471; l=6434; i=joshua.crofts1@gmail.com; s=20260422; h=from:subject:message-id; bh=Ud0bg+skwhtsrM6KPCOfS93zapO4Sp0BOPy7CuSdYis=; b=VzTjL4E2DxFkJX+n9TBTieNCXNHRLW8Y8cplgDSkYUIv3qbVrQsC1imNoi/TOo/JbuTEavNSi 9cM2B0SZBFMDuIHyVmBb728320uMHNE0Qe4YqKj+FmRuxG1h6FLd5bw 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 Ensure correct parenthesis alignment per checkpatch.pl report. No functional change. Suggested-by: Andy Shevchenko Signed-off-by: Joshua Crofts --- drivers/iio/light/opt3001.c | 73 +++++++++++++++++++++++++----------------= ---- 1 file changed, 41 insertions(+), 32 deletions(-) diff --git a/drivers/iio/light/opt3001.c b/drivers/iio/light/opt3001.c index 0de8ef4f3e68e6380b47d27e35882c604563377c..ad729152bb9266a35919e3abe57= 6e792dbc08730 100644 --- a/drivers/iio/light/opt3001.c +++ b/drivers/iio/light/opt3001.c @@ -224,8 +224,8 @@ static const struct opt3001_scale opt3002_scales[] =3D { }, }; =20 -static int opt3001_find_scale(const struct opt3001 *opt, int val, - int val2, u8 *exponent) +static int opt3001_find_scale(const struct opt3001 *opt, int val, int val2, + u8 *exponent) { int i; for (i =3D 0; i < ARRAY_SIZE(*opt->chip_info->scales); i++) { @@ -243,8 +243,8 @@ static int opt3001_find_scale(const struct opt3001 *opt= , int val, return -EINVAL; } =20 -static void opt3001_to_iio_ret(struct opt3001 *opt, u8 exponent, - u16 mantissa, int *val, int *val2) +static void opt3001_to_iio_ret(struct opt3001 *opt, u8 exponent, u16 manti= ssa, + int *val, int *val2) { int ret; int whole =3D opt->chip_info->factor_whole; @@ -365,8 +365,8 @@ static int opt3001_get_processed(struct opt3001 *opt, i= nt *val, int *val2) if (opt->use_irq) { /* Wait for the IRQ to indicate the conversion is complete */ ret =3D wait_event_timeout(opt->result_ready_queue, - opt->result_ready, - msecs_to_jiffies(OPT3001_RESULT_READY_LONG)); + opt->result_ready, + msecs_to_jiffies(OPT3001_RESULT_READY_LONG)); if (ret =3D=3D 0) return -ETIMEDOUT; } else { @@ -475,8 +475,8 @@ static int opt3001_set_int_time(struct opt3001 *opt, in= t time) } =20 static int opt3001_read_raw(struct iio_dev *iio, - struct iio_chan_spec const *chan, int *val, int *val2, - long mask) + struct iio_chan_spec const *chan, + int *val, int *val2, long mask) { struct opt3001 *opt =3D iio_priv(iio); int ret; @@ -507,8 +507,8 @@ static int opt3001_read_raw(struct iio_dev *iio, } =20 static int opt3001_write_raw(struct iio_dev *iio, - struct iio_chan_spec const *chan, int val, int val2, - long mask) + struct iio_chan_spec const *chan, + int val, int val2, long mask) { struct opt3001 *opt =3D iio_priv(iio); int ret; @@ -533,9 +533,11 @@ static int opt3001_write_raw(struct iio_dev *iio, } =20 static int opt3001_read_event_value(struct iio_dev *iio, - const struct iio_chan_spec *chan, enum iio_event_type type, - enum iio_event_direction dir, enum iio_event_info info, - int *val, int *val2) + const struct iio_chan_spec *chan, + enum iio_event_type type, + enum iio_event_direction dir, + enum iio_event_info info, + int *val, int *val2) { struct opt3001 *opt =3D iio_priv(iio); int ret =3D IIO_VAL_INT_PLUS_MICRO; @@ -545,11 +547,13 @@ static int opt3001_read_event_value(struct iio_dev *i= io, switch (dir) { case IIO_EV_DIR_RISING: opt3001_to_iio_ret(opt, opt->high_thresh_exp, - opt->high_thresh_mantissa, val, val2); + opt->high_thresh_mantissa, + val, val2); break; case IIO_EV_DIR_FALLING: opt3001_to_iio_ret(opt, opt->low_thresh_exp, - opt->low_thresh_mantissa, val, val2); + opt->low_thresh_mantissa, + val, val2); break; default: ret =3D -EINVAL; @@ -561,9 +565,11 @@ static int opt3001_read_event_value(struct iio_dev *ii= o, } =20 static int opt3001_write_event_value(struct iio_dev *iio, - const struct iio_chan_spec *chan, enum iio_event_type type, - enum iio_event_direction dir, enum iio_event_info info, - int val, int val2) + const struct iio_chan_spec *chan, + enum iio_event_type type, + enum iio_event_direction dir, + enum iio_event_info info, + int val, int val2) { struct opt3001 *opt =3D iio_priv(iio); struct i2c_client *client =3D opt->client; @@ -627,8 +633,9 @@ static int opt3001_write_event_value(struct iio_dev *ii= o, } =20 static int opt3001_read_event_config(struct iio_dev *iio, - const struct iio_chan_spec *chan, enum iio_event_type type, - enum iio_event_direction dir) + const struct iio_chan_spec *chan, + enum iio_event_type type, + enum iio_event_direction dir) { struct opt3001 *opt =3D iio_priv(iio); =20 @@ -636,8 +643,10 @@ static int opt3001_read_event_config(struct iio_dev *i= io, } =20 static int opt3001_write_event_config(struct iio_dev *iio, - const struct iio_chan_spec *chan, enum iio_event_type type, - enum iio_event_direction dir, bool state) + const struct iio_chan_spec *chan, + enum iio_event_type type, + enum iio_event_direction dir, + bool state) { struct opt3001 *opt =3D iio_priv(iio); struct i2c_client *client =3D opt->client; @@ -813,16 +822,16 @@ static irqreturn_t opt3001_irq(int irq, void *_iio) OPT3001_CONFIGURATION_M_CONTINUOUS) { if (ret & OPT3001_CONFIGURATION_FH) iio_push_event(iio, - IIO_UNMOD_EVENT_CODE(chan_type, 0, - IIO_EV_TYPE_THRESH, - IIO_EV_DIR_RISING), - iio_get_time_ns(iio)); + IIO_UNMOD_EVENT_CODE(chan_type, 0, + IIO_EV_TYPE_THRESH, + IIO_EV_DIR_RISING), + iio_get_time_ns(iio)); if (ret & OPT3001_CONFIGURATION_FL) iio_push_event(iio, - IIO_UNMOD_EVENT_CODE(chan_type, 0, - IIO_EV_TYPE_THRESH, - IIO_EV_DIR_FALLING), - iio_get_time_ns(iio)); + IIO_UNMOD_EVENT_CODE(chan_type, 0, + IIO_EV_TYPE_THRESH, + IIO_EV_DIR_FALLING), + iio_get_time_ns(iio)); } else if (ret & OPT3001_CONFIGURATION_CRF) { ret =3D i2c_smbus_read_word_swapped(client, OPT3001_RESULT); if (ret < 0) { @@ -886,8 +895,8 @@ static int opt3001_probe(struct i2c_client *client) /* Make use of INT pin only if valid IRQ no. is given */ if (irq > 0) { ret =3D request_threaded_irq(irq, NULL, opt3001_irq, - IRQF_TRIGGER_FALLING | IRQF_ONESHOT, - "opt3001", iio); + IRQF_TRIGGER_FALLING | IRQF_ONESHOT, + "opt3001", iio); if (ret) { dev_err(dev, "failed to request IRQ #%d\n", irq); return ret; --=20 2.47.3 From nobody Fri Jun 12 21:31:55 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 66DE738E8A9; Tue, 12 May 2026 10:57:53 +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=1778583473; cv=none; b=RTZDjP9Rqc1Pl9eIHnzWIwFZHEUW02YnRs51k+Cg0bGTuHKw4GsrHnz0l6pLvLUAswou7IOOwR6f+KRJj0mtwbJBDTkkmDpbaS5dIc/APS8jAqnwrLDNbuinWgeuO/W5IR721Zn6wCmQSTRI0STlSZ3JJRsjsERMwrAJ2mQtofg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778583473; c=relaxed/simple; bh=B7gGNBYNYgDZb5ePCf9Qtb2Yz2VINvwRgOMpEaSaHVI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=QmpjLEHfIsEiJ2vq96/2o6MFN8+IHQURsoJ7iW8Z4a6g0GXoCsdvpTZwEIzl3UwZzcH57kak2M+0wsPBVakSrfA1ao74rRlk0d/M45ZvlJdwxb4M/n8Dm7JMqfQY/MLrZ0cZ8h6wSzpx/rfcTrTMIaZq4vrfb3xOCNdV/WURC+k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=kjep0qqw; 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="kjep0qqw" Received: by smtp.kernel.org (Postfix) with ESMTPS id 41B8FC2BCFD; Tue, 12 May 2026 10:57:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778583473; bh=B7gGNBYNYgDZb5ePCf9Qtb2Yz2VINvwRgOMpEaSaHVI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=kjep0qqwIMHvaXlLXZKXymC2wNRJ0mZFVOHDAdBI79VJIlvMle3Ux4BRQqiSLr1Uk VHfutKCUIVvYH0ShsqH938/UaBPMi3xOawzL32OJ7JBVSoXX9qODhttppleXwjxndX afKh5MKR2YWzL/YNI2M6LYIHZY4RcQCn/ognVKCPe/iT9E82HYY/Gcy3QayfNLnux3 Fak5JRxoGjGt7v7ZIJJpQr0bIM4r5sfjyZnb7FS+tNoP0Zs6YIh2CgNcCKqW81Kz1x OKgN2gR/feOvS60As5JOxFfBDq+2PCisT/s0FQty4Pjlrb//L/oXQYS+QndXC3ZR/C duYRqVovaMGtA== 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 3A82FCD4851; Tue, 12 May 2026 10:57:53 +0000 (UTC) From: Joshua Crofts via B4 Relay Date: Tue, 12 May 2026 12:57:26 +0200 Subject: [PATCH v2 06/10] iio: light: opt3001: localize for loop iterator 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: <20260512-opt3001-cleanup-v2-6-8018cf3a8a0a@gmail.com> References: <20260512-opt3001-cleanup-v2-0-8018cf3a8a0a@gmail.com> In-Reply-To: <20260512-opt3001-cleanup-v2-0-8018cf3a8a0a@gmail.com> To: Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko , Alexander Koch , Michael Hornung Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Joshua Crofts X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1778583471; l=1002; i=joshua.crofts1@gmail.com; s=20260422; h=from:subject:message-id; bh=AsyGssNVmON9RQX/C6khFPg58cqD0NGGocT4co0wy1s=; b=nthaInSsVtNIjCRF2FMDgEAjZvToY06ZDGOssNu6LjIgq1pmnstb8y9TxPk9zfDQD/tiYbmT9 f5iToYop3QICm1hcKzsoh6GqjgMbnLC40+c2t24KsmCqvpRQm1e25MI 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 Localize loop iterator to tighten scope and improve code style per checkpatch.pl report. No functional change. Signed-off-by: Joshua Crofts --- drivers/iio/light/opt3001.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/iio/light/opt3001.c b/drivers/iio/light/opt3001.c index ad729152bb9266a35919e3abe576e792dbc08730..8eaa2cb6b5b044afdc405f19cd2= 499abb7e4d7a3 100644 --- a/drivers/iio/light/opt3001.c +++ b/drivers/iio/light/opt3001.c @@ -227,8 +227,7 @@ static const struct opt3001_scale opt3002_scales[] =3D { static int opt3001_find_scale(const struct opt3001 *opt, int val, int val2, u8 *exponent) { - int i; - for (i =3D 0; i < ARRAY_SIZE(*opt->chip_info->scales); i++) { + for (unsigned int i =3D 0; i < ARRAY_SIZE(*opt->chip_info->scales); i++) { const struct opt3001_scale *scale =3D &(*opt->chip_info->scales)[i]; /* * Compare the integer and micro parts to determine value scale. --=20 2.47.3 From nobody Fri Jun 12 21:31:55 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 759BA38E8AC; Tue, 12 May 2026 10:57:53 +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=1778583473; cv=none; b=MCsX+jiqGzJyznoMjPL8AwVI7Mqo5P5mKBUp6i/Ajlv3zg1NCFND2ZvfKz50Awp7ZJGZqZoC06bt2JlDPhJcStylri5YJ2CwbdQfhRGO22JmX0HQ0uddddZ8sCHmGkLP5adD+ifr8toYjbwGU/G3UIFIKq/xXB4eukWdTjIJN3Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778583473; c=relaxed/simple; bh=LDKNhQ5zV7xT+giK8Y6Tm/Cwkprt7pR2VrXMIIFt4uc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=j1BlHnnXb8BzjokMKpzfR9uFA1a8Q3UzQTZnBaka1Wl8qRnv/90F860Exkbn0YeVsly6fBSFzpV7fN5ptni9Bh28IHFBP6YawVtE66epPsnN9oVYM0Rp6YdQ+02BjZ2q06b8l1P2yRCoxz7xHAWotATiF/ugLOB/bS339KIN34k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uNAXO2Nq; 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="uNAXO2Nq" Received: by smtp.kernel.org (Postfix) with ESMTPS id 57BC2C2BCB0; Tue, 12 May 2026 10:57:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778583473; bh=LDKNhQ5zV7xT+giK8Y6Tm/Cwkprt7pR2VrXMIIFt4uc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=uNAXO2NqGEALWG1gRvS/36DOu32s/0h/Xt80lK5XdAaxAC1fy04dpfwhePhEUsNpp 1KM1PlmWQBWvymg7UG3NuekgHHvqxwrsNJk/MqxlDelRZw9uuyNHTtTRM52ao/cgfc 5JsT4kBXw7qb7EUfIAdl6r36TUgtCYTF6gv+pQVgqkU8mrs78K4kDblfB12eL5fLab pGT0O9nQErH3CII5TDJSV3UE2HMJuVuuw4YXV5gbunzq8SeNw8nuemnGTTo3QMNeBG rE3ORJPyRW19bWhOJ33O1a5bWVXpvQ8+22bHFrGBWX0ag/QfGOZLmn5DCJ18BrJ8Yi h6NDTUBUSvtUA== 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 4FBD9CD4F35; Tue, 12 May 2026 10:57:53 +0000 (UTC) From: Joshua Crofts via B4 Relay Date: Tue, 12 May 2026 12:57:27 +0200 Subject: [PATCH v2 07/10] iio: light: opt3001: prefer dev_err_probe() 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: <20260512-opt3001-cleanup-v2-7-8018cf3a8a0a@gmail.com> References: <20260512-opt3001-cleanup-v2-0-8018cf3a8a0a@gmail.com> In-Reply-To: <20260512-opt3001-cleanup-v2-0-8018cf3a8a0a@gmail.com> To: Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko , Alexander Koch , Michael Hornung Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Joshua Crofts X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1778583471; l=3829; i=joshua.crofts1@gmail.com; s=20260422; h=from:subject:message-id; bh=37rRREY2il0fiO/98aujElf7Lwb4t3do/3EAx2mE6o8=; b=ePJsxbGYRUfMAm9rOg+cBydEIrMvF+Wu1mWxZQQXJm9GaT9iuV2U1cWmH/4URhjNZY929ao9I gkSwnGB/JBVBoFM+S8DiXT96zvz4oFX1njzZLPLEwedBmIKcvWAtw+H 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 Switch driver to use dev_err_probe() to unify error messages generated in *_probe() and probe path functions. Signed-off-by: Joshua Crofts --- drivers/iio/light/opt3001.c | 59 ++++++++++++++++++-----------------------= ---- 1 file changed, 24 insertions(+), 35 deletions(-) diff --git a/drivers/iio/light/opt3001.c b/drivers/iio/light/opt3001.c index 8eaa2cb6b5b044afdc405f19cd2499abb7e4d7a3..6f7c524d3a7a41c5177c9b02ebe= 1b7858294a0b4 100644 --- a/drivers/iio/light/opt3001.c +++ b/drivers/iio/light/opt3001.c @@ -707,21 +707,17 @@ static int opt3001_read_id(struct opt3001 *opt) int ret; =20 ret =3D i2c_smbus_read_word_swapped(client, OPT3001_MANUFACTURER_ID); - if (ret < 0) { - dev_err(dev, "failed to read register %02x\n", - OPT3001_MANUFACTURER_ID); - return ret; - } + if (ret < 0) + return dev_err_probe(dev, ret, "failed to read register %02x\n", + OPT3001_MANUFACTURER_ID); =20 manufacturer[0] =3D ret >> 8; manufacturer[1] =3D ret & 0xff; =20 ret =3D i2c_smbus_read_word_swapped(client, OPT3001_DEVICE_ID); - if (ret < 0) { - dev_err(dev, "failed to read register %02x\n", - OPT3001_DEVICE_ID); - return ret; - } + if (ret < 0) + return dev_err_probe(dev, ret, "failed to read register %02x\n", + OPT3001_DEVICE_ID); =20 device_id =3D ret; =20 @@ -739,11 +735,9 @@ static int opt3001_configure(struct opt3001 *opt) u16 reg; =20 ret =3D i2c_smbus_read_word_swapped(client, OPT3001_CONFIGURATION); - if (ret < 0) { - dev_err(dev, "failed to read register %02x\n", - OPT3001_CONFIGURATION); - return ret; - } + if (ret < 0) + return dev_err_probe(dev, ret, "failed to read register %02x\n", + OPT3001_CONFIGURATION); =20 reg =3D ret; =20 @@ -767,28 +761,22 @@ static int opt3001_configure(struct opt3001 *opt) reg &=3D ~OPT3001_CONFIGURATION_FC_MASK; =20 ret =3D i2c_smbus_write_word_swapped(client, OPT3001_CONFIGURATION, reg); - if (ret < 0) { - dev_err(dev, "failed to write register %02x\n", - OPT3001_CONFIGURATION); - return ret; - } + if (ret < 0) + return dev_err_probe(dev, ret, "failed to write register %02x\n", + OPT3001_CONFIGURATION); =20 ret =3D i2c_smbus_read_word_swapped(client, OPT3001_LOW_LIMIT); - if (ret < 0) { - dev_err(dev, "failed to read register %02x\n", - OPT3001_LOW_LIMIT); - return ret; - } + if (ret < 0) + return dev_err_probe(dev, ret, "failed to read register %02x\n", + OPT3001_LOW_LIMIT); =20 opt->low_thresh_mantissa =3D OPT3001_REG_MANTISSA(ret); opt->low_thresh_exp =3D OPT3001_REG_EXPONENT(ret); =20 ret =3D i2c_smbus_read_word_swapped(client, OPT3001_HIGH_LIMIT); - if (ret < 0) { - dev_err(dev, "failed to read register %02x\n", - OPT3001_HIGH_LIMIT); - return ret; - } + if (ret < 0) + return dev_err_probe(dev, ret, "failed to read register %02x\n", + OPT3001_HIGH_LIMIT); =20 opt->high_thresh_mantissa =3D OPT3001_REG_MANTISSA(ret); opt->high_thresh_exp =3D OPT3001_REG_EXPONENT(ret); @@ -896,10 +884,10 @@ static int opt3001_probe(struct i2c_client *client) ret =3D request_threaded_irq(irq, NULL, opt3001_irq, IRQF_TRIGGER_FALLING | IRQF_ONESHOT, "opt3001", iio); - if (ret) { - dev_err(dev, "failed to request IRQ #%d\n", irq); - return ret; - } + if (ret) + return dev_err_probe(dev, ret, + "failed to request IRQ #%d\n", + irq); opt->use_irq =3D true; } else { dev_dbg(dev, "enabling interrupt-less operation\n"); @@ -907,7 +895,8 @@ static int opt3001_probe(struct i2c_client *client) =20 ret =3D devm_iio_device_register(dev, iio); if (ret) - return dev_err(dev, "failed to register IIO device\n"); + return dev_err_probe(dev, ret, + "failed to register IIO device\n"); =20 return 0; } --=20 2.47.3 From nobody Fri Jun 12 21:31:55 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 8CFC738E8B7; Tue, 12 May 2026 10:57:53 +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=1778583473; cv=none; b=cj5u2w+bVgu+bKV/W3QW+n/s78DKa/Ou5FDwWJw5K5HqH9hYWc9cRyUhV/KljwMp7hUF5IaxRRHLp5CKXhG992+J2OrNT34J0QPOPE41/mchZKSz5VbhvsKR88W1fkof2vXcYlIe7alcEVdsEgddM3RShDV3SSG59brJgR4BaXE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778583473; c=relaxed/simple; bh=UQztexIb2C8tQVJaROY9WTwS6p5tW8+4ZSyp2BwPQEU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=EEo3Pe74lNkZgaO5xLYjzeO38uz8vV0rHo7L0X+qpyOB12HPEtZ7Iu4dDBWXTQEThK7ktZLv4TlnAc0BVkDKye5fVdIquEjeEYzU2A1aVUjdJu6TzIPcqNiKyQxSiANwTtQPzbwIaQz6iZwOUilMY1PU9MkkLnmqqjwuK0LRFcA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TUOCONxo; 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="TUOCONxo" Received: by smtp.kernel.org (Postfix) with ESMTPS id 6EC84C2BCF5; Tue, 12 May 2026 10:57:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778583473; bh=UQztexIb2C8tQVJaROY9WTwS6p5tW8+4ZSyp2BwPQEU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=TUOCONxoptvy0RaYHnEMQmxVz+HPbYxiFbpk/e66lGQ9/dx0AU2jCoQXTaLpyjozi RH/UsNzaUaXZvfb8BUkypBXFyFDvc0of3Wfv1MiWW8y4zozjye8H5Zvmw0Rb14poW7 Vg7IUermPi6rlS15zXsbBlav+msoDDEm6FRqvqMjm0zvgVbbxd9vqWntKryGkxW4pm 7W06XTrEnTlN9VGnDndukNVcA9E8jrqlIoerLte25pGUSWCaitSeIJoKoHZJp2k8Gz H8JGXsXNu55J1GqgRZ+9NtGy9dCEcLk2TpKz176D4eJW4MoQsOtDJxrrNMUJB7rRVs FS8xEJmhhxVYA== 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 666F9CD4F21; Tue, 12 May 2026 10:57:53 +0000 (UTC) From: Joshua Crofts via B4 Relay Date: Tue, 12 May 2026 12:57:28 +0200 Subject: [PATCH v2 08/10] iio: light: opt3001: move driver to guard(mutex)() use 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: <20260512-opt3001-cleanup-v2-8-8018cf3a8a0a@gmail.com> References: <20260512-opt3001-cleanup-v2-0-8018cf3a8a0a@gmail.com> In-Reply-To: <20260512-opt3001-cleanup-v2-0-8018cf3a8a0a@gmail.com> To: Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko , Alexander Koch , Michael Hornung Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Joshua Crofts , Andy Shevchenko X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1778583471; l=4962; i=joshua.crofts1@gmail.com; s=20260422; h=from:subject:message-id; bh=E9XaiRNPCXjAZv0bmOpRuAak9EP1Bj7kFnRGE0Loxl0=; b=aR3Fe4N4ftppBOmhbO2Iv/LOnYifaiUb31sC2v9KjMeG8K+h7U8kolAt6AWqUOIrFeKfgEA28 XHFIC+LPwNtC0zVlvF+BQ4yYoNA+Wx0JXWcJafUDVD4n9KOUoD7vZCj 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 Move driver to use guard(mutex)() macro, to facilitate automatic locking/unlocking of resources. This modernizes the driver and improves code style. While at it, remove unnecessary gotos and return variables. Reviewed-by: Andy Shevchenko Signed-off-by: Joshua Crofts --- drivers/iio/light/opt3001.c | 61 +++++++++++++----------------------------= ---- 1 file changed, 18 insertions(+), 43 deletions(-) diff --git a/drivers/iio/light/opt3001.c b/drivers/iio/light/opt3001.c index 6f7c524d3a7a41c5177c9b02ebe1b7858294a0b4..39ea60c0af2c1ec7473d49b7377= 8cac1f9bb6086 100644 --- a/drivers/iio/light/opt3001.c +++ b/drivers/iio/light/opt3001.c @@ -10,6 +10,7 @@ =20 #include #include +#include #include #include #include @@ -478,7 +479,6 @@ static int opt3001_read_raw(struct iio_dev *iio, int *val, int *val2, long mask) { struct opt3001 *opt =3D iio_priv(iio); - int ret; =20 if (opt->mode =3D=3D OPT3001_CONFIGURATION_M_CONTINUOUS) return -EBUSY; @@ -486,23 +486,17 @@ static int opt3001_read_raw(struct iio_dev *iio, if (chan->type !=3D opt->chip_info->chan_type) return -EINVAL; =20 - mutex_lock(&opt->lock); + guard(mutex)(&opt->lock); =20 switch (mask) { case IIO_CHAN_INFO_RAW: case IIO_CHAN_INFO_PROCESSED: - ret =3D opt3001_get_processed(opt, val, val2); - break; + return opt3001_get_processed(opt, val, val2); case IIO_CHAN_INFO_INT_TIME: - ret =3D opt3001_get_int_time(opt, val, val2); - break; + return opt3001_get_int_time(opt, val, val2); default: - ret =3D -EINVAL; + return -EINVAL; } - - mutex_unlock(&opt->lock); - - return ret; } =20 static int opt3001_write_raw(struct iio_dev *iio, @@ -510,7 +504,6 @@ static int opt3001_write_raw(struct iio_dev *iio, int val, int val2, long mask) { struct opt3001 *opt =3D iio_priv(iio); - int ret; =20 if (opt->mode =3D=3D OPT3001_CONFIGURATION_M_CONTINUOUS) return -EBUSY; @@ -524,11 +517,9 @@ static int opt3001_write_raw(struct iio_dev *iio, if (val !=3D 0) return -EINVAL; =20 - mutex_lock(&opt->lock); - ret =3D opt3001_set_int_time(opt, val2); - mutex_unlock(&opt->lock); + guard(mutex)(&opt->lock); =20 - return ret; + return opt3001_set_int_time(opt, val2); } =20 static int opt3001_read_event_value(struct iio_dev *iio, @@ -539,28 +530,23 @@ static int opt3001_read_event_value(struct iio_dev *i= io, int *val, int *val2) { struct opt3001 *opt =3D iio_priv(iio); - int ret =3D IIO_VAL_INT_PLUS_MICRO; =20 - mutex_lock(&opt->lock); + guard(mutex)(&opt->lock); =20 switch (dir) { case IIO_EV_DIR_RISING: opt3001_to_iio_ret(opt, opt->high_thresh_exp, opt->high_thresh_mantissa, val, val2); - break; + return IIO_VAL_INT_PLUS_MICRO; case IIO_EV_DIR_FALLING: opt3001_to_iio_ret(opt, opt->low_thresh_exp, opt->low_thresh_mantissa, val, val2); - break; + return IIO_VAL_INT_PLUS_MICRO; default: - ret =3D -EINVAL; + return -EINVAL; } - - mutex_unlock(&opt->lock); - - return ret; } =20 static int opt3001_write_event_value(struct iio_dev *iio, @@ -587,12 +573,12 @@ static int opt3001_write_event_value(struct iio_dev *= iio, if (val < 0) return -EINVAL; =20 - mutex_lock(&opt->lock); + guard(mutex)(&opt->lock); =20 ret =3D opt3001_find_scale(opt, val, val2, &exponent); if (ret < 0) { dev_err(dev, "can't find scale for %d.%06u\n", val, val2); - goto err; + return ret; } =20 whole =3D opt->chip_info->factor_whole; @@ -615,18 +601,12 @@ static int opt3001_write_event_value(struct iio_dev *= iio, opt->low_thresh_exp =3D exponent; break; default: - ret =3D -EINVAL; - goto err; + return -EINVAL; } =20 ret =3D i2c_smbus_write_word_swapped(client, reg, value); - if (ret < 0) { + if (ret < 0) dev_err(dev, "failed to write register %02x\n", reg); - goto err; - } - -err: - mutex_unlock(&opt->lock); =20 return ret; } @@ -660,7 +640,7 @@ static int opt3001_write_event_config(struct iio_dev *i= io, if (!state && opt->mode =3D=3D OPT3001_CONFIGURATION_M_SHUTDOWN) return 0; =20 - mutex_lock(&opt->lock); + guard(mutex)(&opt->lock); =20 mode =3D state ? OPT3001_CONFIGURATION_M_CONTINUOUS : OPT3001_CONFIGURATION_M_SHUTDOWN; @@ -669,21 +649,16 @@ static int opt3001_write_event_config(struct iio_dev = *iio, if (ret < 0) { dev_err(dev, "failed to read register %02x\n", OPT3001_CONFIGURATION); - goto err; + return ret; } =20 reg =3D ret; opt3001_set_mode(opt, ®, mode); =20 ret =3D i2c_smbus_write_word_swapped(client, OPT3001_CONFIGURATION, reg); - if (ret < 0) { + if (ret < 0) dev_err(dev, "failed to write register %02x\n", OPT3001_CONFIGURATION); - goto err; - } - -err: - mutex_unlock(&opt->lock); =20 return ret; } --=20 2.47.3 From nobody Fri Jun 12 21:31:55 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 A603138E8C2; Tue, 12 May 2026 10:57:53 +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=1778583473; cv=none; b=OTGsyUFtTPsp6NJuE8272SRkk7DzpixKxfpnkVNNDmtqeey0iNerRoQfOzVLK4coVdolkdykHU0WK2zxhvClTx8JyV3S4EgmPn755T1lLHqndaot11IdaDyQjmLRXzIJuk/2xG8a0ahp4CwfN+rc7sdCW5B+bzKN4aI4/l2j9Ac= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778583473; c=relaxed/simple; bh=gmfY3KaBUVgnolCkvIMhJ+1i5NvZCAapVQ2SS78eIds=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BLgZHU24Gqx8iGt378EMlE5+pDqCCvq1gKiZVyNFe0qtsD99LtRnKK6VA8KZ6SM91iPnK5t92NH99OOJIpZg1qFtB4PuFB78bUu7B17s5Ocyq9qKHCue+XGa6O4QO/UBjBRttZfEAWCDt4I9rqiaNAIjJrNDaT3rOLZTa9K75Pk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=njMR6zOv; 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="njMR6zOv" Received: by smtp.kernel.org (Postfix) with ESMTPS id 82169C2BCFB; Tue, 12 May 2026 10:57:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778583473; bh=gmfY3KaBUVgnolCkvIMhJ+1i5NvZCAapVQ2SS78eIds=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=njMR6zOvgLW15zHJi0naXf1R0vv8jrKkNaRlYGe9RLTxx5omSkmymdf4oJyLrIi3f emXY+n++jb5t1pFPDsNHZGDKh1ZHy5bFbrKhbXnMmtzAkD0ixsxdCYCkmsUv26NRa0 2U6iex5g7YmvTM/WrTb2hDfW+D3cN8q7yaMgbY5b0QKwCU57v4bXl+KqLbN8Fx65vB zhfi01/WPh6V9X2/ZgiaFjpp7KA/afJ3zIKUjaKYkOFdnsZh1r8IHnSHeLp6svMWs0 XvO5nV9anlo1Wyn6DW6H1FApNaEOQ5K6cSNmMb+Ek3Hq9mzqlzVSUHuSR3wCvLPafL XygzwnBGjCprQ== 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 787E7CD4855; Tue, 12 May 2026 10:57:53 +0000 (UTC) From: Joshua Crofts via B4 Relay Date: Tue, 12 May 2026 12:57:29 +0200 Subject: [PATCH v2 09/10] iio: light: opt3001: switch driver to managed resources 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: <20260512-opt3001-cleanup-v2-9-8018cf3a8a0a@gmail.com> References: <20260512-opt3001-cleanup-v2-0-8018cf3a8a0a@gmail.com> In-Reply-To: <20260512-opt3001-cleanup-v2-0-8018cf3a8a0a@gmail.com> To: Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko , Alexander Koch , Michael Hornung Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Joshua Crofts X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1778583471; l=4086; i=joshua.crofts1@gmail.com; s=20260422; h=from:subject:message-id; bh=4ANghW89O8ZSpqGz7kIpA1BQnkewSIVLpoxIZNOp8yY=; b=4HRc9GwvUYI7ODsQzNSL6+ce3CLIubOU7ws0Unyhwph3i9wfBEtMzWu3iDqWhXFVEPYpcLPPf YxJGsJ1ytAzBesZZ3b26QLwuJM6hEK4+ZKbFnYgUZoiEyLckLP4umon 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 Move the driver to use devm_* functions to automate resource management and simplify error handling. This also allows removal of the opt3001_remove() function. Signed-off-by: Joshua Crofts --- drivers/iio/light/opt3001.c | 75 +++++++++++++++++++++++------------------= ---- 1 file changed, 39 insertions(+), 36 deletions(-) diff --git a/drivers/iio/light/opt3001.c b/drivers/iio/light/opt3001.c index 39ea60c0af2c1ec7473d49b73778cac1f9bb6086..1319e5941b66bd82e4dc2badf5e= a27cacbcfd54a 100644 --- a/drivers/iio/light/opt3001.c +++ b/drivers/iio/light/opt3001.c @@ -702,6 +702,31 @@ static int opt3001_read_id(struct opt3001 *opt) return 0; } =20 +static void opt3001_power_off(void *data) +{ + struct opt3001 *opt =3D data; + struct i2c_client *client =3D opt->client; + struct device *dev =3D opt->dev; + + int ret; + u16 reg; + + ret =3D i2c_smbus_read_word_swapped(client, OPT3001_CONFIGURATION); + if (ret < 0) { + dev_err(dev, "failed to read register %02x\n", + OPT3001_CONFIGURATION); + return; + } + + reg =3D ret; + opt3001_set_mode(opt, ®, OPT3001_CONFIGURATION_M_SHUTDOWN); + + ret =3D i2c_smbus_write_word_swapped(client, OPT3001_CONFIGURATION, reg); + if (ret < 0) + dev_err(dev, "failed to write to register %02x\n", + OPT3001_CONFIGURATION); +} + static int opt3001_configure(struct opt3001 *opt) { struct i2c_client *client =3D opt->client; @@ -740,6 +765,11 @@ static int opt3001_configure(struct opt3001 *opt) return dev_err_probe(dev, ret, "failed to write register %02x\n", OPT3001_CONFIGURATION); =20 + ret =3D devm_add_action_or_reset(dev, opt3001_power_off, opt); + if (ret) + return dev_err_probe(dev, ret, + "failed to register power off function\n"); + ret =3D i2c_smbus_read_word_swapped(client, OPT3001_LOW_LIMIT); if (ret < 0) return dev_err_probe(dev, ret, "failed to read register %02x\n", @@ -834,7 +864,10 @@ static int opt3001_probe(struct i2c_client *client) opt->dev =3D dev; opt->chip_info =3D i2c_get_match_data(client); =20 - mutex_init(&opt->lock); + ret =3D devm_mutex_init(dev, &opt->lock); + if (ret) + return ret; + init_waitqueue_head(&opt->result_ready_queue); i2c_set_clientdata(client, iio); =20 @@ -856,13 +889,12 @@ static int opt3001_probe(struct i2c_client *client) =20 /* Make use of INT pin only if valid IRQ no. is given */ if (irq > 0) { - ret =3D request_threaded_irq(irq, NULL, opt3001_irq, - IRQF_TRIGGER_FALLING | IRQF_ONESHOT, - "opt3001", iio); + ret =3D devm_request_threaded_irq(dev, irq, NULL, opt3001_irq, + IRQF_TRIGGER_FALLING | IRQF_ONESHOT, + "opt3001", iio); if (ret) - return dev_err_probe(dev, ret, - "failed to request IRQ #%d\n", - irq); + return ret; + opt->use_irq =3D true; } else { dev_dbg(dev, "enabling interrupt-less operation\n"); @@ -876,34 +908,6 @@ static int opt3001_probe(struct i2c_client *client) return 0; } =20 -static void opt3001_remove(struct i2c_client *client) -{ - struct iio_dev *iio =3D i2c_get_clientdata(client); - struct opt3001 *opt =3D iio_priv(iio); - struct device *dev =3D opt->dev; - int ret; - u16 reg; - - if (opt->use_irq) - free_irq(client->irq, iio); - - ret =3D i2c_smbus_read_word_swapped(client, OPT3001_CONFIGURATION); - if (ret < 0) { - dev_err(dev, "failed to read register %02x\n", - OPT3001_CONFIGURATION); - return; - } - - reg =3D ret; - opt3001_set_mode(opt, ®, OPT3001_CONFIGURATION_M_SHUTDOWN); - - ret =3D i2c_smbus_write_word_swapped(client, OPT3001_CONFIGURATION, reg); - if (ret < 0) { - dev_err(dev, "failed to write register %02x\n", - OPT3001_CONFIGURATION); - } -} - static const struct opt3001_chip_info opt3001_chip_information =3D { .channels =3D &opt3001_channels, .chan_type =3D IIO_LIGHT, @@ -942,7 +946,6 @@ MODULE_DEVICE_TABLE(of, opt3001_of_match); =20 static struct i2c_driver opt3001_driver =3D { .probe =3D opt3001_probe, - .remove =3D opt3001_remove, .id_table =3D opt3001_id, =20 .driver =3D { --=20 2.47.3 From nobody Fri Jun 12 21:31:55 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 CEB8838E8D7; Tue, 12 May 2026 10:57:53 +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=1778583473; cv=none; b=MHacjIgHhX66zJ/JTPgckrYDvsyKPq61j4PlKiWVaPBsfQoZjoNz97S4xzw3zOFfWGMyhhFeB1wLK4vCsknrGUVafd8/AjNZSR1QM3/oET21XB8/dklmmERnp3cDQMgxyF/SbF1vBQNEfbPr2DtWWDZjbe7DyNIDEjBd95o4cdg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778583473; c=relaxed/simple; bh=hnypABvmlE1Sj2gAeVKyslXoqoLrW5BPh99jpjSy0lc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=k7pjQ4yfCMVIoCApd8zrJcTpLzLwIQ2Nzk5J4tnHIFKpWwZQ3jaPujwmkD/l0dkaHqXYkXZtWr/Fychgab7y/osmqaHa2qvWkjhv1A7cu6T+p035zsharEjaNTNPXbfVIRUhypOeYgUc4IXrMEY1eyjOEuLIskg0MPtDqu5Mct0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=kwWCfrEd; 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="kwWCfrEd" Received: by smtp.kernel.org (Postfix) with ESMTPS id 953ADC32782; Tue, 12 May 2026 10:57:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778583473; bh=hnypABvmlE1Sj2gAeVKyslXoqoLrW5BPh99jpjSy0lc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=kwWCfrEd8A8bKp9dRjQuRGgwPmoyRNs4IBDeeDQlkzhjihOE814vdW5V5hcqMdoI1 XD+Wg7yTnvpEedIBLaUJm/JQN8x6/ZKT7OnraYgIv12uUyHPMzCtjzMV3Kd+mPiGUS rW7fQ9/LlWUUmfwhXEeElzedY5KMrCt1YsybyT0O+eGDQKCkYk3B/+NhQVze+VbGKw h7fxF1UTfsBl4kTwujYdun1wYHRIN9AgZFHHaV9+imnKB1cDEdtFTDDrB2phvIPY3f QKu2ZfEeV6njeItnZVA+7zb1VdQT+oUD4zXkNheR7qEYo/CbA7xu4vkzj7KnmXWgka 80hC1bILN4fEA== 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 8B007CD4F21; Tue, 12 May 2026 10:57:53 +0000 (UTC) From: Joshua Crofts via B4 Relay Date: Tue, 12 May 2026 12:57:30 +0200 Subject: [PATCH v2 10/10] iio: light: opt3001: add comment to mutex 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: <20260512-opt3001-cleanup-v2-10-8018cf3a8a0a@gmail.com> References: <20260512-opt3001-cleanup-v2-0-8018cf3a8a0a@gmail.com> In-Reply-To: <20260512-opt3001-cleanup-v2-0-8018cf3a8a0a@gmail.com> To: Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko , Alexander Koch , Michael Hornung Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Joshua Crofts X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1778583471; l=692; i=joshua.crofts1@gmail.com; s=20260422; h=from:subject:message-id; bh=9LCbzPQ+voynoNiKus4VNoaaKdzkjvLt3vAM6THTWlQ=; b=C7b7QpXCOmCiaZBpNtXGQLqJYiad35EF6gLzN59OCN+4R+cAJn0jx9wPt4oIGoqeXSi5FRx7U Fl2SHx38W0qAnvYCWY5WxMLAOGWGCSMFOvODqtHYuRh0ggI8QvK8daU 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 comment to mutex per checkpatch.pl report. No functional change. Signed-off-by: Joshua Crofts Reviewed-by: Maxwell Doose --- drivers/iio/light/opt3001.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/iio/light/opt3001.c b/drivers/iio/light/opt3001.c index 1319e5941b66bd82e4dc2badf5ea27cacbcfd54a..81afee6993d08b1126f07b1c63c= 3d3496d8b380c 100644 --- a/drivers/iio/light/opt3001.c +++ b/drivers/iio/light/opt3001.c @@ -104,6 +104,7 @@ struct opt3001 { struct i2c_client *client; struct device *dev; =20 + /* Mutex for ensuring one executed command at a time */ struct mutex lock; bool ok_to_ignore_lock; bool result_ready; --=20 2.47.3