[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250112114953.60e9991f@jic23-huawei>
Date: Sun, 12 Jan 2025 11:49:53 +0000
From: Jonathan Cameron <jic23@...nel.org>
To: David Lechner <dlechner@...libre.com>
Cc: Julien Stephan <jstephan@...libre.com>, Lars-Peter Clausen
<lars@...afoo.de>, Michael Hennerich <Michael.Hennerich@...log.com>, Nuno
Sá <nuno.sa@...log.com>, Jonathan Corbet <corbet@....net>,
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 Wed, 8 Jan 2025 09:17:32 -0600
David Lechner <dlechner@...libre.com> wrote:
> 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>
>
I tweaked it whilst applying.
Powered by blists - more mailing lists