[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <f53c6f9d-f17c-45fb-b8dd-b4eb8ef7a15a@baylibre.com>
Date: Wed, 8 Jan 2025 09:17:32 -0600
From: David Lechner <dlechner@...libre.com>
To: Julien Stephan <jstephan@...libre.com>,
Lars-Peter Clausen <lars@...afoo.de>,
Michael Hennerich <Michael.Hennerich@...log.com>,
Nuno Sá <nuno.sa@...log.com>,
Jonathan Cameron <jic23@...nel.org>, Jonathan Corbet <corbet@....net>
Cc: linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-doc@...r.kernel.org
Subject: Re: [PATCH v4 4/5] iio: adc: ad7380: add alert support
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@...libre.com>
Powered by blists - more mailing lists