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 A206EC433EF for ; Wed, 29 Sep 2021 13:44:57 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 18BE26147F for ; Wed, 29 Sep 2021 13:44:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 18BE26147F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4HKHgC3bDcz3bnj for ; Wed, 29 Sep 2021 23:44:55 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=pengutronix.de (client-ip=2001:67c:670:201:290:27ff:fe1d:cc33; helo=metis.ext.pengutronix.de; envelope-from=ukl@pengutronix.de; receiver=) Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4HKHfh5y3qz2yMH for ; Wed, 29 Sep 2021 23:44:27 +1000 (AEST) 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 1mVZs4-0002ro-Tl; Wed, 29 Sep 2021 15:43:40 +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 1mVZru-0005It-Cu; Wed, 29 Sep 2021 15:43:30 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1mVZru-0001Wi-AO; Wed, 29 Sep 2021 15:43:30 +0200 Date: Wed, 29 Sep 2021 15:43:30 +0200 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= To: Andrew Donnellan Subject: Re: [PATCH v5 10/11] PCI: Replace pci_dev::driver usage by pci_dev::dev.driver Message-ID: <20210929134330.e5c57t7mtwu5iner@pengutronix.de> References: <20210929085306.2203850-1-u.kleine-koenig@pengutronix.de> <20210929085306.2203850-11-u.kleine-koenig@pengutronix.de> <75dd6d60-08b9-fa68-352c-3a0c5a04c0ab@linux.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ycp367bsarc33tfb" Content-Disposition: inline In-Reply-To: <75dd6d60-08b9-fa68-352c-3a0c5a04c0ab@linux.ibm.com> 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: linuxppc-dev@lists.ozlabs.org X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Peter Zijlstra , "H. Peter Anvin" , Oliver O'Halloran , Jiri Olsa , Christoph Hellwig , Stefano Stabellini , Arnd Bergmann , Boris Ostrovsky , x86@kernel.org, Alexander Shishkin , Ingo Molnar , Bjorn Helgaas , linux-pci@vger.kernel.org, xen-devel@lists.xenproject.org, Mathias Nyman , Konrad Rzeszutek Wilk , Arnaldo Carvalho de Melo , Borislav Petkov , Bjorn Helgaas , Namhyung Kim , Thomas Gleixner , Juergen Gross , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-perf-users@vger.kernel.org, kernel@pengutronix.de, Frederic Barrat , Paul Mackerras , linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" --ycp367bsarc33tfb Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Sep 29, 2021 at 11:15:37PM +1000, Andrew Donnellan wrote: > On 29/9/21 6:53 pm, Uwe Kleine-K=F6nig wrote:> =09 > list_for_each_entry(afu_dev, &afu->phb->bus->devices, bus_list) { > > - if (afu_dev->driver && afu_dev->driver->err_handler && > > - afu_dev->driver->err_handler->resume) > > - afu_dev->driver->err_handler->resume(afu_dev); > > + struct pci_driver *afu_drv; > > + if (afu_dev->dev.driver && > > + (afu_drv =3D to_pci_driver(afu_dev->dev.driver))->err_handler && >=20 > I'm not a huge fan of assignments in if statements and if you send a v6 I= 'd > prefer you break it up. I'm not a huge fan either, I used it to keep the control flow as is and without introducing several calls to to_pci_driver. The whole code looks as follows: list_for_each_entry(afu_dev, &afu->phb->bus->devices, bus_list) { struct pci_driver *afu_drv; if (afu_dev->dev.driver && (afu_drv =3D to_pci_driver(afu_dev->dev.driver))->err_handler && afu_drv->err_handler->resume) afu_drv->err_handler->resume(afu_dev); } Without assignment in the if it could look as follows: list_for_each_entry(afu_dev, &afu->phb->bus->devices, bus_list) { struct pci_driver *afu_drv; if (!afu_dev->dev.driver) continue; afu_drv =3D to_pci_driver(afu_dev->dev.driver)); if (afu_drv->err_handler && afu_drv->err_handler->resume) afu_drv->err_handler->resume(afu_dev); } Fine for me. (Sidenote: What happens if the device is unbound directly after the check for afu_dev->dev.driver? This is a problem the old code had, too (assuming it is a real problem, didn't check deeply).) > Apart from that everything in the powerpc and cxl sections looks good to = me. Thanks for checking. Best regards Uwe --=20 Pengutronix e.K. | Uwe Kleine-K=F6nig | Industrial Linux Solutions | https://www.pengutronix.de/ | --ycp367bsarc33tfb Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEyBAABCgAdFiEEfnIqFpAYrP8+dKQLwfwUeK3K7AkFAmFUbX8ACgkQwfwUeK3K 7Am1vgf4oAZW8TWGX7Ao47AspECT0eq6axIwcj5PXeVpv5NC7BZPYClTPkycpcUZ q8GsCEDyP5ratJ0gW3XFPyCkvgml0ndAP8y5Cs1ZeE1rU6xCJivD/HWMBoTJvaIH uWxKIKzt/IiZWdt4Wo+fYplgR1/fak8IgUcV7jWOXA7pVVcZB3enVL/cB6xinq/H +T9nGsYMVfSfdJdcD/EHVePI34oVlE9Eor3g1MFzRHk21B+r9J/TxUCsj84/JW60 P//CUO5CrpsjnqvhmShEm8POvpOjaTXLPxxTh3Oan2WFcgc/8mNx5zaKFdM1Rjmg YeZXa3sMNdP7hIFZvqylIJDO3SbK =MbZA -----END PGP SIGNATURE----- --ycp367bsarc33tfb--