Linux IIO development
 help / color / mirror / Atom feed
* [PATCH v5 0/3] iio: frequency: ad9523: fix checkpatch warnings
@ 2026-02-25 19:40 Bhargav Joshi
  2026-02-25 19:40 ` [PATCH v5 1/3] iio: frequency: ad9523: fix implicit variable Bhargav Joshi
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Bhargav Joshi @ 2026-02-25 19:40 UTC (permalink / raw)
  To: lars, Michael.Hennerich, jic23
  Cc: dlechner, nuno.sa, andy, linux-iio, linux-kernel, rougueprince47

These patches address several checkpatch warnings in the ad9523 driver.

Patch 1: Updated the macros to properly use their argument x.
Patch 2: Fixed the multi-line pointer dereferences.
Patch 3: Updated symbolic permissions to octal (0444/0200).

Changes in v5:
- Reflowed all commit messages to properly wrap near 72 characters as
requested.
- Collected Reviewed-by tags for patches 1 and 3.

Changes in v4:
- Used full name for SoB 

Changes in v3:
- Patch 1: updated macros to use '(x)' instead of 'x'.
- Patch 2: collected reviewed-by (no code changes).
- Patch 3: fixed vertical spacing and broken indentation.

bhargav (3):
  iio: frequency: ad9523: fix implicit variable usage in macros
  iio: frequency: ad9523: avoid multiple line dereferences for pdata
  iio: frequency: ad9523: fix checkpatch warnings for symbolic
    permissions

 drivers/iio/frequency/ad9523.c | 88 +++++++++++++---------------------
 1 file changed, 33 insertions(+), 55 deletions(-)

-- 
2.53.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v5 1/3] iio: frequency: ad9523: fix implicit variable
  2026-02-25 19:40 [PATCH v5 0/3] iio: frequency: ad9523: fix checkpatch warnings Bhargav Joshi
@ 2026-02-25 19:40 ` Bhargav Joshi
  2026-02-25 19:43   ` Andy Shevchenko
  2026-02-25 19:40 ` [PATCH v5 2/3] iio: frequency: ad9523: avoid multiple line Bhargav Joshi
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Bhargav Joshi @ 2026-02-25 19:40 UTC (permalink / raw)
  To: lars, Michael.Hennerich, jic23
  Cc: dlechner, nuno.sa, andy, linux-iio, linux-kernel, rougueprince47,
	Andy Shevchenko

Macros AD9523_CLK_DIST_DIV_PHASE_REV(x) and AD9523_CLK_DIST_DIV_REV(x)
implicitly relied on variable named 'ret' instead of using passed
argument '(x)'. Update the macros to explicitly use the argument '(x)'
for their operations.

This also resolves the following checkpatch.pl warning: Argument '(x)'
is not used in function-like macro

Signed-off-by: Bhargav Joshi <rougueprince47@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
---
Changes in v5:
- Reflowed all commit messages to properly wrap near 72 characters as
  requested.
- Collected Reviewed-by tag.

Changes in v4:
- Used full name for SoB 

Changes in v3:
- Updated macros to use '(x)' instead of 'x'.

 drivers/iio/frequency/ad9523.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/frequency/ad9523.c b/drivers/iio/frequency/ad9523.c
index 63c485e9e44c..5725ab62e0fd 100644
--- a/drivers/iio/frequency/ad9523.c
+++ b/drivers/iio/frequency/ad9523.c
@@ -167,9 +167,9 @@
 
 /* AD9523_CHANNEL_CLOCK_DIST */
 #define AD9523_CLK_DIST_DIV_PHASE(x)		(((x) & 0x3F) << 18)
-#define AD9523_CLK_DIST_DIV_PHASE_REV(x)	((ret >> 18) & 0x3F)
+#define AD9523_CLK_DIST_DIV_PHASE_REV(x)	(((x) >> 18) & 0x3F)
 #define AD9523_CLK_DIST_DIV(x)			((((x) - 1) & 0x3FF) << 8)
