public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Marek Vasut <marex@denx.de>
Cc: linux-iio@vger.kernel.org,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Lars-Peter Clausen" <lars@metafoo.de>
Subject: Re: [PATCH 1/5] iio: light: noa1305: Simplify noa1305_read_raw()
Date: Sat, 20 Jul 2024 14:29:28 +0100	[thread overview]
Message-ID: <20240720142928.7a913229@jic23-huawei> (raw)
In-Reply-To: <20240715183120.143417-1-marex@denx.de>

On Mon, 15 Jul 2024 20:28:55 +0200
Marek Vasut <marex@denx.de> wrote:

> The only channel this hardware supports is IIO_LIGHT, if the channel
> is anything else, exit right away. The 'ret' variable is now always
> only assigned by noa1305_measure(), do not initialize it anymore.
> Update function parameter indent. No functional change.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
Hi Marek,

One minor thing - please use a cover letter.
Provides an obvious place for me to reply when picking things up and
gives the whole series a meaningful title in patchwork.

Anyhow, looks straight forward to me so I'll apply it to my current testing
tree. Not that will get rebased on rc1 once available.
If anyone has additional feedback in the meantime I'm happy to rebase
until this gets pushed out as togreg so can add tags or make other changes.

Thanks,

Jonathan

> ---
> Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
> Cc: Jonathan Cameron <jic23@kernel.org>
> Cc: Lars-Peter Clausen <lars@metafoo.de>
> Cc: linux-iio@vger.kernel.org
> ---
>  drivers/iio/light/noa1305.c | 37 +++++++++++++------------------------
>  1 file changed, 13 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/iio/light/noa1305.c b/drivers/iio/light/noa1305.c
> index 596cc48c4c341..a76f158bb50e5 100644
> --- a/drivers/iio/light/noa1305.c
> +++ b/drivers/iio/light/noa1305.c
> @@ -125,38 +125,27 @@ static const struct iio_chan_spec noa1305_channels[] = {
>  };
>  
>  static int noa1305_read_raw(struct iio_dev *indio_dev,
> -				struct iio_chan_spec const *chan,
> -				int *val, int *val2, long mask)
> +			    struct iio_chan_spec const *chan,
> +			    int *val, int *val2, long mask)
>  {
> -	int ret = -EINVAL;
>  	struct noa1305_priv *priv = iio_priv(indio_dev);
> +	int ret;
> +
> +	if (chan->type != IIO_LIGHT)
> +		return -EINVAL;
>  
>  	switch (mask) {
>  	case IIO_CHAN_INFO_RAW:
> -		switch (chan->type) {
> -		case IIO_LIGHT:
> -			ret = noa1305_measure(priv);
> -			if (ret < 0)
> -				return ret;
> -			*val = ret;
> -			return IIO_VAL_INT;
> -		default:
> -			break;
> -		}
> -		break;
> +		ret = noa1305_measure(priv);
> +		if (ret < 0)
> +			return ret;
> +		*val = ret;
> +		return IIO_VAL_INT;
>  	case IIO_CHAN_INFO_SCALE:
> -		switch (chan->type) {
> -		case IIO_LIGHT:
> -			return noa1305_scale(priv, val, val2);
> -		default:
> -			break;
> -		}
> -		break;
> +		return noa1305_scale(priv, val, val2);
>  	default:
> -		break;
> +		return -EINVAL;
>  	}
> -
> -	return ret;
>  }
>  
>  static const struct iio_info noa1305_info = {


  parent reply	other threads:[~2024-07-20 13:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-15 18:28 [PATCH 1/5] iio: light: noa1305: Simplify noa1305_read_raw() Marek Vasut
2024-07-15 18:28 ` [PATCH 2/5] iio: light: noa1305: Assign val in noa1305_measure() Marek Vasut
2024-07-15 18:28 ` [PATCH 3/5] iio: light: noa1305: Use static table lookup of scale values Marek Vasut
2024-07-15 18:28 ` [PATCH 4/5] iio: light: noa1305: Report available " Marek Vasut
2024-07-15 18:28 ` [PATCH 5/5] iio: light: noa1305: Make integration time configurable Marek Vasut
2024-07-20 13:29 ` Jonathan Cameron [this message]
2024-07-20 16:22   ` [PATCH 1/5] iio: light: noa1305: Simplify noa1305_read_raw() Marek Vasut

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=20240720142928.7a913229@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=marex@denx.de \
    --cc=u.kleine-koenig@pengutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox