public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Cc: "platform-driver-x86@vger.kernel.org"
	<platform-driver-x86@vger.kernel.org>,
	"Hans de Goede" <hdegoede@redhat.com>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	"Lukas Wunner" <lukas@wunner.de>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	"linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>
Subject: Re: [PATCH v3] platform/x86: p2sb: Allow p2sb_bar() calls during PCI device probe
Date: Wed, 27 Dec 2023 07:14:50 -0600	[thread overview]
Message-ID: <20231227131450.GA1499391@bhelgaas> (raw)
In-Reply-To: <u6v2mm6ncifgretsozi4kad2rlbz5zo3bdz4uexwkuvjyigbaf@betyniztbojq>

On Wed, Dec 27, 2023 at 01:09:03AM +0000, Shinichiro Kawasaki wrote:
> On Dec 26, 2023 / 18:34, Bjorn Helgaas wrote:
> > On Mon, Dec 25, 2023 at 06:26:56PM +0900, Shin'ichiro Kawasaki wrote:
> > > ...
> > 
> > > +static int p2sb_valid_resource(struct resource *res)
> > > +{
> > > +	return res->flags ? 0 : -ENOENT;
> > > +}
> > 
> > This got worse because it's *named* like a boolean, but the return
> > value can't be used like a boolean, which makes callers really hard to
> > read, e.g., this:
> > 
> >   if (p2sb_valid_resource(res))
> >     /* do something */
> > 
> > does exactly the opposite of what the reader expects.
> > 
> > I see that you want to use this -ENOENT return value in the callers:
> ... 

> I have to admit that the function name meaning is opposite... When I
> followed Andy's idea to make the function to return -ENOENT, I
> should have renamed the function to not cause the confusion.

Oh, sorry, I hadn't seen that idea.  But your v4 looks good to me (at
least this part; I didn't look carefully at the whole patch :) ).

Bjorn

  reply	other threads:[~2023-12-27 13:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-25  9:26 [PATCH v3] platform/x86: p2sb: Allow p2sb_bar() calls during PCI device probe Shin'ichiro Kawasaki
2023-12-27  0:34 ` Bjorn Helgaas
2023-12-27  1:09   ` Shinichiro Kawasaki
2023-12-27 13:14     ` Bjorn Helgaas [this message]
2023-12-27 16:45       ` Andy Shevchenko

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=20231227131450.GA1499391@bhelgaas \
    --to=helgaas@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=hdegoede@redhat.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=shinichiro.kawasaki@wdc.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