Skip to contentSkip to conversation

pci: remove unused function

PATCH Applied Stephen Hemminger 3 participants 3 messages May 17, 2018 – Jun 27, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pci: remove unused function

The function rte_pci_probe_one is private to PCI and is not used anywhere in current code base. Remove dead code.

---
 drivers/bus/pci/pci_common.c | 38 ------------------------------------
 drivers/bus/pci/private.h    | 15 --------------
 2 files changed, 53 deletions(-)
drivers/bus/pci/pci_common.c +0 -38
index 7215aaec3add..3d21d7373b60 100644
@@ -254,44 +254,6 @@ pci_probe_all_drivers(struct rte_pci_device *dev)
 	return 1;
 }
 
-/*
- * Find the pci device specified by pci address, then invoke probe function of
- * the driver of the device.
- */
-int
-rte_pci_probe_one(const struct rte_pci_addr *addr)
-{
-	struct rte_pci_device *dev = NULL;
-
-	int ret = 0;
-
-	if (addr == NULL)
-		return -1;
-
-	/* update current pci device in global list, kernel bindings might have
-	 * changed since last time we looked at it.
-	 */
-	if (pci_update_device(addr) < 0)
-		goto err_return;
-
-	FOREACH_DEVICE_ON_PCIBUS(dev) {
-		if (rte_pci_addr_cmp(&dev->addr, addr))
-			continue;
-
-		ret = pci_probe_all_drivers(dev);
-		if (ret)
-			goto err_return;
-		return 0;
-	}
-	return -1;
-
-err_return:
-	RTE_LOG(WARNING, EAL,
-		"Requested device " PCI_PRI_FMT " cannot be used\n",
-		addr->domain, addr->bus, addr->devid, addr->function);
-	return -1;
-}
-
 /*
  * Detach device specified by its pci address.
  */
drivers/bus/pci/private.h +0 -15
index 88fa587e74dc..748abb6617fe 100644
@@ -32,21 +32,6 @@ rte_pci_probe(void);
  */
 int rte_pci_scan(void);
 
-/**
- * Probe the single PCI device.
- *
- * Scan the content of the PCI bus, and find the pci device specified by pci
- * address, then call the probe() function for registered driver that has a
- * matching entry in its id_table for discovered device.
- *
- * @param addr
- *	The PCI Bus-Device-Function address to probe.
- * @return
- *   - 0 on success.
- *   - Negative on error.
- */
-int rte_pci_probe_one(const struct rte_pci_addr *addr);
-
 /**
  * Close the single PCI device.
  *
Signature · 1 line
2.17.0
#1 lore raw

Hi,
Looks good to me. I noticed that the same is also with the rte_pci_detach() function, and I will send a patch to remove it as well.

Regards,
Rami Rosen

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Stephen Hemminger
Sent: Friday, May 18, 2018 02:45
To: [email protected]
Cc: Stephen Hemminger <[email protected]>
Subject: [dpdk-dev] [PATCH] pci: remove unused function

The function rte_pci_probe_one is private to PCI and is not used anywhere in current code base. Remove dead code.

---
 drivers/bus/pci/pci_common.c | 38 ------------------------------------
 drivers/bus/pci/private.h    | 15 --------------
 2 files changed, 53 deletions(-)
drivers/bus/pci/pci_common.c +0 -37
@@ -254,44 +254,6 @@ pci_probe_all_drivers(struct rte_pci_device *dev)
 	return 1;
 }
 
-/*
- * Find the pci device specified by pci address, then invoke probe function of
- * the driver of the device.
- */
-int
-rte_pci_probe_one(const struct rte_pci_addr *addr) -{
-	struct rte_pci_device *dev = NULL;
-
-	int ret = 0;
-
-	if (addr == NULL)
-		return -1;
-
-	/* update current pci device in global list, kernel bindings might have
-	 * changed since last time we looked at it.
-	 */
-	if (pci_update_device(addr) < 0)
-		goto err_return;
-
-	FOREACH_DEVICE_ON_PCIBUS(dev) {
-		if (rte_pci_addr_cmp(&dev->addr, addr))
-			continue;
-
-		ret = pci_probe_all_drivers(dev);
-		if (ret)
-			goto err_return;
-		return 0;
-	}
-	return -1;
-
-err_return:
-	RTE_LOG(WARNING, EAL,
-		"Requested device " PCI_PRI_FMT " cannot be used\n",
-		addr->domain, addr->bus, addr->devid, addr->function);
-	return -1;
-}
-
 /*
  * Detach device specified by its pci address.
  */
drivers/bus/pci/private.h +0 -15
@@ -32,21 +32,6 @@ rte_pci_probe(void);
  */
 int rte_pci_scan(void);
 
-/**
- * Probe the single PCI device.
- *
- * Scan the content of the PCI bus, and find the pci device specified by pci
- * address, then call the probe() function for registered driver that has a
- * matching entry in its id_table for discovered device.
- *
- * @param addr
- *	The PCI Bus-Device-Function address to probe.
- * @return
- *   - 0 on success.
- *   - Negative on error.
- */
-int rte_pci_probe_one(const struct rte_pci_addr *addr);
-
 /**
  * Close the single PCI device.
  *

--
2.17.0