diff options
author | Kishon Vijay Abraham I <kishon@ti.com> | 2017-08-18 20:27:54 +0530 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2017-08-18 10:42:45 -0500 |
commit | f01f969e25ecc6f88844bcdd63f1f27610418bbc (patch) | |
tree | 3f80650862027c54217dcb8aa90ebc415b890d0e /drivers/pci/endpoint | |
parent | 64c1a02aecd599bd2d920a01e103235e483fbc89 (diff) |
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')
-rw-r--r-- | drivers/pci/endpoint/pci-epf-core.c | 16 |
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); |