summaryrefslogtreecommitdiffstats
path: root/drivers/pci/endpoint
diff options
context:
space:
mode:
authorKishon Vijay Abraham I <kishon@ti.com>2017-08-18 16:57:55 +0200
committerBjorn Helgaas <bhelgaas@google.com>2017-08-29 23:00:36 +0200
commit28daeff66990db85022c6a8b410e5b78dc78ff6a (patch)
tree5ec3cff1d77101cf24e06bb48d9a567337de48ad /drivers/pci/endpoint
parentPCI: endpoint: Add an API to get matching "pci_epf_device_id" (diff)
downloadlinux-28daeff66990db85022c6a8b410e5b78dc78ff6a.tar.xz
linux-28daeff66990db85022c6a8b410e5b78dc78ff6a.zip
PCI: endpoint: Make ->remove() callback optional
Make ->remove() callback optional so that endpoint function drivers don't have to populate empty ->remove() callback functions. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/endpoint')
-rw-r--r--drivers/pci/endpoint/pci-epf-core.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/pci/endpoint/pci-epf-core.c b/drivers/pci/endpoint/pci-epf-core.c
index f14e2be52658..70eccc04ee7f 100644
--- a/drivers/pci/endpoint/pci-epf-core.c
+++ b/drivers/pci/endpoint/pci-epf-core.c
@@ -333,11 +333,12 @@ static int pci_epf_device_probe(struct device *dev)
static int pci_epf_device_remove(struct device *dev)
{
- int ret;
+ int ret = 0;
struct pci_epf *epf = to_pci_epf(dev);
struct pci_epf_driver *driver = to_pci_epf_driver(dev->driver);
- ret = driver->remove(epf);
+ if (driver->remove)
+ ret = driver->remove(epf);
epf->driver = NULL;
return ret;