mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Rob Herring <robh@kernel.org>
Cc: linux-pci@vger.kernel.org, "Bjorn Helgaas" <helgaas@kernel.org>,
	"Andi Shyti" <andi.shyti@kernel.org>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Toan Le" <toan@os.amperecomputing.com>,
	"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Krzysztof Wilczyński" <kw@linux.com>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	linux-arm-kernel@lists.infradead.org,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 7/8] PCI: xgene: Do PCI error check on own line
Date: Tue, 29 Aug 2023 19:23:52 +0300 (EEST)	[thread overview]
Message-ID: <31622354-2510-d942-ebf6-59bd1d44f868@linux.intel.com> (raw)
In-Reply-To: <743fadf9-34d9-ca25-bdd6-f69bd922c3ec@linux.intel.com>

[-- Attachment #1: Type: text/plain, Size: 2278 bytes --]

On Tue, 29 Aug 2023, Ilpo Järvinen wrote:

> On Tue, 29 Aug 2023, Rob Herring wrote:
> 
> > On Sun, Aug 27, 2023 at 8:37 AM Ilpo Järvinen
> > <ilpo.jarvinen@linux.intel.com> wrote:
> > >
> > > Instead of a if condition with a line split, use the usual error
> > > handling pattern with a separate variable to improve readability.
> > >
> > > No functional changes intended.
> > >
> > > Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> > > ---
> > >  drivers/pci/controller/pci-xgene.c | 5 +++--
> > >  1 file changed, 3 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/pci/controller/pci-xgene.c b/drivers/pci/controller/pci-xgene.c
> > > index 887b4941ff32..b7f338de160b 100644
> > > --- a/drivers/pci/controller/pci-xgene.c
> > > +++ b/drivers/pci/controller/pci-xgene.c
> > > @@ -163,9 +163,10 @@ static int xgene_pcie_config_read32(struct pci_bus *bus, unsigned int devfn,
> > >                                     int where, int size, u32 *val)
> > >  {
> > >         struct xgene_pcie *port = pcie_bus_to_port(bus);
> > > +       int ret;
> > >
> > > -       if (pci_generic_config_read32(bus, devfn, where & ~0x3, 4, val) !=
> > > -           PCIBIOS_SUCCESSFUL)
> > > +       ret = pci_generic_config_read32(bus, devfn, where & ~0x3, 4, val);
> > > +       if (ret != PCIBIOS_SUCCESSFUL)
> > 
> > Long term I think we want to replace these error codes with standard
> > linux ones.
> 
> This series is preparatory work for this very goal you stated!
> 
> > As PCIBIOS_SUCCESSFUL is 0, I would change this to just:
> > 
> > if (pci_generic_config_read32(bus, devfn, where & ~0x3, 4, val))
> >     return PCIBIOS_DEVICE_NOT_FOUND;
> 
> I'm not so sure about this suggestion as it will overwrite the original 
> error code (like the current approach unfortunately also does). To me it 
> would seem more appropriate is to return the original error code instead. 
> But more discussion is needed before making such changes to values these 
> functions return. (And there are plenty of similar examples besides this 
> one.)

Actually, it looks in this case I could do that transformation safely now
since pci_generic_config_read32() can only return either 
PCIBIOS_DEVICE_NOT_FOUND or PCIBIOS_SUCCESSFUL so it won't alter anything.

-- 
 i.

  reply	other threads:[~2023-08-29 16:24 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-27 13:36 [PATCH v2 0/8] PCI/treewide: Cleanup/streamline PCI error code handling Ilpo Järvinen
2023-08-27 13:36 ` [PATCH v2 1/8] alpha: Streamline convoluted PCI error handling Ilpo Järvinen
2023-08-27 13:36 ` [PATCH v2 2/8] MIPS: TXx9: Do PCI error checks on own line Ilpo Järvinen
2023-08-28  9:10   ` Thomas Bogendoerfer
2023-08-27 13:37 ` [PATCH v2 3/8] sh: pci: Do PCI error check " Ilpo Järvinen
2023-08-27 13:37 ` [PATCH v2 4/8] atm: iphase: Do PCI error checks " Ilpo Järvinen
2023-08-27 13:37 ` [PATCH v2 5/8] I2C: ali15x3: " Ilpo Järvinen
2023-08-28 22:10   ` Andi Shyti
2023-08-30 19:18   ` Wolfram Sang
2023-08-27 13:37 ` [PATCH v2 6/8] PCI: Do error check on own line to split long if conditions Ilpo Järvinen
2023-08-27 13:37 ` [PATCH v2 7/8] PCI: xgene: Do PCI error check on own line Ilpo Järvinen
2023-08-29 16:05   ` Rob Herring
2023-08-29 16:14     ` Ilpo Järvinen
2023-08-29 16:23       ` Ilpo Järvinen [this message]
2023-08-27 13:37 ` [PATCH v2 8/8] scsi: ipr: Do PCI error checks " Ilpo Järvinen

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=31622354-2510-d942-ebf6-59bd1d44f868@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=andi.shyti@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=helgaas@kernel.org \
    --cc=kw@linux.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=philmd@linaro.org \
    --cc=robh@kernel.org \
    --cc=toan@os.amperecomputing.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

all inboxes | Powered by JetHome®