From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Andrew Donnellan <ajd@linux.ibm.com>
Cc: Bjorn Helgaas <helgaas@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Peter Zijlstra <peterz@infradead.org>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
"H. Peter Anvin" <hpa@zytor.com>,
Oliver O'Halloran <oohall@gmail.com>,
Russell Currey <ruscur@russell.cc>, Jiri Olsa <jolsa@redhat.com>,
Christoph Hellwig <hch@lst.de>,
Stefano Stabellini <sstabellini@kernel.org>,
Mathias Nyman <mathias.nyman@intel.com>,
Michael Ellerman <mpe@ellerman.id.au>,
x86@kernel.org,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Ingo Molnar <mingo@redhat.com>,
linux-pci@vger.kernel.org, xen-devel@lists.xenproject.org,
Juergen Gross <jgross@suse.com>, Arnd Bergmann <arnd@arndb.de>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Borislav Petkov <bp@alien8.de>,
Bjorn Helgaas <bhelgaas@google.com>,
Namhyung Kim <namhyung@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Boris Ostrovsky <boris.ostrovsky@oracle.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-usb@vger.kernel.org, linux-perf-users@vger.kernel.org,
kernel@pengutronix.de, Frederic Barrat <fbarrat@linux.ibm.com>,
Paul Mackerras <paulus@samba.org>,
linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v5 10/11] PCI: Replace pci_dev::driver usage by pci_dev::dev.driver
Date: Wed, 29 Sep 2021 15:43:30 +0200 [thread overview]
Message-ID: <20210929134330.e5c57t7mtwu5iner@pengutronix.de> (raw)
In-Reply-To: <75dd6d60-08b9-fa68-352c-3a0c5a04c0ab@linux.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 1935 bytes --]
On Wed, Sep 29, 2021 at 11:15:37PM +1000, Andrew Donnellan wrote:
> On 29/9/21 6:53 pm, Uwe Kleine-König wrote:>
> 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 = to_pci_driver(afu_dev->dev.driver))->err_handler &&
>
> 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 = 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 = 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
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 484 bytes --]
next prev parent reply other threads:[~2021-09-29 13:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-29 8:52 [PATCH v5 00/11] PCI: Drop duplicated tracking of a pci_dev's bound driver Uwe Kleine-König
2021-09-29 8:53 ` [PATCH v5 10/11] PCI: Replace pci_dev::driver usage by pci_dev::dev.driver Uwe Kleine-König
2021-09-29 13:15 ` Andrew Donnellan
2021-09-29 13:43 ` Uwe Kleine-König [this message]
2021-09-29 15:44 ` Andrew Donnellan
2021-09-30 13:48 ` Frederic Barrat
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=20210929134330.e5c57t7mtwu5iner@pengutronix.de \
--to=u.kleine-koenig@pengutronix.de \
--cc=acme@kernel.org \
--cc=ajd@linux.ibm.com \
--cc=alexander.shishkin@linux.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=fbarrat@linux.ibm.com \
--cc=gregkh@linuxfoundation.org \
--cc=hch@lst.de \
--cc=helgaas@kernel.org \
--cc=hpa@zytor.com \
--cc=jgross@suse.com \
--cc=jolsa@redhat.com \
--cc=kernel@pengutronix.de \
--cc=konrad.wilk@oracle.com \
--cc=linux-pci@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mark.rutland@arm.com \
--cc=mathias.nyman@intel.com \
--cc=mingo@redhat.com \
--cc=mpe@ellerman.id.au \
--cc=namhyung@kernel.org \
--cc=oohall@gmail.com \
--cc=paulus@samba.org \
--cc=peterz@infradead.org \
--cc=ruscur@russell.cc \
--cc=sstabellini@kernel.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/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).