Re: [PATCH v2 4/6] staging: iio: ad9832: remove dds.h dependency
From: Tomas Borquez
Date: Sun Jan 04 2026 - 00:25:30 EST
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:
> >
> > Remove dependency on dds.h by converting custom macros to standard IIO
> > attribute declarations.
>
>
> > +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
> --
> With Best Regards,
> Andy Shevchenko