Messages in this thread | | | From | andy.shevchenko@gmail ... | Date | Mon, 29 May 2023 01:35:46 +0300 | Subject | Re: [PATCH v4 2/3] iio: potentiometer: Add support for the Renesas X9250 potentiometers |
| |
Tue, May 09, 2023 at 06:08:51PM +0200, Herve Codina kirjoitti: > The Renesas X9250 integrates four digitally controlled potentiometers. > On each potentiometer, the X9250T has a 100 kOhms total resistance and > the X9250U has a 50 kOhms total resistance.
...
> +/*
> + *
Redundant blank line.
> + * x9250.c -- Renesas X9250 potentiometers IIO driver
Please, no filename in the file itself. It adds an additional burden in case the module will be renamed in the future.
> + * Copyright 2023 CS GROUP France > + * > + * Author: Herve Codina <herve.codina@bootlin.com> > + */
> +#include <linux/delay.h> > +#include <linux/gpio/consumer.h> > +#include <linux/iio/iio.h> > +#include <linux/limits.h> > +#include <linux/module.h> > +#include <linux/regulator/consumer.h> > +#include <linux/slab.h> > +#include <linux/spi/spi.h>
...
> + return spi_write_then_read(x9250->spi, txbuf, ARRAY_SIZE(txbuf), NULL, 0);
sizeof() suffice.
...
> + return spi_write_then_read(x9250->spi, txbuf, ARRAY_SIZE(txbuf), val, 1);
Ditto.
...
> + switch (mask) { > + case IIO_CHAN_INFO_RAW: > + ret = x9250_read8(x9250, X9250_CMD_RD_WCR(ch), &v); > + if (ret) > + return ret; > + *val = v; > + return IIO_VAL_INT; > + > + case IIO_CHAN_INFO_SCALE: > + *val = 1000 * x9250->cfg->kohms; > + *val2 = U8_MAX; > + return IIO_VAL_FRACTIONAL; > + }
> + return -EINVAL;
Just make it part of default: case.
...
> + switch (mask) { > + case IIO_CHAN_INFO_RAW: > + *length = ARRAY_SIZE(range); > + *vals = range; > + *type = IIO_VAL_INT; > + return IIO_AVAIL_RANGE; > + } > + > + return -EINVAL;
Same.
...
> + if (val > U8_MAX || val < 0) > + return -EINVAL;
ERANGE ?
...
> +
Redundant blank line.
> +module_spi_driver(x9250_spi_driver);
-- With Best Regards, Andy Shevchenko
| |