Re: [PATCH v2 08/10] iio: pressure: mprls0025pa.c refactor

From: Jonathan Cameron
Date: Sat Dec 30 2023 - 06:34:59 EST


On Wed, 27 Dec 2023 18:37:42 +0200
Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:

> On Wed, Dec 27, 2023 at 04:33:37PM +0200, Petre Rodan wrote:
> > On Tue, Dec 26, 2023 at 04:49:22PM +0000, Jonathan Cameron wrote:
>
> ,,,
>
> > > > ret = devm_request_irq(dev, data->irq, mpr_eoc_handler,
> > > > - IRQF_TRIGGER_RISING, client->name, data);
> > > > + IRQF_TRIGGER_RISING, dev_name(dev), data);
> > >
> > > Even though you'll change it again here, would have been nice to have
> > > the alignment fixed in the earlier patch then the code update here.
> >
> > I tried this, but due to the fact that the line has to be right-aligned to
> > column 80 we will still see a whitespace difference due to the length diff of
> > the name-related argument.
>
> You can split in the previous patch accordingly, so data comes to a new line.
>
> ...
>
> > > > +#include <linux/iio/iio.h>
> > >
> > > Why include this? Can't see an IIO specific stuff in here.
> >
> > tried to remove it and
> >
> > CC [M] mprls0025pa_i2c.o
> > mprls0025pa.h:89:63: error: 'IIO_DMA_MINALIGN' undeclared here (not in a function); did you mean 'ARCH_DMA_MINALIGN'?
> > 89 | u8 buffer[MPR_MEASUREMENT_RD_SIZE] __aligned(IIO_DMA_MINALIGN);
>
> > I guess it makes more sense to move it to the .h file, where buffer[] is defined.
>
> Yes, C-code and especially headers should follow IWYI principle. The real user
> of that definition is _the header_ file, and not C in this case.

Absolutely - it is clear why this should be included from the header file.

Jonathan

>
>