[PATCH v2 1/3] iio: frequency: ad9523: fix implicit variable usage in macros

bhargav posted 3 patches 1 month, 1 week ago
There is a newer version of this series
[PATCH v2 1/3] iio: frequency: ad9523: fix implicit variable usage in macros
Posted by bhargav 1 month, 1 week ago
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:
WARNING: Argument 'x' is not used in function-like macro

Signed-off-by: bhargav <rougueprince47@gmail.com>
---
 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..d127f3aa6cb8 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
Re: [PATCH v2 1/3] iio: frequency: ad9523: fix implicit variable usage in macros
Posted by Andy Shevchenko 1 month, 1 week ago
On Fri, Feb 20, 2026 at 02:02:13AM +0530, bhargav wrote:
> 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:
> WARNING: Argument 'x' is not used in function-like macro

...

>  #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)

See above, this should be '(x)' and not 'x'.

...

>  #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)

Ditto.

-- 
With Best Regards,
Andy Shevchenko