public inbox for linux-doc@vger.kernel.org
 help / color / mirror / Atom feed
From: David Lechner <dlechner@baylibre.com>
To: "Julien Stephan" <jstephan@baylibre.com>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Michael Hennerich" <Michael.Hennerich@analog.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"Jonathan Corbet" <corbet@lwn.net>
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-doc@vger.kernel.org
Subject: Re: [PATCH v4 4/5] iio: adc: ad7380: add alert support
Date: Wed, 8 Jan 2025 09:17:32 -0600	[thread overview]
Message-ID: <f53c6f9d-f17c-45fb-b8dd-b4eb8ef7a15a@baylibre.com> (raw)
In-Reply-To: <20250108-ad7380-add-alert-support-v4-4-1751802471ba@baylibre.com>

On 1/8/25 6:49 AM, Julien Stephan wrote:
> The alert functionality is an out of range indicator and can be used as
> an early indicator of an out of bounds conversion result.
> 

...

> +static int ad7380_get_alert_th(struct ad7380_state *st,
> +			       enum iio_event_direction dir,
> +			       int *val)
> +{
> +	int ret, tmp;
> +
> +	switch (dir) {
> +	case IIO_EV_DIR_RISING:
> +		ret = regmap_read(st->regmap,
> +				  AD7380_REG_ADDR_ALERT_HIGH_TH,
> +				  &tmp);
> +		if (ret)
> +			return ret;
> +
> +		*val = FIELD_GET(AD7380_ALERT_HIGH_TH, tmp);
> +		ret = IIO_VAL_INT;
> +		break;
> +	case IIO_EV_DIR_FALLING:
> +		ret = regmap_read(st->regmap,
> +				  AD7380_REG_ADDR_ALERT_LOW_TH,
> +				  &tmp);
> +		if (ret)
> +			return ret;
> +
> +		*val = FIELD_GET(AD7380_ALERT_LOW_TH, tmp);
> +		ret = IIO_VAL_INT;
> +		break;
> +	default:
> +		ret = -EINVAL;
> +		break;
> +	}
> +
> +	return ret;

We can just return directly in each case instead of using break (preferred
style in IIO).

> +}
> +

Reviewed-by: David Lechner <dlechner@baylibre.com>


  reply	other threads:[~2025-01-08 15:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-08 12:49 [PATCH v4 0/5] iio: adc: ad7380: add alert support Julien Stephan
2025-01-08 12:49 ` [PATCH v4 1/5] iio: adc: ad7380: do not use iio_device_claim_direct_scoped anymore Julien Stephan
2025-01-12 16:29   ` Andy Shevchenko
2025-01-12 16:42     ` Jonathan Cameron
2025-01-12 20:19       ` Andy Shevchenko
2025-01-08 12:49 ` [PATCH v4 2/5] iio: adc: ad7380: enable regmap cache Julien Stephan
2025-01-08 12:49 ` [PATCH v4 3/5] iio: adc: ad7380: do not store osr in private data structure Julien Stephan
2025-01-12 16:31   ` Andy Shevchenko
2025-01-08 12:49 ` [PATCH v4 4/5] iio: adc: ad7380: add alert support Julien Stephan
2025-01-08 15:17   ` David Lechner [this message]
2025-01-12 11:49     ` Jonathan Cameron
2025-01-08 12:49 ` [PATCH v4 5/5] docs: iio: " Julien Stephan
2025-01-12 11:51 ` [PATCH v4 0/5] iio: adc: " 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=f53c6f9d-f17c-45fb-b8dd-b4eb8ef7a15a@baylibre.com \
    --to=dlechner@baylibre.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=corbet@lwn.net \
    --cc=jic23@kernel.org \
    --cc=jstephan@baylibre.com \
    --cc=lars@metafoo.de \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox