public inbox for linux-doc@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: David Lechner <dlechner@baylibre.com>
Cc: "Julien Stephan" <jstephan@baylibre.com>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Michael Hennerich" <Michael.Hennerich@analog.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Jonathan Corbet" <corbet@lwn.net>,
	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: Sun, 12 Jan 2025 11:49:53 +0000	[thread overview]
Message-ID: <20250112114953.60e9991f@jic23-huawei> (raw)
In-Reply-To: <f53c6f9d-f17c-45fb-b8dd-b4eb8ef7a15a@baylibre.com>

On Wed, 8 Jan 2025 09:17:32 -0600
David Lechner <dlechner@baylibre.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@baylibre.com>
> 

I tweaked it whilst applying.

  reply	other threads:[~2025-01-12 11:50 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
2025-01-12 11:49     ` Jonathan Cameron [this message]
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=20250112114953.60e9991f@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=Michael.Hennerich@analog.com \
    --cc=corbet@lwn.net \
    --cc=dlechner@baylibre.com \
    --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