public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: "Andy Shevchenko" <andy.shevchenko@gmail.com>,
	"Nuno Sá" <noname.nuno@gmail.com>,
	"Alisa-Dariana Roman" <alisadariana@gmail.com>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Michael Hennerich" <Michael.Hennerich@analog.com>,
	"Alisa-Dariana Roman" <alisa.roman@analog.com>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>
Subject: Re: [PATCH v1 1/1] iio: adc: ad7191: Don't check for specific errors when parsing properties
Date: Sun, 12 Apr 2026 15:30:40 +0100	[thread overview]
Message-ID: <20260412153040.0e6f2d7f@jic23-huawei> (raw)
In-Reply-To: <abkv_76b1cue1bGK@ashevche-desk.local>

On Tue, 17 Mar 2026 12:42:07 +0200
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> On Fri, Feb 20, 2026 at 12:33:28PM +0200, Andy Shevchenko wrote:
> > On Fri, Feb 20, 2026 at 12:04 PM Nuno Sá <noname.nuno@gmail.com> wrote:  
> > > On Thu, 2026-02-19 at 15:39 +0100, Andy Shevchenko wrote:  
> > > > Instead of checking for the specific error codes (that can be considered
> > > > a layering violation to some extent) check for the property existence first
> > > > and then either parse it, or apply a default value.  
> > >
> > > Not really sure how I feel about this one. Checking for specific errors is a very common
> > > pattern and this change just makes it we check for the property presence twice. That said,
> > > this makes it more "future proof" (though I find it very unlikely for ret value o change).  
> > 
> > I already have an answer to this:
> > https://lore.kernel.org/r/aZcenabXYsOdBu84@smile.fi.intel.com  
> 
> Does it help?
> 
> > > Anyways, even if we choose to go down this route, I don't see much benefit in starting
> > > converting the drivers with the pattern below (which should be a considerable number).  
> > 
> > There is not a big number of them, so I prefer to have common patterns
> > without exact error code checks.  
> 


I left this one for a while to see if the discussion would continue but seems not.
I'm not sure it is always the case, but in this particular example I think the
resulting code is a little nicer to read so applied.

So for me, case by case basis for this sort of change.

Thanks,

Jonathan

  reply	other threads:[~2026-04-12 14:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-19 14:39 [PATCH v1 1/1] iio: adc: ad7191: Don't check for specific errors when parsing properties Andy Shevchenko
2026-02-20 10:04 ` Nuno Sá
2026-02-20 10:33   ` Andy Shevchenko
2026-03-17 10:42     ` Andy Shevchenko
2026-04-12 14:30       ` Jonathan Cameron [this message]
2026-04-14  9:10         ` Nuno Sá
2026-04-14  9:31           ` Andy Shevchenko
2026-04-14  9:33             ` Andy Shevchenko
2026-04-14 10:02               ` Nuno Sá

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=20260412153040.0e6f2d7f@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=Michael.Hennerich@analog.com \
    --cc=alisa.roman@analog.com \
    --cc=alisadariana@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=noname.nuno@gmail.com \
    --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