public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Herve Codina <herve.codina@bootlin.com>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: "Wolfram Sang" <wsa+renesas@sang-engineering.com>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Geert Uytterhoeven" <geert+renesas@glider.be>,
	"Magnus Damm" <magnus.damm@gmail.com>,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	"Mark Brown" <broonie@kernel.org>,
	linux-iio@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Pascal Eberhard" <pascal.eberhard@se.com>,
	"Miquel Raynal" <miquel.raynal@bootlin.com>,
	"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH v2 2/4] iio: adc: Add support for the Renesas RZ/N1 ADC
Date: Mon, 3 Nov 2025 09:40:45 +0100	[thread overview]
Message-ID: <20251103094045.73a061ea@bootlin.com> (raw)
In-Reply-To: <aQMpHDwCqcrNrnT9@smile.fi.intel.com>

Hi Andy,

On Thu, 30 Oct 2025 11:00:12 +0200
Andy Shevchenko <andriy.shevchenko@intel.com> wrote:

...
> 
> > +	ret = devm_regulator_get_enable_optional(dev, avdd_name);
> > +	if (ret < 0) {
> > +		if (ret != -ENODEV)
> > +			return dev_err_probe(dev, ret,
> > +					     "Failed to get '%s' regulator\n",
> > +					     avdd_name);
> > +		return 0;
> > +	}  
> 
> 	if (ret == -ENODEV)
> 		return dev_err_probe(); // takes less LoCs
> 	if (ret < 0) // do we need ' < 0' part?
> 		return 0;
> 

Well, I need to abort on error returned by devm_regulator_get_enable_optional()
but I need also to filter out the ENODEV error.

ENODEV, returned by devm_regulator_get_enable_optional(), means that the
regulator is not present. This should not be seen as an error by the caller.
Indeed, the regulator is not present and so, the related ADC core will not
be used. This is not an error from the caller perspective.

The code you proposed is not correct regarding this point.

Instead of my original code, I can propose the following:
	if (ret < 0) {
		if (ret == -ENODEV)
			return 0;

		return dev_err_probe(dev, ret,
				     "Failed to get '%s' regulator\n",
				     avdd_name);
	}

What do you think about it?

For other comments you have sent, I agree with them and I will take them into
account in the next iteration.

Best regards,
Hervé


  parent reply	other threads:[~2025-11-03  8:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-29 14:46 [PATCH v2 0/4] Add support for the Renesas RZ/N1 ADC Herve Codina (Schneider Electric)
2025-10-29 14:46 ` [PATCH v2 1/4] dt-bindings: iio: adc: Add " Herve Codina (Schneider Electric)
2025-10-30 18:02   ` Rob Herring (Arm)
2025-10-29 14:46 ` [PATCH v2 2/4] iio: adc: Add support for " Herve Codina (Schneider Electric)
2025-10-30  9:00   ` Andy Shevchenko
2025-11-02 11:42     ` Jonathan Cameron
2025-11-03  8:40     ` Herve Codina [this message]
2025-11-03  9:39       ` Andy Shevchenko
2025-11-03 11:34   ` Nuno Sá
2025-10-29 14:46 ` [PATCH v2 3/4] ARM: dts: renesas: r9a06g032: Add the ADC device Herve Codina (Schneider Electric)
2025-10-29 14:46 ` [PATCH v2 4/4] MAINTAINERS: Add the Renesas RZ/N1 ADC driver entry Herve Codina (Schneider Electric)

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=20251103094045.73a061ea@bootlin.com \
    --to=herve.codina@bootlin.com \
    --cc=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=geert+renesas@glider.be \
    --cc=jic23@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=nuno.sa@analog.com \
    --cc=pascal.eberhard@se.com \
    --cc=robh@kernel.org \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=wsa+renesas@sang-engineering.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