From: Thierry Reding <thierry.reding@gmail.com>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: Stephen Warren <swarren@wwwdotorg.org>,
Alexandre Courbot <gnurou@gmail.com>,
linux-pci@vger.kernel.org, linux-tegra@vger.kernel.org
Subject: [PATCH 1/2] PCI: Add pci_ops.add_bus() callback
Date: Mon, 23 Nov 2015 13:40:25 +0100 [thread overview]
Message-ID: <1448282426-2642-1-git-send-email-thierry.reding@gmail.com> (raw)
From: Thierry Reding <treding@nvidia.com>
This callback will be called on every newly created bus. Drivers can
implement it to perform driver-specific initialization of the bus.
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
drivers/pci/probe.c | 8 +++++++-
include/linux/pci.h | 1 +
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index e735c728e3b3..fbed432f8915 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -754,7 +754,13 @@ add_dev:
ret = device_register(&child->dev);
WARN_ON(ret < 0);
- pcibios_add_bus(child);
+ if (child->ops->add_bus) {
+ ret = child->ops->add_bus(child);
+ if (ret < 0)
+ dev_err(&child->dev, "failed to add bus: %d\n", ret);
+ } else {
+ pcibios_add_bus(child);
+ }
/* Create legacy_io and legacy_mem files for this bus */
pci_create_legacy_files(child);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index e828e7b4afec..70c1228d585f 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -569,6 +569,7 @@ static inline int pcibios_err_to_errno(int err)
/* Low-level architecture-dependent routines */
struct pci_ops {
+ int (*add_bus)(struct pci_bus *bus);
void __iomem *(*map_bus)(struct pci_bus *bus, unsigned int devfn, int where);
int (*read)(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *val);
int (*write)(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 val);
--
2.5.0
next reply other threads:[~2015-11-23 12:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-23 12:40 Thierry Reding [this message]
2015-11-23 12:40 ` [PATCH 2/2] PCI: tegra: Implement ->add_bus() callback Thierry Reding
2015-12-04 20:01 ` Bjorn Helgaas
2015-12-04 19:50 ` [PATCH 1/2] PCI: Add pci_ops.add_bus() callback 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=1448282426-2642-1-git-send-email-thierry.reding@gmail.com \
--to=thierry.reding@gmail.com \
--cc=bhelgaas@google.com \
--cc=gnurou@gmail.com \
--cc=linux-pci@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=swarren@wwwdotorg.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).