Re: [PATCH v2 4/6] staging: iio: ad9832: remove dds.h dependency
From: Andy Shevchenko
Date: Mon Jan 05 2026 - 11:09:32 EST
On Sun, Jan 04, 2026 at 02:25:23AM -0300, Tomas Borquez wrote:
> On Wed, Dec 31, 2025 at 12:46:28AM +0200, Andy Shevchenko wrote:
> > On Tue, Dec 30, 2025 at 10:35 PM Tomas Borquez <tomasborquez13@xxxxxxxxx> wrote:
...
> > > +static IIO_DEVICE_ATTR(out_altvoltage0_frequency0, 0200, NULL, ad9832_write, AD9832_FREQ0HM);
> > > +static IIO_DEVICE_ATTR(out_altvoltage0_frequency1, 0200, NULL, ad9832_write, AD9832_FREQ1HM);
> >
> > Any particular point in not using _WO() / _RO() variants of the
> > IIO_DEVICE_ATTR_*() macros?
> I was looking into this and saw that the definition for both _WO() and _RO() only takes _name and _addr:
>
> #define IIO_DEVICE_ATTR_WO(_name, _addr) \
> struct iio_dev_attr iio_dev_attr_##_name = IIO_ATTR_WO(_name, _addr)
>
> So if we use it for frequency0 for example, it assumes the store function
> since we don't pass it:
>
> static IIO_DEVICE_ATTR_WO(out_altvoltage0_frequency0, AD9832_FREQ0HM);
>
> // Expands to
> struct iio_dev_attr iio_dev_attr_out_altvoltage0_frequency0 = {
> .dev_attr = {
> . attr = {
> ...
> .store = out_altvoltage0_frequency0_store,
> }
> }
> }
>
> Meaning we would have to create a store for each one instead of using
> just one write function
Yes, and it will be fine, no? Explicit is better than implicit
(at least in this case).
--
With Best Regards,
Andy Shevchenko