[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Ye7DSAN4gdhXfEUs@smile.fi.intel.com>
Date: Mon, 24 Jan 2022 17:18:32 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Jonathan Cameron <jic23@...nel.org>
Cc: Dmitry Baryshkov <dmitry.baryshkov@...aro.org>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>,
Andreas Kemnade <andreas@...nade.info>,
linux-arm-msm@...r.kernel.org, linux-iio@...r.kernel.org,
linux-kernel@...r.kernel.org, Andy Gross <agross@...nel.org>,
Bjorn Andersson <bjorn.andersson@...aro.org>,
Lars-Peter Clausen <lars@...afoo.de>,
Peter Rosin <peda@...ntia.se>
Subject: Re: [PATCH v2 5/5] iio: afe: iio-rescale: Re-use generic struct
s32_fract
On Sat, Jan 15, 2022 at 06:52:03PM +0000, Jonathan Cameron wrote:
> On Mon, 10 Jan 2022 21:31:04 +0200
> Andy Shevchenko <andriy.shevchenko@...ux.intel.com> wrote:
>
> > Instead of custom data type re-use generic struct s32_fract.
> > No changes intended.
> >
> > The new member is put to be the first one to avoid additional
> > pointer arithmetic. Besides that one may switch to use fract
> > member to perform container_of(), which will be no-op in this
> > case, to get struct rescale.
> >
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
>
> I'm not totally sold on this series showing there is a strong case for
> these macros so interested to hear what others think.
So far no news :-)
> Boiler plate removal is always nice of course...
That's what I considered nice as well.
...
> > I found this better in order how code is structurally (re)organized.
> > I may rebase this on top of ongoing AFE series.
> >
> > Also reveals possibility to switch to rational best approximation.
> > But this is another story...
>
> Now that may well justify introducing this shared infrastructure :)
We also have mult_frac() macro which can be extended by mult_fract() for
these structures.
...
> > rescale = iio_priv(indio_dev);
> > -
> > + rescale->source = source;
>
> There seems to be more reorganizing going on in here than is necessary
> for the function of this patch. At very least, description should
> call it out. Why move setting source?
Yeah, I agree that this may be in a separate change before of after the series.
I will split.
> > rescale->cfg = of_device_get_match_data(dev);
> > - rescale->numerator = 1;
> > - rescale->denominator = 1;
> >
> > - ret = rescale->cfg->props(dev, rescale);
> > + fract = &rescale->fract;
> > + fract->numerator = 1;
> > + fract->denominator = 1;
> > - rescale->source = source;
> > -
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists