Re: [PATCH v7 2/4] iio: adc: Add Xilinx AMS driver

From: Jonathan Cameron
Date: Wed Nov 03 2021 - 13:15:01 EST


On Tue, 2 Nov 2021 21:31:21 +0000
Anand Ashok Dumbre <ANANDASH@xxxxxxxxxx> wrote:

> Hi Andy,
>
> Thanks for the review.
...

> > > + return IRQ_NONE;
> >
> > ...
> >
> > > + for_each_child_of_node(chan_node, child) {
> > > + ret = of_property_read_u32(child, "reg", &reg);
> > > + if (ret || reg > (AMS_PL_MAX_EXT_CHANNEL + 30))
> > > + continue;
> > > +
> > > + memcpy(&channels[num_channels], &ams_pl_channels[reg +
> > > + AMS_PL_MAX_FIXED_CHANNEL - 30],
> > > + sizeof(*channels));
> > > +
> > > + if (of_property_read_bool(child, "xlnx,bipolar"))
> > > + channels[num_channels].scan_type.sign = 's';
> > > +
> > > + num_channels++;
> > > + }
> >
> > Use device property API here instead of *of_*() calls.
>
>
> >
> > ...
> >
> > > + /* Initialize buffer for channel specification */
> > > + ams_channels = kzalloc(sizeof(ams_ps_channels) +
> > > + sizeof(ams_pl_channels) +
> > > + sizeof(ams_ctrl_channels), GFP_KERNEL);
> >
> > Use the corresponding macro from overflow.h.
> >
> > > + if (!ams_channels)
> > > + return -ENOMEM;
> >
> > ...
> >
> > > + if (of_device_is_available(np)) {
> >
> > fwnode_device_is_available()
>
> Currently acpi is not supported with this driver. But I will add support in the next series of patches.
> I don’t have a full understanding of ACPI and its interfaces. So would it be okay once the first iteration
> gets checked in, I will add ACPI support on top.

If you use the generic fwnode etc from property.h then dt
will just work and it may well be enough to enable the weirdness that
is ACPI ID PRP0001 which actually uses dt properties but reads them
from an ACPI DSDT.

So basically nothing to do except use the generic accessors rather than
the of_ variants.

Jonathan