-#define AD9523_CLK_DIST_DIV_REV(x)		(((ret >> 8) & 0x3FF) + 1)
+#define AD9523_CLK_DIST_DIV_REV(x)		((((x) >> 8) & 0x3FF) + 1)
 #define AD9523_CLK_DIST_INV_DIV_OUTPUT_EN	(1 << 7)
 #define AD9523_CLK_DIST_IGNORE_SYNC_EN		(1 << 6)
 #define AD9523_CLK_DIST_PWR_DOWN_EN		(1 << 5)
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v5 2/3] iio: frequency: ad9523: avoid multiple line
  2026-02-25 19:40 [PATCH v5 0/3] iio: frequency: ad9523: fix checkpatch warnings Bhargav Joshi
  2026-02-25 19:40 ` [PATCH v5 1/3] iio: frequency: ad9523: fix implicit variable Bhargav Joshi
@ 2026-02-25 19:40 ` Bhargav Joshi
  2026-02-25 19:40 ` Bhargav Joshi
  2026-02-25 19:45 ` [PATCH v5 0/3] iio: frequency: ad9523: fix checkpatch warnings Andy Shevchenko
  3 siblings, 0 replies; 7+ messages in thread
From: Bhargav Joshi @ 2026-02-25 19:40 UTC (permalink / raw)
  To: lars, Michael.Hennerich, jic23
  Cc: dlechner, nuno.sa, andy, linux-iio, linux-kernel, rougueprince47,
	Andy Shevchenko

Platform data pointer dereferences for pll1_charge_pump_current_nA and
pll2_charge_pump_current_nA were split across multiple lines. Bring the
dereference chains onto a single line.

This resolves the following checkpatch.pl warnings:
WARNING: Avoid multiple line dereference - prefer 'pdata->pll1_charge_pump_current_nA'
WARNING: Avoid multiple line dereference - prefer 'pdata->pll2_charge_pump_current_nA'

Signed-off-by: Bhargav Joshi <rougueprince47@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
---
Changes in v5:
- Reflowed all commit messages to properly wrap near 72 characters as
  requested except for warning messages.

Changes in v4:
- Used full name for SoB 

Changes in v3:
- Collected reviewed-by (no code changes).

 drivers/iio/frequency/ad9523.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/frequency/ad9523.c b/drivers/iio/frequency/ad9523.c
index 5725ab62e0fd..6daa2ea354a8 100644
--- a/drivers/iio/frequency/ad9523.c
+++ b/drivers/iio/frequency/ad9523.c
@@ -797,8 +797,7 @@ static int ad9523_setup(struct iio_dev *indio_dev)
 		return ret;
 
 	ret = ad9523_write(indio_dev, AD9523_PLL1_CHARGE_PUMP_CTRL,
-		AD9523_PLL1_CHARGE_PUMP_CURRENT_nA(pdata->
-			pll1_charge_pump_current_nA) |
+		AD9523_PLL1_CHARGE_PUMP_CURRENT_nA(pdata->pll1_charge_pump_current_nA) |
 		AD9523_PLL1_CHARGE_PUMP_MODE_NORMAL |
 		AD9523_PLL1_BACKLASH_PW_MIN);
 	if (ret < 0)
@@ -842,8 +841,7 @@ static int ad9523_setup(struct iio_dev *indio_dev)
 	 */
 
 	ret = ad9523_write(indio_dev, AD9523_PLL2_CHARGE_PUMP,
-		AD9523_PLL2_CHARGE_PUMP_CURRENT_nA(pdata->
-			pll2_charge_pump_current_nA));
+		AD9523_PLL2_CHARGE_PUMP_CURRENT_nA(pdata->pll2_charge_pump_current_nA));
 	if (ret < 0)
 		return ret;
 
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* (no subject)
  2026-02-25 19:40 [PATCH v5 0/3] iio: frequency: ad9523: fix checkpatch warnings Bhargav Joshi
  2026-02-25 19:40 ` [PATCH v5 1/3] iio: frequency: ad9523: fix implicit variable Bhargav Joshi
  2026-02-25 19:40 ` [PATCH v5 2/3] iio: frequency: ad9523: avoid multiple line Bhargav Joshi
