From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: "Mark Rutland" <mark.rutland@arm.com>,
"Giovanni Cabiddu" <giovanni.cabiddu@intel.com>,
"Rafał Miłecki" <zajec5@gmail.com>,
"Peter Zijlstra" <peterz@infradead.org>,
linux-pci@vger.kernel.org,
"Alexander Duyck" <alexanderduyck@fb.com>,
"Russell Currey" <ruscur@russell.cc>,
"Sathya Prakash" <sathya.prakash@broadcom.com>,
oss-drivers@corigine.com, "Paul Mackerras" <paulus@samba.org>,
"H. Peter Anvin" <hpa@zytor.com>, "Jiri Olsa" <jolsa@redhat.com>,
"Boris Ostrovsky" <boris.ostrovsky@oracle.com>,
linux-perf-users@vger.kernel.org,
"Stefano Stabellini" <sstabellini@kernel.org>,
"Herbert Xu" <herbert@gondor.apana.org.au>,
linux-scsi@vger.kernel.org,
"Michael Ellerman" <mpe@ellerman.id.au>,
"Ido Schimmel" <idosch@nvidia.com>,
x86@kernel.org, qat-linux@intel.com,
"Alexander Shishkin" <alexander.shishkin@linux.intel.com>,
"Ingo Molnar" <mingo@redhat.com>,
"Benjamin Herrenschmidt" <benh@kernel.crashing.org>,
linux-wireless@vger.kernel.org,
"Jakub Kicinski" <kuba@kernel.org>,
"Mathias Nyman" <mathias.nyman@intel.com>,
"Yisen Zhuang" <yisen.zhuang@huawei.com>,
"Fiona Trahe" <fiona.trahe@intel.com>,
"Andrew Donnellan" <ajd@linux.ibm.com>,
"Arnd Bergmann" <arnd@arndb.de>,
"Konrad Rzeszutek Wilk" <konrad.wilk@oracle.com>,
"Suganath Prabu Subramani"
<suganath-prabu.subramani@broadcom.com>,
"Simon Horman" <simon.horman@corigine.com>,
"Arnaldo Carvalho de Melo" <acme@kernel.org>,
"Borislav Petkov" <bp@alien8.de>, "Michael Buesch" <m@bues.ch>,
"Jiri Pirko" <jiri@nvidia.com>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Namhyung Kim" <namhyung@kernel.org>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Andy Shevchenko" <andriy.shevchenko@intel.com>,
"Juergen Gross" <jgross@suse.com>,
"Salil Mehta" <salil.mehta@huawei.com>,
"Sreekanth Reddy" <sreekanth.reddy@broadcom.com>,
xen-devel@lists.xenproject.org,
"Vadym Kochan" <vkochan@marvell.com>,
MPT-FusionLinux.pdl@broadcom.com,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
linux-usb@vger.kernel.org,
"Wojciech Ziemba" <wojciech.ziemba@intel.com>,
linux-kernel@vger.kernel.org,
"Taras Chornyi" <tchornyi@marvell.com>,
"Zhou Wang" <wangzhou1@hisilicon.com>,
linux-crypto@vger.kernel.org, kernel@pengutronix.de,
netdev@vger.kernel.org, "Frederic Barrat" <fbarrat@linux.ibm.com>,
"Oliver O'Halloran" <oohall@gmail.com>,
linuxppc-dev@lists.ozlabs.org,
"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH v2 0/6] PCI: Drop duplicated tracking of a pci_dev's bound driver
Date: Fri, 6 Aug 2021 08:46:23 +0200 [thread overview]
Message-ID: <20210806064623.3lxl4clzbjpmchef@pengutronix.de> (raw)
In-Reply-To: <20210805234234.GA1797883@bjorn-Precision-5520>
[-- Attachment #1: Type: text/plain, Size: 3697 bytes --]
Hello Bjorn,
On Thu, Aug 05, 2021 at 06:42:34PM -0500, Bjorn Helgaas wrote:
> On Tue, Aug 03, 2021 at 12:01:44PM +0200, Uwe Kleine-König wrote:
> > Hello,
> >
> > changes since v1 (https://lore.kernel.org/linux-pci/20210729203740.1377045-1-u.kleine-koenig@pengutronix.de):
> >
> > - New patch to simplify drivers/pci/xen-pcifront.c, spotted and
> > suggested by Boris Ostrovsky
> > - Fix a possible NULL pointer dereference I introduced in xen-pcifront.c
> > - A few whitespace improvements
> > - Add a commit log to patch #6 (formerly #5)
> >
> > I also expanded the audience for patches #4 and #6 to allow affected
> > people to actually see the changes to their drivers.
> >
> > Interdiff can be found below.
> >
> > The idea is still the same: After a few cleanups (#1 - #3) a new macro
> > is introduced abstracting access to struct pci_dev->driver. All users
> > are then converted to use this and in the last patch the macro is
> > changed to make use of struct pci_dev::dev->driver to get rid of the
> > duplicated tracking.
>
> I love the idea of this series!
\o/
> I looked at all the bus_type.probe() methods, it looks like pci_dev is
> not the only offender here. At least the following also have a driver
> pointer in the device struct:
>
> parisc_device.driver
> acpi_device.driver
> dio_dev.driver
> hid_device.driver
> pci_dev.driver
> pnp_dev.driver
> rio_dev.driver
> zorro_dev.driver
Right, when I converted zorro_dev it was pointed out that the code was
copied from pci and the latter has the same construct. :-)
See
https://lore.kernel.org/r/20210730191035.1455248-5-u.kleine-koenig@pengutronix.de
for the patch, I don't find where pci was pointed out, maybe it was on
irc only.
> Do you plan to do the same for all of them, or is there some reason
> why they need the pointer and PCI doesn't?
There is a list of cleanup stuff I intend to work on. Considering how
working on that list only made it longer in the recent past, maybe it
makes more sense to not work on it :-)
> In almost all cases, other buses define a "to_<bus>_driver()"
> interface. In fact, PCI already has a to_pci_driver().
>
> This series adds pci_driver_of_dev(), which basically just means we
> can do this:
>
> pdrv = pci_driver_of_dev(pdev);
>
> instead of this:
>
> pdrv = to_pci_driver(pdev->dev.driver);
>
> I don't see any other "<bus>_driver_of_dev()" interfaces, so I assume
> other buses just live with the latter style? I'd rather not be
> different and have two ways to get the "struct pci_driver *" unless
> there's a good reason.
Among few the busses I already fixed in this regard pci was the first
that has a considerable amount of usage. So I considered it worth giving
it a name.
> Looking through the places that care about pci_dev.driver (the ones
> updated by patch 5/6), many of them are ... a little dubious to begin
> with. A few need the "struct pci_error_handlers *err_handler"
> pointer, so that's probably legitimate. But many just need a name,
> and should probably be using dev_driver_string() instead.
Yeah, I considered adding a function to get the driver name from a
pci_dev and a function to get the error handlers. Maybe it's an idea to
introduce these two and then use to_pci_driver(pdev->dev.driver) for the
few remaining users? Maybe doing that on top of my current series makes
sense to have a clean switch from pdev->driver to pdev->dev.driver?!
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2021-08-06 6:49 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-03 10:01 [PATCH v2 0/6] PCI: Drop duplicated tracking of a pci_dev's bound driver Uwe Kleine-König
2021-08-03 10:01 ` [PATCH v2 4/6] PCI: Provide wrapper to access " Uwe Kleine-König
2021-08-03 14:37 ` Andy Shevchenko
2021-08-03 10:01 ` [PATCH v2 5/6] PCI: Adapt all code locations to not use struct pci_dev::driver directly Uwe Kleine-König
2021-08-03 13:53 ` Boris Ostrovsky
2021-08-03 14:38 ` Andy Shevchenko
2021-08-03 14:46 ` Ido Schimmel
2021-08-05 15:09 ` Andrew Donnellan
2021-08-03 10:01 ` [PATCH v2 6/6] PCI: Drop duplicated tracking of a pci_dev's bound driver Uwe Kleine-König
2021-08-05 23:42 ` [PATCH v2 0/6] " Bjorn Helgaas
2021-08-06 6:46 ` Uwe Kleine-König [this message]
2021-08-06 21:24 ` Bjorn Helgaas
2021-08-07 9:26 ` Uwe Kleine-König
2021-08-09 18:14 ` Bjorn Helgaas
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=20210806064623.3lxl4clzbjpmchef@pengutronix.de \
--to=u.kleine-koenig@pengutronix.de \
--cc=MPT-FusionLinux.pdl@broadcom.com \
--cc=acme@kernel.org \
--cc=ajd@linux.ibm.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=alexanderduyck@fb.com \
--cc=andriy.shevchenko@intel.com \
--cc=arnd@arndb.de \
--cc=benh@kernel.crashing.org \
--cc=bhelgaas@google.com \
--cc=boris.ostrovsky@oracle.com \
--cc=bp@alien8.de \
--cc=davem@davemloft.net \
--cc=fbarrat@linux.ibm.com \
--cc=fiona.trahe@intel.com \
--cc=giovanni.cabiddu@intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=helgaas@kernel.org \
--cc=herbert@gondor.apana.org.au \
--cc=hpa@zytor.com \
--cc=idosch@nvidia.com \
--cc=jgross@suse.com \
--cc=jiri@nvidia.com \
--cc=jolsa@redhat.com \
--cc=kernel@pengutronix.de \
--cc=konrad.wilk@oracle.com \
--cc=kuba@kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=m@bues.ch \
--cc=mark.rutland@arm.com \
--cc=mathias.nyman@intel.com \
--cc=mingo@redhat.com \
--cc=mpe@ellerman.id.au \
--cc=namhyung@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=oohall@gmail.com \
--cc=oss-drivers@corigine.com \
--cc=paulus@samba.org \
--cc=peterz@infradead.org \
--cc=qat-linux@intel.com \
--cc=ruscur@russell.cc \
--cc=salil.mehta@huawei.com \
--cc=sathya.prakash@broadcom.com \
--cc=simon.horman@corigine.com \
--cc=sreekanth.reddy@broadcom.com \
--cc=sstabellini@kernel.org \
--cc=suganath-prabu.subramani@broadcom.com \
--cc=tchornyi@marvell.com \
--cc=tglx@linutronix.de \
--cc=vkochan@marvell.com \
--cc=wangzhou1@hisilicon.com \
--cc=wojciech.ziemba@intel.com \
--cc=x86@kernel.org \
--cc=xen-devel@lists.xenproject.org \
--cc=yisen.zhuang@huawei.com \
--cc=zajec5@gmail.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;
as well as URLs for NNTP newsgroup(s).