summaryrefslogtreecommitdiff
path: root/drivers/pci/endpoint/pci-epf-core.c
diff options
context:
space:
mode:
authorKishon Vijay Abraham I <kishon@ti.com>2017-08-18 17:57:54 +0300
committerBjorn Helgaas <bhelgaas@google.com>2017-08-18 18:42:45 +0300
commitf01f969e25ecc6f88844bcdd63f1f27610418bbc (patch)
tree3f80650862027c54217dcb8aa90ebc415b890d0e /drivers/pci/endpoint/pci-epf-core.c
parent64c1a02aecd599bd2d920a01e103235e483fbc89 (diff)
downloadlinux-f01f969e25ecc6f88844bcdd63f1f27610418bbc.tar.xz
PCI: endpoint: Add an API to get matching "pci_epf_device_id"
Add an API to get "pci_epf_device_id" matching the EPF name. This can be used by the EPF driver to get the driver data corresponding to the EPF device name. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> [bhelgaas: folded in "while" loop termination fix from Colin Ian King <colin.king@canonical.com>] Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/endpoint/pci-epf-core.c')
-rw-r--r--drivers/pci/endpoint/pci-epf-core.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/pci/endpoint/pci-epf-core.c b/drivers/pci/endpoint/pci-epf-core.c
index 6877d6a5bcc9..f14e2be52658 100644
--- a/drivers/pci/endpoint/pci-epf-core.c
+++ b/drivers/pci/endpoint/pci-epf-core.c
@@ -267,6 +267,22 @@ err_ret:
}
EXPORT_SYMBOL_GPL(pci_epf_create);
+const struct pci_epf_device_id *
+pci_epf_match_device(const struct pci_epf_device_id *id, struct pci_epf *epf)
+{
+ if (!id || !epf)
+ return NULL;
+
+ while (*id->name) {
+ if (strcmp(epf->name, id->name) == 0)
+ return id;
+ id++;
+ }
+
+ return NULL;
+}
+EXPORT_SYMBOL_GPL(pci_epf_match_device);
+
static void pci_epf_dev_release(struct device *dev)
{
struct pci_epf *epf = to_pci_epf(dev);