@ 2026-02-25 19:40 ` Bhargav Joshi
  2026-02-25 19:43   ` Andy Shevchenko
  2026-02-25 19:45 ` [PATCH v5 0/3] iio: frequency: ad9523: fix checkpatch warnings Andy Shevchenko
  3 siblings, 1 reply; 7+ messages in thread
From: Bhargav Joshi @ 2026-02-25 19:40 UTC (permalink / raw)
  To: lars, Michael.Hennerich, jic23
  Cc: dlechner, nuno.sa, andy, linux-iio, linux-kernel, rougueprince47,
	Andy Shevchenko

Subject: [PATCH v5 3/3] iio: frequency: ad9523: fix checkpatch warnings
for symbolic permissions

The driver currently defines device attributes using symbolic permission
flags (S_IRUGO and S_IWUSR). Update these to use octal permissions (0444
and 0200) to resolve checkpatch warnings.

Signed-off-by: Bhargav Joshi <rougueprince47@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
---
Changes in v5:
- Reflowed all commit messages to properly wrap near 72 characters as
  requested.
- Collected Reviewed-by tag.

Changes in v4:
- Used full name for SoB 

Changes in v3:
- Fixed vertical spacing and broken indentation.

 drivers/iio/frequency/ad9523.c | 78 +++++++++++++---------------------
 1 file changed, 29 insertions(+), 49 deletions(-)

diff --git a/drivers/iio/frequency/ad9523.c b/drivers/iio/frequency/ad9523.c
index 6daa2ea354a8..ad32eb66edca 100644
--- a/drivers/iio/frequency/ad9523.c
+++ b/drivers/iio/frequency/ad9523.c
@@ -558,55 +558,35 @@ static ssize_t ad9523_show(struct device *dev,
 	return ret;
 }
 
-static IIO_DEVICE_ATTR(pll1_locked, S_IRUGO,
-			ad9523_show,
-			NULL,
-			AD9523_STAT_PLL1_LD);
-
-static IIO_DEVICE_ATTR(pll2_locked, S_IRUGO,
-			ad9523_show,
-			NULL,
-			AD9523_STAT_PLL2_LD);
-
-static IIO_DEVICE_ATTR(pll1_reference_clk_a_present, S_IRUGO,
-			ad9523_show,
-			NULL,
-			AD9523_STAT_REFA);
-
-static IIO_DEVICE_ATTR(pll1_reference_clk_b_present, S_IRUGO,
-			ad9523_show,
-			NULL,
-			AD9523_STAT_REFB);
-
-static IIO_DEVICE_ATTR(pll1_reference_clk_test_present, S_IRUGO,
-			ad9523_show,
-			NULL,
-			AD9523_STAT_REF_TEST);
-
-static IIO_DEVICE_ATTR(vcxo_clk_present, S_IRUGO,
-			ad9523_show,
-			NULL,
-			AD9523_STAT_VCXO);
-
-static IIO_DEVICE_ATTR(pll2_feedback_clk_present, S_IRUGO,
-			ad9523_show,
-			NULL,
-			AD9523_STAT_PLL2_FB_CLK);
-
-static IIO_DEVICE_ATTR(pll2_reference_clk_present, S_IRUGO,
-			ad9523_show,
-			NULL,
-			AD9523_STAT_PLL2_REF_CLK);
-
-static IIO_DEVICE_ATTR(sync_dividers, S_IWUSR,
-			NULL,
-			ad9523_store,
-			AD9523_SYNC);
-
-static IIO_DEVICE_ATTR(store_eeprom, S_IWUSR,
-			NULL,
-			ad9523_store,
-			AD9523_EEPROM);
+static IIO_DEVICE_ATTR(pll1_locked, 0444, ad9523_show, NULL,
+		       AD9523_STAT_PLL1_LD);
+
+static IIO_DEVICE_ATTR(pll2_locked, 0444, ad9523_show, NULL,
+		       AD9523_STAT_PLL2_LD);
+
+static IIO_DEVICE_ATTR(pll1_reference_clk_a_present, 0444, ad9523_show, NULL,
+		       AD9523_STAT_REFA);
+
+static IIO_DEVICE_ATTR(pll1_reference_clk_b_present, 0444, ad9523_show, NULL,
+		       AD9523_STAT_REFB);
+
+static IIO_DEVICE_ATTR(pll1_reference_clk_test_present, 0444, ad9523_show, NULL,
+		       AD9523_STAT_REF_TEST);
+
+static IIO_DEVICE_ATTR(vcxo_clk_present, 0444, ad9523_show, NULL,
+		       AD9523_STAT_VCXO);
+
+static IIO_DEVICE_ATTR(pll2_feedback_clk_present, 0444, ad9523_show, NULL,
+		       AD9523_STAT_PLL2_FB_CLK);
+
+static IIO_DEVICE_ATTR(pll2_reference_clk_present, 0444, ad9523_show, NULL,
+		       AD9523_STAT_PLL2_REF_CLK);
+
+static IIO_DEVICE_ATTR(sync_dividers, 0200, NULL, ad9523_store,
+		       AD9523_SYNC);
+
+static IIO_DEVICE_ATTR(store_eeprom, 0200, NULL, ad9523_store,
+		       AD9523_EEPROM);
 
 static struct attribute *ad9523_attributes[] = {
 	&iio_dev_attr_sync_dividers.dev_attr.attr,
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v5 1/3] iio: frequency: ad9523: fix implicit variable
  2026-02-25 19:40 ` [PATCH v5 1/3] iio: frequency: ad9523: fix implicit variable Bhargav Joshi
