All of lore.kernel.org
 help / color / mirror / Atom feed
From: andy.shevchenko@gmail.com
To: Herve Codina <herve.codina@bootlin.com>
Cc: Jonathan Cameron <jic23@kernel.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Christophe Leroy <christophe.leroy@csgroup.eu>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH v4 2/3] iio: potentiometer: Add support for the Renesas X9250 potentiometers
Date: Mon, 29 May 2023 01:35:46 +0300	[thread overview]
Message-ID: <ZHPXQiD7GlBhBiCx@surfacebook> (raw)
In-Reply-To: <20230509160852.158101-3-herve.codina@bootlin.com>

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



  parent reply	other threads:[~2023-05-28 22:35 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-09 16:08 [PATCH v4 0/3] Add the Renesas X9250 potentiometers IIO support Herve Codina
2023-05-09 16:08 ` [PATCH v4 1/3] dt-bindings: iio: potentiometer: Add the Renesas X9250 potentiometers Herve Codina
2023-05-09 17:34   ` Krzysztof Kozlowski
2023-05-09 16:08 ` [PATCH v4 2/3] iio: potentiometer: Add support for " Herve Codina
2023-05-13 18:35   ` Jonathan Cameron
2023-05-14 14:32     ` Herve Codina
2023-05-14 17:19       ` Jonathan Cameron
2023-05-15  6:44         ` Herve Codina
2023-05-20 16:30           ` Jonathan Cameron
2023-05-29 15:57             ` andy.shevchenko
2023-06-04 12:57               ` Jonathan Cameron
2023-05-28 22:35   ` andy.shevchenko [this message]
2023-05-09 16:08 ` [PATCH v4 3/3] MAINTAINERS: add the Renesas X9250 driver entry Herve Codina
2023-05-13 18:35 ` [PATCH v4 0/3] Add the Renesas X9250 potentiometers IIO support Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZHPXQiD7GlBhBiCx@surfacebook \
    --to=andy.shevchenko@gmail.com \
    --cc=christophe.leroy@csgroup.eu \
    --cc=devicetree@vger.kernel.org \
    --cc=herve.codina@bootlin.com \
    --cc=jic23@kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=thomas.petazzoni@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.