From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E801EC433EF for ; Wed, 13 Oct 2021 08:53:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CD02E6044F for ; Wed, 13 Oct 2021 08:53:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238922AbhJMIz1 (ORCPT ); Wed, 13 Oct 2021 04:55:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234956AbhJMIzZ (ORCPT ); Wed, 13 Oct 2021 04:55:25 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17210C061570 for ; Wed, 13 Oct 2021 01:53:22 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1maZzE-0007An-3c; Wed, 13 Oct 2021 10:51:44 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1maZz1-0005Il-VI; Wed, 13 Oct 2021 10:51:31 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1maZz1-0006zY-R9; Wed, 13 Oct 2021 10:51:31 +0200 Date: Wed, 13 Oct 2021 10:51:31 +0200 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= To: Bjorn Helgaas Cc: Giovanni Cabiddu , Mark Rutland , Sathya Prakash , Alexander Shishkin , linux-pci@vger.kernel.org, Alexander Duyck , Russell Currey , x86@kernel.org, qat-linux@intel.com, oss-drivers@corigine.com, Oliver O'Halloran , "H. Peter Anvin" , Jiri Olsa , Thomas Gleixner , Marco Chiappero , Stefano Stabellini , Herbert Xu , linux-scsi@vger.kernel.org, Michael Ellerman , =?utf-8?B?UmFmYcWCIE1pxYJlY2tp?= , Jesse Brandeburg , Peter Zijlstra , Ingo Molnar , Benjamin Herrenschmidt , linux-wireless@vger.kernel.org, Jakub Kicinski , Yisen Zhuang , Suganath Prabu Subramani , Fiona Trahe , Andrew Donnellan , Arnd Bergmann , Konrad Rzeszutek Wilk , Ido Schimmel , Simon Horman , linuxppc-dev@lists.ozlabs.org, Arnaldo Carvalho de Melo , Jack Xu , Borislav Petkov , Michael Buesch , Jiri Pirko , Bjorn Helgaas , Namhyung Kim , Boris Ostrovsky , Andy Shevchenko , Juergen Gross , Salil Mehta , Sreekanth Reddy , xen-devel@lists.xenproject.org, Vadym Kochan , MPT-FusionLinux.pdl@broadcom.com, Greg Kroah-Hartman , linux-usb@vger.kernel.org, Wojciech Ziemba , linux-kernel@vger.kernel.org, Mathias Nyman , Zhou Wang , linux-crypto@vger.kernel.org, kernel@pengutronix.de, netdev@vger.kernel.org, Frederic Barrat , Paul Mackerras , Tomaszx Kowalik , Taras Chornyi , "David S. Miller" , linux-perf-users@vger.kernel.org Subject: Re: [PATCH v6 00/11] PCI: Drop duplicated tracking of a pci_dev's bound driver Message-ID: <20211013085131.5htnch5p6zv46mzn@pengutronix.de> References: <20211004125935.2300113-1-u.kleine-koenig@pengutronix.de> <20211012233212.GA1806189@bhelgaas> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="jgo3ssjhgqy54b4n" Content-Disposition: inline In-Reply-To: <20211012233212.GA1806189@bhelgaas> X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-usb@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org --jgo3ssjhgqy54b4n Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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=F6nig wrote: > > Hello, > >=20 > > 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. >=20 > I like this a lot and applied it to pci/driver for v5.16, thanks! >=20 > 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: >=20 > 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 =3D { > */ > static bool match_id(struct pci_dev *pdev, unsigned short vendor, unsign= ed short device) > { > + struct pci_driver *drv =3D to_pci_driver(pdev->dev.driver); > const struct pci_device_id *id; > =20 > if (pdev->vendor =3D=3D vendor && pdev->device =3D=3D device) > return true; > =20 > - if (pdev->dev.driver) { > - struct pci_driver *drv =3D to_pci_driver(pdev->dev.driver); > - for (id =3D drv->id_table; id && id->vendor; id++) > - if (id->vendor =3D=3D vendor && id->device =3D=3D device) > - break; > - } > + for (id =3D drv ? drv->id_table : NULL; id && id->vendor; id++) > + if (id->vendor =3D=3D vendor && id->device =3D=3D device) > + break; > =20 > 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. Best regards Uwe --=20 Pengutronix e.K. | Uwe Kleine-K=F6nig | Industrial Linux Solutions | https://www.pengutronix.de/ | --jgo3ssjhgqy54b4n Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEfnIqFpAYrP8+dKQLwfwUeK3K7AkFAmFmng8ACgkQwfwUeK3K 7AmPuQgAk6Dld3vvwdriW0ibspNDJTGfUcre3doNKax+JiXCiHbUthkO3jZ7kx1f rTKn9F/GlIOEH1uZZZPonJEaOLwVQmJz3OF8+BKCx7g1+0AqtNe2WefCf4Jl6ajR fuBtbNjjaCmBXFqToERlpAsB8kRfNy8Y5V7a/XqiX7ZDLiXle3V2AbuQVi5Ikmhp S72E0TV74YTVv77LeVSAA8275wN0GVI3gVT9F7w9ja0BjrapAALEVsk/s9pAl3Zq j9D63evuObSQ8ILnNmMOldPueBNZBIGCrXPD/EWKYWXjfstcmZUQtQqvyF6lK9ww AubKoQZ72JnZiuJZzVyJCsmBBRo2Vw== =Gp6y -----END PGP SIGNATURE----- --jgo3ssjhgqy54b4n--