@ 2026-02-25 19:43   ` Andy Shevchenko
  0 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2026-02-25 19:43 UTC (permalink / raw)
  To: Bhargav Joshi
  Cc: lars, Michael.Hennerich, jic23, dlechner, nuno.sa, andy,
	linux-iio, linux-kernel, Andy Shevchenko

On Wed, Feb 25, 2026 at 9:41 PM Bhargav Joshi <rougueprince47@gmail.com> wrote:
>
> Macros AD9523_CLK_DIST_DIV_PHASE_REV(x) and AD9523_CLK_DIST_DIV_REV(x)

Too long...

> implicitly relied on variable named 'ret' instead of using passed

on the variable

> argument '(x)'. Update the macros to explicitly use the argument '(x)'
> for their operations.
>
> This also resolves the following checkpatch.pl warning: Argument '(x)'
> is not used in function-like macro

Still missing period.

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re:
  2026-02-25 19:40 ` Bhargav Joshi
@ 2026-02-25 19:43   ` Andy Shevchenko
  0 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2026-02-25 19:43 UTC (permalink / raw)
  To: Bhargav Joshi
  Cc: lars, Michael.Hennerich, jic23, dlechner, nuno.sa, andy,
	linux-iio, linux-kernel, Andy Shevchenko

On Wed, Feb 25, 2026 at 9:42 PM Bhargav Joshi <rougueprince47@gmail.com> wrote:
>
> Subject: [PATCH v5 3/3] iio: frequency: ad9523: fix checkpatch warnings
> for symbolic permissions

Something went wrong...

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v5 0/3] iio: frequency: ad9523: fix checkpatch warnings
  2026-02-25 19:40 [PATCH v5 0/3] iio: frequency: ad9523: fix checkpatch warnings Bhargav Joshi
                   ` (2 preceding siblings ...)
  2026-02-25 19:40 ` Bhargav Joshi
@ 2026-02-25 19:45 ` Andy Shevchenko
  3 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2026-02-25 19:45 UTC (permalink / raw)
  To: Bhargav Joshi
  Cc: lars, Michael.Hennerich, jic23, dlechner, nuno.sa, andy,
	linux-iio, linux-kernel

On Wed, Feb 25, 2026 at 9:41 PM Bhargav Joshi <rougueprince47@gmail.com> wrote:
>
> These patches address several checkpatch warnings in the ad9523 driver.
>
> Patch 1: Updated the macros to properly use their argument x.
> Patch 2: Fixed the multi-line pointer dereferences.
> Patch 3: Updated symbolic permissions to octal (0444/0200).

Thanks for the update, it still needs more amendments (something even
went wrong in patch 3).

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-02-25 19:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-25 19:40 [PATCH v5 0/3] iio: frequency: ad9523: fix checkpatch warnings Bhargav Joshi
2026-02-25 19:40 ` [PATCH v5 1/3] iio: frequency: ad9523: fix implicit variable Bhargav Joshi
2026-02-25 19:43   ` Andy Shevchenko
2026-02-25 19:40 ` [PATCH v5 2/3] iio: frequency: ad9523: avoid multiple line Bhargav Joshi
2026-02-25 19:40 ` Bhargav Joshi
2026-02-25 19:43   ` Andy Shevchenko
2026-02-25 19:45 ` [PATCH v5 0/3] iio: frequency: ad9523: fix checkpatch warnings Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox