From: Lucas Stach <l.stach@pengutronix.de>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: Thierry Reding <thierry.reding@gmail.com>,
linux-tegra@vger.kernel.org, linux-pci@vger.kernel.org
Subject: Re: [PATCH v3 1/2] PCI: add helper function to find root port for device
Date: Mon, 30 Mar 2015 12:36:26 +0200 [thread overview]
Message-ID: <1427711786.3370.3.camel@pengutronix.de> (raw)
In-Reply-To: <20150123223424.GN29776@google.com>
Am Freitag, den 23.01.2015, 16:34 -0600 schrieb Bjorn Helgaas:
> On Tue, Jan 13, 2015 at 08:57:27PM +0100, Lucas Stach wrote:
> > This adds a simple way to get the root port a given device
> > is connected to.
> >
> > Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> > ---
> > v2: new patch in v2
> > v3: rename to pci_find_rootport to fit better with other API
> > ---
> > drivers/pci/search.c | 20 ++++++++++++++++++++
> > include/linux/pci.h | 1 +
> > 2 files changed, 21 insertions(+)
> >
> > diff --git a/drivers/pci/search.c b/drivers/pci/search.c
> > index a20ce7d5e2a7..7254f126096d 100644
> > --- a/drivers/pci/search.c
> > +++ b/drivers/pci/search.c
> > @@ -384,3 +384,23 @@ int pci_dev_present(const struct pci_device_id *ids)
> > return 0;
> > }
> > EXPORT_SYMBOL(pci_dev_present);
> > +
> > +/**
> > + * pci_find_root_port - Returns the root port the given device is connected to.
> > + * @dev: PCI device for which the root port should be found.
> > + */
> > +struct pci_dev *pci_find_root_port(struct pci_dev *dev)
>
> This seems a little too generic. There are still PCI (non-PCIe) systems,
> and on those this will return some non-Root Port device, the meaning of
> which is unclear. I'm happy to put something like this in pci-tegra.c, but
> until there are other potential users and we sort out the PCI/PCIe-ness of
> the interface, I don't really want to make it global and exported.
>
I moved it out of the Tegra PCIe driver on your request. Also I can
already see this being useful for the Keystone PCI host driver to
shorten the MTRS quirk function.
I will rename this to pcie_find_root_port() so it is clear that this is
PCIe specific, but keep it in the current location.
> > +{
> > + struct pci_bus *bus = dev->bus;
> > +
> > + /* If there is no bridge on the bus the passed device is a root port. */
>
> This assumption is false -- see the comment at pci_is_root_bus().
>
Right, will change this.
Regards,
Lucas
--
Pengutronix e.K. | Lucas Stach |
Industrial Linux Solutions | http://www.pengutronix.de/ |
prev parent reply other threads:[~2015-03-30 10:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-13 19:57 [PATCH v3 1/2] PCI: add helper function to find root port for device Lucas Stach
2015-01-13 19:57 ` [PATCH v3 2/2] PCI: tegra: apply relaxed ordering fixup only on Tegra Lucas Stach
2015-01-23 22:40 ` Bjorn Helgaas
2015-01-23 22:34 ` [PATCH v3 1/2] PCI: add helper function to find root port for device Bjorn Helgaas
2015-03-30 10:36 ` Lucas Stach [this message]
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=1427711786.3370.3.camel@pengutronix.de \
--to=l.stach@pengutronix.de \
--cc=bhelgaas@google.com \
--cc=linux-pci@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=thierry.reding@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).