Re: [PATCH] iio:frequency:ad9523:convert symbolic permissions to octal and remove unwanted arguments in macro

From: Andy Shevchenko

Date: Thu Feb 19 2026 - 02:44:16 EST


On Thu, Feb 19, 2026 at 06:32:44AM +0530, bhargav wrote:
> this fixes following warnings in checkpatch

1. Respect English grammar and punctuation.
2. Use imperative mood (as per Submitting Patches)
3. Choose correct style for $Subject
(see `git log --no-merges --oneline -- $FILE` to how mark it properly)

> WARNING: Argument 'x' is not used in function-like macro
> WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'.
> WARNING: Symbolic permissions 'S_IWUSR' are not preferred. Consider using octal permissions '0200'.
> WARNING: Avoid multiple line dereference - prefer 'pdata->pll1_charge_pump_current_nA'
> WARNING: Avoid multiple line dereference - prefer 'pdata->pll2_charge_pump_current_nA'

These are three changes in one patch. Split them. Also see below.

...

> -#define AD9523_CLK_DIST_DIV_PHASE_REV(x) ((ret >> 18) & 0x3F)
> +#define AD9523_CLK_DIST_DIV_PHASE_REV ((ret >> 18) & 0x3F)

> -#define AD9523_CLK_DIST_DIV_REV(x) (((ret >> 8) & 0x3FF) + 1)
> +#define AD9523_CLK_DIST_DIV_REV (((ret >> 8) & 0x3FF) + 1)

Make use of '(x)' instead, having 'ret' here is definitely a bad code.

...

> -static IIO_DEVICE_ATTR(pll1_locked, S_IRUGO,
> +static IIO_DEVICE_ATTR(pll1_locked, 0444,
> ad9523_show,
> NULL,
> AD9523_STAT_PLL1_LD);

No, instead of doing this, just convert to use IIO_DEVICE_ATTR_RO() and
respectively for the rest.

...

> @@ -649,11 +649,11 @@ static int ad9523_read_raw(struct iio_dev *indio_dev,
> return IIO_VAL_INT;
> case IIO_CHAN_INFO_FREQUENCY:
> *val = st->vco_out_freq[st->vco_out_map[chan->channel]] /
> - AD9523_CLK_DIST_DIV_REV(ret);
> + AD9523_CLK_DIST_DIV_REV;
> return IIO_VAL_INT;
> case IIO_CHAN_INFO_PHASE:
> - code = (AD9523_CLK_DIST_DIV_PHASE_REV(ret) * 3141592) /
> - AD9523_CLK_DIST_DIV_REV(ret);
> + code = (AD9523_CLK_DIST_DIV_PHASE_REV * 3141592) /
> + AD9523_CLK_DIST_DIV_REV;
> *val = code / 1000000;
> *val2 = code % 1000000;
> return IIO_VAL_INT_PLUS_MICRO;
> @@ -701,7 +701,7 @@ static int ad9523_write_raw(struct iio_dev *indio_dev,
> break;
> case IIO_CHAN_INFO_PHASE:
> code = val * 1000000 + val2 % 1000000;
> - tmp = (code * AD9523_CLK_DIST_DIV_REV(ret)) / 3141592;
> + tmp = (code * AD9523_CLK_DIST_DIV_REV) / 3141592;
> tmp = clamp(tmp, 0, 63);
> reg &= ~AD9523_CLK_DIST_DIV_PHASE(~0);
> reg |= AD9523_CLK_DIST_DIV_PHASE(tmp);

No for the above. This should be left untouched. Or more work is needed
if we want to have meaningful name instead of 'ret' here.

...

> 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;

These are okay despite being long.

--
With Best Regards,
Andy Shevchenko