[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211013105428.GA1890798@bhelgaas>
Date: Wed, 13 Oct 2021 05:54:28 -0500
From: Bjorn Helgaas <helgaas@...nel.org>
To: Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>
Cc: Giovanni Cabiddu <giovanni.cabiddu@...el.com>,
Mark Rutland <mark.rutland@....com>,
Sathya Prakash <sathya.prakash@...adcom.com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
linux-pci@...r.kernel.org, Alexander Duyck <alexanderduyck@...com>,
Russell Currey <ruscur@...sell.cc>, x86@...nel.org,
qat-linux@...el.com, oss-drivers@...igine.com,
Oliver O'Halloran <oohall@...il.com>,
"H. Peter Anvin" <hpa@...or.com>, Jiri Olsa <jolsa@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
Marco Chiappero <marco.chiappero@...el.com>,
Stefano Stabellini <sstabellini@...nel.org>,
Herbert Xu <herbert@...dor.apana.org.au>,
linux-scsi@...r.kernel.org, Michael Ellerman <mpe@...erman.id.au>,
Rafał Miłecki <zajec5@...il.com>,
Jesse Brandeburg <jesse.brandeburg@...el.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
linux-wireless@...r.kernel.org, Jakub Kicinski <kuba@...nel.org>,
Yisen Zhuang <yisen.zhuang@...wei.com>,
Suganath Prabu Subramani
<suganath-prabu.subramani@...adcom.com>,
Fiona Trahe <fiona.trahe@...el.com>,
Andrew Donnellan <ajd@...ux.ibm.com>,
Arnd Bergmann <arnd@...db.de>,
Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
Ido Schimmel <idosch@...dia.com>,
Simon Horman <simon.horman@...igine.com>,
linuxppc-dev@...ts.ozlabs.org,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Jack Xu <jack.xu@...el.com>, Borislav Petkov <bp@...en8.de>,
Michael Buesch <m@...s.ch>, Jiri Pirko <jiri@...dia.com>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Namhyung Kim <namhyung@...nel.org>,
Boris Ostrovsky <boris.ostrovsky@...cle.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Juergen Gross <jgross@...e.com>,
Salil Mehta <salil.mehta@...wei.com>,
Sreekanth Reddy <sreekanth.reddy@...adcom.com>,
xen-devel@...ts.xenproject.org, Vadym Kochan <vkochan@...vell.com>,
MPT-FusionLinux.pdl@...adcom.com,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-usb@...r.kernel.org,
Wojciech Ziemba <wojciech.ziemba@...el.com>,
linux-kernel@...r.kernel.org,
Mathias Nyman <mathias.nyman@...el.com>,
Zhou Wang <wangzhou1@...ilicon.com>,
linux-crypto@...r.kernel.org, kernel@...gutronix.de,
netdev@...r.kernel.org, Frederic Barrat <fbarrat@...ux.ibm.com>,
Paul Mackerras <paulus@...ba.org>,
Tomaszx Kowalik <tomaszx.kowalik@...el.com>,
Taras Chornyi <tchornyi@...vell.com>,
"David S. Miller" <davem@...emloft.net>,
linux-perf-users@...r.kernel.org
Subject: Re: [PATCH v6 00/11] PCI: Drop duplicated tracking of a pci_dev's
bound driver
On Wed, Oct 13, 2021 at 10:51:31AM +0200, Uwe Kleine-König wrote:
> On Tue, Oct 12, 2021 at 06:32:12PM -0500, Bjorn Helgaas wrote:
> > On Mon, Oct 04, 2021 at 02:59:24PM +0200, Uwe Kleine-König wrote:
> > > Hello,
> > >
> > > this is v6 of the quest to drop the "driver" member from struct pci_dev
> > > which tracks the same data (apart from a constant offset) as dev.driver.
> >
> > I like this a lot and applied it to pci/driver for v5.16, thanks!
> >
> > I split some of the bigger patches apart so they only touched one
> > driver or subsystem at a time. I also updated to_pci_driver() so it
> > returns NULL when given NULL, which makes some of the validations
> > quite a bit simpler, especially in the PM code in pci-driver.c.
>
> OK.
>
> > Full interdiff from this v6 series:
> >
> > diff --git a/arch/x86/kernel/probe_roms.c b/arch/x86/kernel/probe_roms.c
> > index deaaef6efe34..36e84d904260 100644
> > --- a/arch/x86/kernel/probe_roms.c
> > +++ b/arch/x86/kernel/probe_roms.c
> > @@ -80,17 +80,15 @@ static struct resource video_rom_resource = {
> > */
> > static bool match_id(struct pci_dev *pdev, unsigned short vendor, unsigned short device)
> > {
> > + struct pci_driver *drv = to_pci_driver(pdev->dev.driver);
> > const struct pci_device_id *id;
> >
> > if (pdev->vendor == vendor && pdev->device == device)
> > return true;
> >
> > - if (pdev->dev.driver) {
> > - struct pci_driver *drv = to_pci_driver(pdev->dev.driver);
> > - for (id = drv->id_table; id && id->vendor; id++)
> > - if (id->vendor == vendor && id->device == device)
> > - break;
> > - }
> > + for (id = drv ? drv->id_table : NULL; id && id->vendor; id++)
> > + if (id->vendor == vendor && id->device == device)
> > + break;
> >
> > return id && id->vendor;
> > }
> > diff --git a/drivers/misc/cxl/guest.c b/drivers/misc/cxl/guest.c
> > index d997c9c3ebb5..7eb3706cf42d 100644
> > --- a/drivers/misc/cxl/guest.c
> > +++ b/drivers/misc/cxl/guest.c
> > @@ -20,38 +20,38 @@ static void pci_error_handlers(struct cxl_afu *afu,
> > pci_channel_state_t state)
> > {
> > struct pci_dev *afu_dev;
> > + struct pci_driver *afu_drv;
> > + struct pci_error_handlers *err_handler;
>
> These two could be moved into the for loop (where afu_drv was with my
> patch already). This is also possible in a few other drivers.
That's true, they could. I tried to follow the prevailing style in
the file. At least in cxl, I didn't see any other cases of
declarations being in the minimal scope like that.
Bjorn
Powered by blists - more mailing lists