All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/12] Remove dead code
@ 2014-01-11  1:26 Bjorn Helgaas
  2014-01-11  1:26 ` [PATCH v2 01/12] PCI: Removed unused parts of Page Request Interface support Bjorn Helgaas
                   ` (11 more replies)
  0 siblings, 12 replies; 15+ messages in thread
From: Bjorn Helgaas @ 2014-01-11  1:26 UTC (permalink / raw)
  To: Stephen Hemminger, linux-pci; +Cc: Yu Zhao

This is basically a v2 of Stephen's patches [1,2].

I split them up into smaller patches because we're removing some PCIe 3.0
functionality (ID-Based Ordering, Optimized Buffer Flush/Fill, and Latency
Tolerance Reporting) that people might care about, and splitting it makes
that more visible and easier to add back in the future.

I kept pci_sriov_migration() and sriov_migration().  I think we could and
should remove these, but they were added by 74bb1bcc7dbb ("PCI: handle
SR-IOV Virtual Function Migration"), and I think we probably could revert
that commit entirely.  I just got tired of poking at this, so I left that
for somebody more interested.

pci_request_region_exclusive() and pci_request_regions_exclusive() were
added by e8de1481fd71 ("resource: allow MMIO exclusivity for device
drivers").  This series removes them but keeps the rest of that commit,
including pci_request_selected_regions_exclusive() and some other stuff.
e8de1481fd71 was for debugging a bad memory corruption, and e1000e is the
only user I see.  I'm not sure it's worth keeping all that stuff just for
one driver.  But again, I got tired of fiddling with this, so I just kept
Stephen's patch removing the obvious parts.

I left pci_cfg_space_size() global because it is used by powerpc and sparc.

I also left pci_find_next_ext_capability() global and exported.  It is used
internally and is also the only way for drivers to find capabilities that
can occur multiple times (though admittedly nones use it today).

I intend to merge this or an updated version for v3.14.  It's currently on
my pci/cleanup branch [3].

Bjorn

[1] http://lkml.kernel.org/r/20131227132734.2aa9bc16@nehalam.linuxnetplumber.net
[2] http://lkml.kernel.org/r/20131227132710.7190647c@nehalam.linuxnetplumber.net
[3] http://git.kernel.org/cgit/linux/kernel/git/helgaas/pci.git/log/?h=pci/cleanup

---

Bjorn Helgaas (2):
      PCI: Reorder pci.h so actual interfaces come before stubs
      PCI: Cleanup pci.h whitespace

Stephen Hemminger (10):
      PCI: Removed unused parts of Page Request Interface support
      PCI: Remove unused Latency Tolerance Reporting support
      PCI: Remove unused Optimized Buffer Flush/Fill support
      PCI: Remove unused ID-Based Ordering support
      PCI: Remove unused exclusive region support
      PCI: Remove unused pci_vpd_truncate()
      PCI: Remove unused pcie_aspm_enabled()
      PCI: Remove unused pci_renumber_slot()
      PCI: Remove unused alloc_pci_dev()
      PCI: Make local functions static


 drivers/pci/access.c              |   24 ---
 drivers/pci/ats.c                 |   82 ---------
 drivers/pci/hotplug/pciehp.h      |    1 
 drivers/pci/hotplug/pciehp_core.c |    2 
 drivers/pci/pci.c                 |  336 +++----------------------------------
 drivers/pci/pci.h                 |    2 
 drivers/pci/pcie/aspm.c           |   12 -
 drivers/pci/probe.c               |  117 ++++++-------
 drivers/pci/slot.c                |   26 ---
 include/linux/pci-ats.h           |   17 --
 include/linux/pci.h               |  129 +++-----------
 11 files changed, 114 insertions(+), 634 deletions(-)

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH v2 01/12] PCI: Removed unused parts of Page Request Interface support
  2014-01-11  1:26 [PATCH v2 00/12] Remove dead code Bjorn Helgaas
@ 2014-01-11  1:26 ` Bjorn Helgaas
  2014-01-11  1:26 ` [PATCH v2 02/12] PCI: Remove unused Latency Tolerance Reporting support Bjorn Helgaas
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Bjorn Helgaas @ 2014-01-11  1:26 UTC (permalink / raw)
  To: Stephen Hemminger, linux-pci; +Cc: Yu Zhao, Joerg Roedel

From: Stephen Hemminger <stephen@networkplumber.org>

My philosophy is unused code is dead code.  And dead code is subject to bit
rot and is a likely source of bugs.  Use it or lose it.

This reverts parts of c320b976d783 ("PCI: Add implementation for PRI
capability"), removing these interfaces:

    pci_pri_enabled()
    pci_pri_stopped()
    pci_pri_status()

[bhelgaas: split to separate patch]
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
CC: Joerg Roedel <joro@8bytes.org>
---
 drivers/pci/ats.c       |   82 -----------------------------------------------
 include/linux/pci-ats.h |   17 ----------
 2 files changed, 99 deletions(-)

diff --git a/drivers/pci/ats.c b/drivers/pci/ats.c
index e52d7ffa38b9..a8099d4d0c9d 100644
--- a/drivers/pci/ats.c
+++ b/drivers/pci/ats.c
@@ -235,27 +235,6 @@ void pci_disable_pri(struct pci_dev *pdev)
 EXPORT_SYMBOL_GPL(pci_disable_pri);
 
 /**
- * pci_pri_enabled - Checks if PRI capability is enabled
- * @pdev: PCI device structure
- *
- * Returns true if PRI is enabled on the device, false otherwise
- */
-bool pci_pri_enabled(struct pci_dev *pdev)
-{
-	u16 control;
-	int pos;
-
-	pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_PRI);
-	if (!pos)
-		return false;
-
-	pci_read_config_word(pdev, pos + PCI_PRI_CTRL, &control);
-
-	return (control & PCI_PRI_CTRL_ENABLE) ? true : false;
-}
-EXPORT_SYMBOL_GPL(pci_pri_enabled);
-
-/**
  * pci_reset_pri - Resets device's PRI state
  * @pdev: PCI device structure
  *
@@ -282,67 +261,6 @@ int pci_reset_pri(struct pci_dev *pdev)
 	return 0;
 }
 EXPORT_SYMBOL_GPL(pci_reset_pri);
-
-/**
- * pci_pri_stopped - Checks whether the PRI capability is stopped
- * @pdev: PCI device structure
- *
- * Returns true if the PRI capability on the device is disabled and the
- * device has no outstanding PRI requests, false otherwise. The device
- * indicates this via the STOPPED bit in the status register of the
- * capability.
- * The device internal state can be cleared by resetting the PRI state
- * with pci_reset_pri(). This can force the capability into the STOPPED
- * state.
- */
-bool pci_pri_stopped(struct pci_dev *pdev)
-{
-	u16 control, status;
-	int pos;
-
-	pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_PRI);
-	if (!pos)
-		return true;
-
-	pci_read_config_word(pdev, pos + PCI_PRI_CTRL, &control);
-	pci_read_config_word(pdev, pos + PCI_PRI_STATUS, &status);
-
-	if (control & PCI_PRI_CTRL_ENABLE)
-		return false;
-
-	return (status & PCI_PRI_STATUS_STOPPED) ? true : false;
-}
-EXPORT_SYMBOL_GPL(pci_pri_stopped);
-
-/**
- * pci_pri_status - Request PRI status of a device
- * @pdev: PCI device structure
- *
- * Returns negative value on failure, status on success. The status can
- * be checked against status-bits. Supported bits are currently:
- * PCI_PRI_STATUS_RF:      Response failure
- * PCI_PRI_STATUS_UPRGI:   Unexpected Page Request Group Index
- * PCI_PRI_STATUS_STOPPED: PRI has stopped
- */
-int pci_pri_status(struct pci_dev *pdev)
-{
-	u16 status, control;
-	int pos;
-
-	pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_PRI);
-	if (!pos)
-		return -EINVAL;
-
-	pci_read_config_word(pdev, pos + PCI_PRI_CTRL, &control);
-	pci_read_config_word(pdev, pos + PCI_PRI_STATUS, &status);
-
-	/* Stopped bit is undefined when enable == 1, so clear it */
-	if (control & PCI_PRI_CTRL_ENABLE)
-		status &= ~PCI_PRI_STATUS_STOPPED;
-
-	return status;
-}
-EXPORT_SYMBOL_GPL(pci_pri_status);
 #endif /* CONFIG_PCI_PRI */
 
 #ifdef CONFIG_PCI_PASID
diff --git a/include/linux/pci-ats.h b/include/linux/pci-ats.h
index 68bcefd7fca0..72031785fe1d 100644
--- a/include/linux/pci-ats.h
+++ b/include/linux/pci-ats.h
@@ -56,10 +56,7 @@ static inline int pci_ats_enabled(struct pci_dev *dev)
 
 int pci_enable_pri(struct pci_dev *pdev, u32 reqs);
 void pci_disable_pri(struct pci_dev *pdev);
-bool pci_pri_enabled(struct pci_dev *pdev);
 int pci_reset_pri(struct pci_dev *pdev);
-bool pci_pri_stopped(struct pci_dev *pdev);
-int pci_pri_status(struct pci_dev *pdev);
 
 #else /* CONFIG_PCI_PRI */
 
@@ -72,25 +69,11 @@ static inline void pci_disable_pri(struct pci_dev *pdev)
 {
 }
 
-static inline bool pci_pri_enabled(struct pci_dev *pdev)
-{
-	return false;
-}
-
 static inline int pci_reset_pri(struct pci_dev *pdev)
 {
 	return -ENODEV;
 }
 
-static inline bool pci_pri_stopped(struct pci_dev *pdev)
-{
-	return true;
-}
-
-static inline int pci_pri_status(struct pci_dev *pdev)
-{
-	return -ENODEV;
-}
 #endif /* CONFIG_PCI_PRI */
 
 #ifdef CONFIG_PCI_PASID


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v2 02/12] PCI: Remove unused Latency Tolerance Reporting support
  2014-01-11  1:26 [PATCH v2 00/12] Remove dead code Bjorn Helgaas
  2014-01-11  1:26 ` [PATCH v2 01/12] PCI: Removed unused parts of Page Request Interface support Bjorn Helgaas
@ 2014-01-11  1:26 ` Bjorn Helgaas
  2014-01-11  1:27 ` [PATCH v2 03/12] PCI: Remove unused Optimized Buffer Flush/Fill support Bjorn Helgaas
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Bjorn Helgaas @ 2014-01-11  1:26 UTC (permalink / raw)
  To: Stephen Hemminger, linux-pci; +Cc: Yu Zhao, Jesse Barnes

From: Stephen Hemminger <stephen@networkplumber.org>

My philosophy is unused code is dead code.  And dead code is subject to bit
rot and is a likely source of bugs.  Use it or lose it.

This reverts 51c2e0a7e5bc ("PCI: add latency tolerance reporting
enable/disable support"), removing these interfaces:

    pci_enable_ltr()
    pci_disable_ltr()
    pci_set_ltr()

[bhelgaas: split to separate patch, also remove prototypes from pci.h]
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
CC: Jesse Barnes <jbarnes@virtuousgeek.org>
---
 drivers/pci/pci.c   |  123 ---------------------------------------------------
 include/linux/pci.h |    4 --
 2 files changed, 127 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 33120d156668..020f672deabb 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -2223,129 +2223,6 @@ void pci_disable_obff(struct pci_dev *dev)
 }
 EXPORT_SYMBOL(pci_disable_obff);
 
-/**
- * pci_ltr_supported - check whether a device supports LTR
- * @dev: PCI device
- *
- * RETURNS:
- * True if @dev supports latency tolerance reporting, false otherwise.
- */
-static bool pci_ltr_supported(struct pci_dev *dev)
-{
-	u32 cap;
-
-	pcie_capability_read_dword(dev, PCI_EXP_DEVCAP2, &cap);
-
-	return cap & PCI_EXP_DEVCAP2_LTR;
-}
-
-/**
- * pci_enable_ltr - enable latency tolerance reporting
- * @dev: PCI device
- *
- * Enable LTR on @dev if possible, which means enabling it first on
- * upstream ports.
- *
- * RETURNS:
- * Zero on success, errno on failure.
- */
-int pci_enable_ltr(struct pci_dev *dev)
-{
-	int ret;
-
-	/* Only primary function can enable/disable LTR */
-	if (PCI_FUNC(dev->devfn) != 0)
-		return -EINVAL;
-
-	if (!pci_ltr_supported(dev))
-		return -ENOTSUPP;
-
-	/* Enable upstream ports first */
-	if (dev->bus->self) {
-		ret = pci_enable_ltr(dev->bus->self);
-		if (ret)
-			return ret;
-	}
-
-	return pcie_capability_set_word(dev, PCI_EXP_DEVCTL2,
-					PCI_EXP_DEVCTL2_LTR_EN);
-}
-EXPORT_SYMBOL(pci_enable_ltr);
-
-/**
- * pci_disable_ltr - disable latency tolerance reporting
- * @dev: PCI device
- */
-void pci_disable_ltr(struct pci_dev *dev)
-{
-	/* Only primary function can enable/disable LTR */
-	if (PCI_FUNC(dev->devfn) != 0)
-		return;
-
-	if (!pci_ltr_supported(dev))
-		return;
-
-	pcie_capability_clear_word(dev, PCI_EXP_DEVCTL2,
-				   PCI_EXP_DEVCTL2_LTR_EN);
-}
-EXPORT_SYMBOL(pci_disable_ltr);
-
-static int __pci_ltr_scale(int *val)
-{
-	int scale = 0;
-
-	while (*val > 1023) {
-		*val = (*val + 31) / 32;
-		scale++;
-	}
-	return scale;
-}
-
-/**
- * pci_set_ltr - set LTR latency values
- * @dev: PCI device
- * @snoop_lat_ns: snoop latency in nanoseconds
- * @nosnoop_lat_ns: nosnoop latency in nanoseconds
- *
- * Figure out the scale and set the LTR values accordingly.
- */
-int pci_set_ltr(struct pci_dev *dev, int snoop_lat_ns, int nosnoop_lat_ns)
-{
-	int pos, ret, snoop_scale, nosnoop_scale;
-	u16 val;
-
-	if (!pci_ltr_supported(dev))
-		return -ENOTSUPP;
-
-	snoop_scale = __pci_ltr_scale(&snoop_lat_ns);
-	nosnoop_scale = __pci_ltr_scale(&nosnoop_lat_ns);
-
-	if (snoop_lat_ns > PCI_LTR_VALUE_MASK ||
-	    nosnoop_lat_ns > PCI_LTR_VALUE_MASK)
-		return -EINVAL;
-
-	if ((snoop_scale > (PCI_LTR_SCALE_MASK >> PCI_LTR_SCALE_SHIFT)) ||
-	    (nosnoop_scale > (PCI_LTR_SCALE_MASK >> PCI_LTR_SCALE_SHIFT)))
-		return -EINVAL;
-
-	pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_LTR);
-	if (!pos)
-		return -ENOTSUPP;
-
-	val = (snoop_scale << PCI_LTR_SCALE_SHIFT) | snoop_lat_ns;
-	ret = pci_write_config_word(dev, pos + PCI_LTR_MAX_SNOOP_LAT, val);
-	if (ret != 4)
-		return -EIO;
-
-	val = (nosnoop_scale << PCI_LTR_SCALE_SHIFT) | nosnoop_lat_ns;
-	ret = pci_write_config_word(dev, pos + PCI_LTR_MAX_NOSNOOP_LAT, val);
-	if (ret != 4)
-		return -EIO;
-
-	return 0;
-}
-EXPORT_SYMBOL(pci_set_ltr);
-
 static int pci_acs_enable;
 
 /**
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 1084a15175e0..ee26454746ba 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1009,10 +1009,6 @@ enum pci_obff_signal_type {
 int pci_enable_obff(struct pci_dev *dev, enum pci_obff_signal_type);
 void pci_disable_obff(struct pci_dev *dev);
 
-int pci_enable_ltr(struct pci_dev *dev);
-void pci_disable_ltr(struct pci_dev *dev);
-int pci_set_ltr(struct pci_dev *dev, int snoop_lat_ns, int nosnoop_lat_ns);
-
 /* For use by arch with custom probe code */
 void set_pcie_port_type(struct pci_dev *pdev);
 void set_pcie_hotplug_bridge(struct pci_dev *pdev);


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v2 03/12] PCI: Remove unused Optimized Buffer Flush/Fill support
  2014-01-11  1:26 [PATCH v2 00/12] Remove dead code Bjorn Helgaas
  2014-01-11  1:26 ` [PATCH v2 01/12] PCI: Removed unused parts of Page Request Interface support Bjorn Helgaas
  2014-01-11  1:26 ` [PATCH v2 02/12] PCI: Remove unused Latency Tolerance Reporting support Bjorn Helgaas
@ 2014-01-11  1:27 ` Bjorn Helgaas
  2014-01-11  1:27 ` [PATCH v2 04/12] PCI: Remove unused ID-Based Ordering support Bjorn Helgaas
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Bjorn Helgaas @ 2014-01-11  1:27 UTC (permalink / raw)
  To: Stephen Hemminger, linux-pci; +Cc: Yu Zhao, Jesse Barnes

From: Stephen Hemminger <stephen@networkplumber.org>

My philosophy is unused code is dead code.  And dead code is subject to bit
rot and is a likely source of bugs.  Use it or lose it.

This reverts 48a92a8179b3 ("PCI: add OBFF enable/disable support"),
removing these interfaces:

    pci_enable_obff()
    pci_disable_obff()

[bhelgaas: split to separate patch, also remove prototypes from pci.h]
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
CC: Jesse Barnes <jbarnes@virtuousgeek.org>
---
 drivers/pci/pci.c   |   73 ---------------------------------------------------
 include/linux/pci.h |   16 -----------
 2 files changed, 89 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 020f672deabb..84a24d16778f 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -2150,79 +2150,6 @@ void pci_disable_ido(struct pci_dev *dev, unsigned long type)
 }
 EXPORT_SYMBOL(pci_disable_ido);
 
-/**
- * pci_enable_obff - enable optimized buffer flush/fill
- * @dev: PCI device
- * @type: type of signaling to use
- *
- * Try to enable @type OBFF signaling on @dev.  It will try using WAKE#
- * signaling if possible, falling back to message signaling only if
- * WAKE# isn't supported.  @type should indicate whether the PCIe link
- * be brought out of L0s or L1 to send the message.  It should be either
- * %PCI_EXP_OBFF_SIGNAL_ALWAYS or %PCI_OBFF_SIGNAL_L0.
- *
- * If your device can benefit from receiving all messages, even at the
- * power cost of bringing the link back up from a low power state, use
- * %PCI_EXP_OBFF_SIGNAL_ALWAYS.  Otherwise, use %PCI_OBFF_SIGNAL_L0 (the
- * preferred type).
- *
- * RETURNS:
- * Zero on success, appropriate error number on failure.
- */
-int pci_enable_obff(struct pci_dev *dev, enum pci_obff_signal_type type)
-{
-	u32 cap;
-	u16 ctrl;
-	int ret;
-
-	pcie_capability_read_dword(dev, PCI_EXP_DEVCAP2, &cap);
-	if (!(cap & PCI_EXP_DEVCAP2_OBFF_MASK))
-		return -ENOTSUPP; /* no OBFF support at all */
-
-	/* Make sure the topology supports OBFF as well */
-	if (dev->bus->self) {
-		ret = pci_enable_obff(dev->bus->self, type);
-		if (ret)
-			return ret;
-	}
-
-	pcie_capability_read_word(dev, PCI_EXP_DEVCTL2, &ctrl);
-	if (cap & PCI_EXP_DEVCAP2_OBFF_WAKE)
-		ctrl |= PCI_EXP_DEVCTL2_OBFF_WAKE_EN;
-	else {
-		switch (type) {
-		case PCI_EXP_OBFF_SIGNAL_L0:
-			if (!(ctrl & PCI_EXP_DEVCTL2_OBFF_WAKE_EN))
-				ctrl |= PCI_EXP_DEVCTL2_OBFF_MSGA_EN;
-			break;
-		case PCI_EXP_OBFF_SIGNAL_ALWAYS:
-			ctrl &= ~PCI_EXP_DEVCTL2_OBFF_WAKE_EN;
-			ctrl |= PCI_EXP_DEVCTL2_OBFF_MSGB_EN;
-			break;
-		default:
-			WARN(1, "bad OBFF signal type\n");
-			return -ENOTSUPP;
-		}
-	}
-	pcie_capability_write_word(dev, PCI_EXP_DEVCTL2, ctrl);
-
-	return 0;
-}
-EXPORT_SYMBOL(pci_enable_obff);
-
-/**
- * pci_disable_obff - disable optimized buffer flush/fill
- * @dev: PCI device
- *
- * Disable OBFF on @dev.
- */
-void pci_disable_obff(struct pci_dev *dev)
-{
-	pcie_capability_clear_word(dev, PCI_EXP_DEVCTL2,
-				   PCI_EXP_DEVCTL2_OBFF_WAKE_EN);
-}
-EXPORT_SYMBOL(pci_disable_obff);
-
 static int pci_acs_enable;
 
 /**
diff --git a/include/linux/pci.h b/include/linux/pci.h
index ee26454746ba..b8cbe52c7a48 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1002,13 +1002,6 @@ static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state,
 void pci_enable_ido(struct pci_dev *dev, unsigned long type);
 void pci_disable_ido(struct pci_dev *dev, unsigned long type);
 
-enum pci_obff_signal_type {
-	PCI_EXP_OBFF_SIGNAL_L0 = 0,
-	PCI_EXP_OBFF_SIGNAL_ALWAYS = 1,
-};
-int pci_enable_obff(struct pci_dev *dev, enum pci_obff_signal_type);
-void pci_disable_obff(struct pci_dev *dev);
-
 /* For use by arch with custom probe code */
 void set_pcie_port_type(struct pci_dev *pdev);
 void set_pcie_hotplug_bridge(struct pci_dev *pdev);
@@ -1427,15 +1420,6 @@ static inline void pci_disable_ido(struct pci_dev *dev, unsigned long type)
 {
 }
 
-static inline int pci_enable_obff(struct pci_dev *dev, unsigned long type)
-{
-	return 0;
-}
-
-static inline void pci_disable_obff(struct pci_dev *dev)
-{
-}
-
 static inline int pci_request_regions(struct pci_dev *dev, const char *res_name)
 {
 	return -EIO;


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v2 04/12] PCI: Remove unused ID-Based Ordering support
  2014-01-11  1:26 [PATCH v2 00/12] Remove dead code Bjorn Helgaas
                   ` (2 preceding siblings ...)
  2014-01-11  1:27 ` [PATCH v2 03/12] PCI: Remove unused Optimized Buffer Flush/Fill support Bjorn Helgaas
@ 2014-01-11  1:27 ` Bjorn Helgaas
  2014-01-11  1:27 ` [PATCH v2 05/12] PCI: Remove unused exclusive region support Bjorn Helgaas
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Bjorn Helgaas @ 2014-01-11  1:27 UTC (permalink / raw)
  To: Stephen Hemminger, linux-pci; +Cc: Yu Zhao, Jesse Barnes

From: Stephen Hemminger <stephen@networkplumber.org>

My philosophy is unused code is dead code.  And dead code is subject to bit
rot and is a likely source of bugs.  Use it or lose it.

This reverts b48d4425b602 ("PCI: add ID-based ordering enable/disable
support"), removing these interfaces:

    pci_enable_ido()
    pci_disable_ido()

[bhelgaas: split to separate patch, also remove prototypes from pci.h]
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
CC: Jesse Barnes <jbarnes@virtuousgeek.org>
---
 drivers/pci/pci.c   |   40 ----------------------------------------
 include/linux/pci.h |   13 -------------
 2 files changed, 53 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 84a24d16778f..6db2f1a441e9 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -2110,46 +2110,6 @@ void pci_configure_ari(struct pci_dev *dev)
 	}
 }
 
-/**
- * pci_enable_ido - enable ID-based Ordering on a device
- * @dev: the PCI device
- * @type: which types of IDO to enable
- *
- * Enable ID-based ordering on @dev.  @type can contain the bits
- * %PCI_EXP_IDO_REQUEST and/or %PCI_EXP_IDO_COMPLETION to indicate
- * which types of transactions are allowed to be re-ordered.
- */
-void pci_enable_ido(struct pci_dev *dev, unsigned long type)
-{
-	u16 ctrl = 0;
-
-	if (type & PCI_EXP_IDO_REQUEST)
-		ctrl |= PCI_EXP_DEVCTL2_IDO_REQ_EN;
-	if (type & PCI_EXP_IDO_COMPLETION)
-		ctrl |= PCI_EXP_DEVCTL2_IDO_CMP_EN;
-	if (ctrl)
-		pcie_capability_set_word(dev, PCI_EXP_DEVCTL2, ctrl);
-}
-EXPORT_SYMBOL(pci_enable_ido);
-
-/**
- * pci_disable_ido - disable ID-based ordering on a device
- * @dev: the PCI device
- * @type: which types of IDO to disable
- */
-void pci_disable_ido(struct pci_dev *dev, unsigned long type)
-{
-	u16 ctrl = 0;
-
-	if (type & PCI_EXP_IDO_REQUEST)
-		ctrl |= PCI_EXP_DEVCTL2_IDO_REQ_EN;
-	if (type & PCI_EXP_IDO_COMPLETION)
-		ctrl |= PCI_EXP_DEVCTL2_IDO_CMP_EN;
-	if (ctrl)
-		pcie_capability_clear_word(dev, PCI_EXP_DEVCTL2, ctrl);
-}
-EXPORT_SYMBOL(pci_disable_ido);
-
 static int pci_acs_enable;
 
 /**
diff --git a/include/linux/pci.h b/include/linux/pci.h
index b8cbe52c7a48..f2284f1332db 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -997,11 +997,6 @@ static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state,
 	return __pci_enable_wake(dev, state, false, enable);
 }
 
-#define PCI_EXP_IDO_REQUEST	(1<<0)
-#define PCI_EXP_IDO_COMPLETION	(1<<1)
-void pci_enable_ido(struct pci_dev *dev, unsigned long type);
-void pci_disable_ido(struct pci_dev *dev, unsigned long type);
-
 /* For use by arch with custom probe code */
 void set_pcie_port_type(struct pci_dev *pdev);
 void set_pcie_hotplug_bridge(struct pci_dev *pdev);
@@ -1412,14 +1407,6 @@ static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state,
 	return 0;
 }
 
-static inline void pci_enable_ido(struct pci_dev *dev, unsigned long type)
-{
-}
-
-static inline void pci_disable_ido(struct pci_dev *dev, unsigned long type)
-{
-}
-
 static inline int pci_request_regions(struct pci_dev *dev, const char *res_name)
 {
 	return -EIO;


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v2 05/12] PCI: Remove unused exclusive region support
  2014-01-11  1:26 [PATCH v2 00/12] Remove dead code Bjorn Helgaas
                   ` (3 preceding siblings ...)
  2014-01-11  1:27 ` [PATCH v2 04/12] PCI: Remove unused ID-Based Ordering support Bjorn Helgaas
@ 2014-01-11  1:27 ` Bjorn Helgaas
  2014-01-13 18:12   ` Bjorn Helgaas
  2014-01-11  1:27 ` [PATCH v2 06/12] PCI: Remove unused pci_vpd_truncate() Bjorn Helgaas
                   ` (6 subsequent siblings)
  11 siblings, 1 reply; 15+ messages in thread
From: Bjorn Helgaas @ 2014-01-11  1:27 UTC (permalink / raw)
  To: Stephen Hemminger, linux-pci; +Cc: Yu Zhao, Arjan van de Ven

From: Stephen Hemminger <stephen@networkplumber.org>

My philosophy is unused code is dead code.  And dead code is subject to bit
rot and is a likely source of bugs.  Use it or lose it.

This reverts part of e8de1481fd71 ("resource: allow MMIO exclusivity for
device drivers"), removing these interfaces:

    pci_request_region_exclusive()
    pci_request_regions_exclusive()

[bhelgaas: split to separate patch, also remove prototypes from pci.h]
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
CC: Arjan van de Ven <arjan@linux.intel.com>
---
 drivers/pci/pci.c   |   46 ----------------------------------------------
 include/linux/pci.h |    2 --
 2 files changed, 48 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 6db2f1a441e9..730471a74fba 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -2443,28 +2443,6 @@ int pci_request_region(struct pci_dev *pdev, int bar, const char *res_name)
 }
 
 /**
- *	pci_request_region_exclusive - Reserved PCI I/O and memory resource
- *	@pdev: PCI device whose resources are to be reserved
- *	@bar: BAR to be reserved
- *	@res_name: Name to be associated with resource.
- *
- *	Mark the PCI region associated with PCI device @pdev BR @bar as
- *	being reserved by owner @res_name.  Do not access any
- *	address inside the PCI regions unless this call returns
- *	successfully.
- *
- *	Returns 0 on success, or %EBUSY on error.  A warning
- *	message is also printed on failure.
- *
- *	The key difference that _exclusive makes it that userspace is
- *	explicitly not allowed to map the resource via /dev/mem or
- *	sysfs.
- */
-int pci_request_region_exclusive(struct pci_dev *pdev, int bar, const char *res_name)
-{
-	return __pci_request_region(pdev, bar, res_name, IORESOURCE_EXCLUSIVE);
-}
-/**
  * pci_release_selected_regions - Release selected PCI I/O and memory resources
  * @pdev: PCI device whose resources were previously reserved
  * @bars: Bitmask of BARs to be released
@@ -2552,28 +2530,6 @@ int pci_request_regions(struct pci_dev *pdev, const char *res_name)
 	return pci_request_selected_regions(pdev, ((1 << 6) - 1), res_name);
 }
 
-/**
- *	pci_request_regions_exclusive - Reserved PCI I/O and memory resources
- *	@pdev: PCI device whose resources are to be reserved
- *	@res_name: Name to be associated with resource.
- *
- *	Mark all PCI regions associated with PCI device @pdev as
- *	being reserved by owner @res_name.  Do not access any
- *	address inside the PCI regions unless this call returns
- *	successfully.
- *
- *	pci_request_regions_exclusive() will mark the region so that
- *	/dev/mem and the sysfs MMIO access will not be allowed.
- *
- *	Returns 0 on success, or %EBUSY on error.  A warning
- *	message is also printed on failure.
- */
-int pci_request_regions_exclusive(struct pci_dev *pdev, const char *res_name)
-{
-	return pci_request_selected_regions_exclusive(pdev,
-					((1 << 6) - 1), res_name);
-}
-
 static void __pci_set_master(struct pci_dev *dev, bool enable)
 {
 	u16 old_cmd, cmd;
@@ -4183,10 +4139,8 @@ EXPORT_SYMBOL(pci_find_capability);
 EXPORT_SYMBOL(pci_bus_find_capability);
 EXPORT_SYMBOL(pci_release_regions);
 EXPORT_SYMBOL(pci_request_regions);
-EXPORT_SYMBOL(pci_request_regions_exclusive);
 EXPORT_SYMBOL(pci_release_region);
 EXPORT_SYMBOL(pci_request_region);
-EXPORT_SYMBOL(pci_request_region_exclusive);
 EXPORT_SYMBOL(pci_release_selected_regions);
 EXPORT_SYMBOL(pci_request_selected_regions);
 EXPORT_SYMBOL(pci_request_selected_regions_exclusive);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index f2284f1332db..efd0b8b67705 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1026,10 +1026,8 @@ void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *),
 		    int (*)(const struct pci_dev *, u8, u8));
 #define HAVE_PCI_REQ_REGIONS	2
 int __must_check pci_request_regions(struct pci_dev *, const char *);
-int __must_check pci_request_regions_exclusive(struct pci_dev *, const char *);
 void pci_release_regions(struct pci_dev *);
 int __must_check pci_request_region(struct pci_dev *, int, const char *);
-int __must_check pci_request_region_exclusive(struct pci_dev *, int, const char *);
 void pci_release_region(struct pci_dev *, int);
 int pci_request_selected_regions(struct pci_dev *, int, const char *);
 int pci_request_selected_regions_exclusive(struct pci_dev *, int, const char *);


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v2 06/12] PCI: Remove unused pci_vpd_truncate()
  2014-01-11  1:26 [PATCH v2 00/12] Remove dead code Bjorn Helgaas
                   ` (4 preceding siblings ...)
  2014-01-11  1:27 ` [PATCH v2 05/12] PCI: Remove unused exclusive region support Bjorn Helgaas
@ 2014-01-11  1:27 ` Bjorn Helgaas
  2014-01-11  1:27 ` [PATCH v2 07/12] PCI: Remove unused pcie_aspm_enabled() Bjorn Helgaas
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Bjorn Helgaas @ 2014-01-11  1:27 UTC (permalink / raw)
  To: Stephen Hemminger, linux-pci; +Cc: Yu Zhao

From: Stephen Hemminger <stephen@networkplumber.org>

My philosophy is unused code is dead code.  And dead code is subject to bit
rot and is a likely source of bugs.  Use it or lose it.

This reverts db5679437a2b ("PCI: add interface to set visible size of
VPD"), removing this interface:

    pci_vpd_truncate()

[bhelgaas: split to separate patch, also remove prototype from pci.h]
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/access.c |   24 ------------------------
 include/linux/pci.h  |    1 -
 2 files changed, 25 deletions(-)

diff --git a/drivers/pci/access.c b/drivers/pci/access.c
index 0857ca981fae..7f8b78c08879 100644
--- a/drivers/pci/access.c
+++ b/drivers/pci/access.c
@@ -381,30 +381,6 @@ int pci_vpd_pci22_init(struct pci_dev *dev)
 }
 
 /**
- * pci_vpd_truncate - Set available Vital Product Data size
- * @dev:	pci device struct
- * @size:	available memory in bytes
- *
- * Adjust size of available VPD area.
- */
-int pci_vpd_truncate(struct pci_dev *dev, size_t size)
-{
-	if (!dev->vpd)
-		return -EINVAL;
-
-	/* limited by the access method */
-	if (size > dev->vpd->len)
-		return -EINVAL;
-
-	dev->vpd->len = size;
-	if (dev->vpd->attr)
-		dev->vpd->attr->size = size;
-
-	return 0;
-}
-EXPORT_SYMBOL(pci_vpd_truncate);
-
-/**
  * pci_cfg_access_lock - Lock PCI config reads/writes
  * @dev:	pci device struct
  *
diff --git a/include/linux/pci.h b/include/linux/pci.h
index efd0b8b67705..bf1f385bf14d 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1009,7 +1009,6 @@ unsigned int pci_rescan_bus(struct pci_bus *bus);
 /* Vital product data routines */
 ssize_t pci_read_vpd(struct pci_dev *dev, loff_t pos, size_t count, void *buf);
 ssize_t pci_write_vpd(struct pci_dev *dev, loff_t pos, size_t count, const void *buf);
-int pci_vpd_truncate(struct pci_dev *dev, size_t size);
 
 /* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */
 resource_size_t pcibios_retrieve_fw_addr(struct pci_dev *dev, int idx);


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v2 07/12] PCI: Remove unused pcie_aspm_enabled()
  2014-01-11  1:26 [PATCH v2 00/12] Remove dead code Bjorn Helgaas
                   ` (5 preceding siblings ...)
  2014-01-11  1:27 ` [PATCH v2 06/12] PCI: Remove unused pci_vpd_truncate() Bjorn Helgaas
@ 2014-01-11  1:27 ` Bjorn Helgaas
  2014-01-11  1:27 ` [PATCH v2 08/12] PCI: Remove unused pci_renumber_slot() Bjorn Helgaas
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Bjorn Helgaas @ 2014-01-11  1:27 UTC (permalink / raw)
  To: Stephen Hemminger, linux-pci; +Cc: Yu Zhao, Andrew Patterson

From: Stephen Hemminger <stephen@networkplumber.org>

My philosophy is unused code is dead code.  And dead code is subject to bit
rot and is a likely source of bugs.  Use it or lose it.

This reverts part of 3e1b16002af2 ("ACPI/PCI: PCIe ASPM _OSC support
capabilities called when root bridge added"), removing this interface:

    pcie_aspm_enabled()

[bhelgaas: split to separate patch]
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
CC: Andrew Patterson <andrew.patterson@hp.com>
---
 drivers/pci/pcie/aspm.c |   12 ------------
 include/linux/pci.h     |    2 --
 2 files changed, 14 deletions(-)

diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index f1272dc54de1..e1e7026b838d 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -984,18 +984,6 @@ void pcie_no_aspm(void)
 	}
 }
 
-/**
- * pcie_aspm_enabled - is PCIe ASPM enabled?
- *
- * Returns true if ASPM has not been disabled by the command-line option
- * pcie_aspm=off.
- **/
-int pcie_aspm_enabled(void)
-{
-       return !aspm_disabled;
-}
-EXPORT_SYMBOL(pcie_aspm_enabled);
-
 bool pcie_aspm_support_enabled(void)
 {
 	return aspm_support_enabled;
diff --git a/include/linux/pci.h b/include/linux/pci.h
index bf1f385bf14d..583348275085 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1198,10 +1198,8 @@ extern bool pcie_ports_auto;
 #endif
 
 #ifndef CONFIG_PCIEASPM
-static inline int pcie_aspm_enabled(void) { return 0; }
 static inline bool pcie_aspm_support_enabled(void) { return false; }
 #else
-int pcie_aspm_enabled(void);
 bool pcie_aspm_support_enabled(void);
 #endif
 


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v2 08/12] PCI: Remove unused pci_renumber_slot()
  2014-01-11  1:26 [PATCH v2 00/12] Remove dead code Bjorn Helgaas
                   ` (6 preceding siblings ...)
  2014-01-11  1:27 ` [PATCH v2 07/12] PCI: Remove unused pcie_aspm_enabled() Bjorn Helgaas
@ 2014-01-11  1:27 ` Bjorn Helgaas
  2014-01-13 18:43   ` Alex Chiang
  2014-01-11  1:27 ` [PATCH v2 09/12] PCI: Remove unused alloc_pci_dev() Bjorn Helgaas
                   ` (3 subsequent siblings)
  11 siblings, 1 reply; 15+ messages in thread
From: Bjorn Helgaas @ 2014-01-11  1:27 UTC (permalink / raw)
  To: Stephen Hemminger, linux-pci; +Cc: Yu Zhao, Alex Chiang

From: Stephen Hemminger <stephen@networkplumber.org>

My philosophy is unused code is dead code.  And dead code is subject to bit
rot and is a likely source of bugs.  Use it or lose it.

This reverts part of f46753c5e354 ("PCI: introduce pci_slot") and
d25b7c8d6ba2 ("PCI: rename pci_update_slot_number to pci_renumber_slot"),
removing this interface:

    pci_renumber_slot()

[bhelgaas: split to separate patch]
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
CC: Alex Chiang <achiang@canonical.com>
---
 drivers/pci/slot.c  |   26 --------------------------
 include/linux/pci.h |    1 -
 2 files changed, 27 deletions(-)

diff --git a/drivers/pci/slot.c b/drivers/pci/slot.c
index 448ca562d1f8..7dd62fa9d0bd 100644
--- a/drivers/pci/slot.c
+++ b/drivers/pci/slot.c
@@ -320,32 +320,6 @@ err:
 EXPORT_SYMBOL_GPL(pci_create_slot);
 
 /**
- * pci_renumber_slot - update %struct pci_slot -> number
- * @slot: &struct pci_slot to update
- * @slot_nr: new number for slot
- *
- * The primary purpose of this interface is to allow callers who earlier
- * created a placeholder slot in pci_create_slot() by passing a -1 as
- * slot_nr, to update their %struct pci_slot with the correct @slot_nr.
- */
-void pci_renumber_slot(struct pci_slot *slot, int slot_nr)
-{
-	struct pci_slot *tmp;
-
-	down_write(&pci_bus_sem);
-
-	list_for_each_entry(tmp, &slot->bus->slots, list) {
-		WARN_ON(tmp->number == slot_nr);
-		goto out;
-	}
-
-	slot->number = slot_nr;
-out:
-	up_write(&pci_bus_sem);
-}
-EXPORT_SYMBOL_GPL(pci_renumber_slot);
-
-/**
  * pci_destroy_slot - decrement refcount for physical PCI slot
  * @slot: struct pci_slot to decrement
  *
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 583348275085..9d860912dd88 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -763,7 +763,6 @@ struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr,
 				 const char *name,
 				 struct hotplug_slot *hotplug);
 void pci_destroy_slot(struct pci_slot *slot);
-void pci_renumber_slot(struct pci_slot *slot, int slot_nr);
 int pci_scan_slot(struct pci_bus *bus, int devfn);
 struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn);
 void pci_device_add(struct pci_dev *dev, struct pci_bus *bus);


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v2 09/12] PCI: Remove unused alloc_pci_dev()
  2014-01-11  1:26 [PATCH v2 00/12] Remove dead code Bjorn Helgaas
                   ` (7 preceding siblings ...)
  2014-01-11  1:27 ` [PATCH v2 08/12] PCI: Remove unused pci_renumber_slot() Bjorn Helgaas
@ 2014-01-11  1:27 ` Bjorn Helgaas
  2014-01-11  1:27 ` [PATCH v2 10/12] PCI: Make local functions static Bjorn Helgaas
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Bjorn Helgaas @ 2014-01-11  1:27 UTC (permalink / raw)
  To: Stephen Hemminger, linux-pci; +Cc: Yu Zhao

From: Stephen Hemminger <stephen@networkplumber.org>

My philosophy is unused code is dead code.  And dead code is subject to bit
rot and is a likely source of bugs.  Use it or lose it.

This removes this unused and deprecated interface:

    alloc_pci_dev()

[bhelgaas: split to separate patch]
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/probe.c |    6 ------
 include/linux/pci.h |    1 -
 2 files changed, 7 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 38e403dddf6e..a4f53b677185 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1242,12 +1242,6 @@ struct pci_dev *pci_alloc_dev(struct pci_bus *bus)
 }
 EXPORT_SYMBOL(pci_alloc_dev);
 
-struct pci_dev *alloc_pci_dev(void)
-{
-	return pci_alloc_dev(NULL);
-}
-EXPORT_SYMBOL(alloc_pci_dev);
-
 bool pci_bus_read_dev_vendor_id(struct pci_bus *bus, int devfn, u32 *l,
 				 int crs_timeout)
 {
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 9d860912dd88..da76c757d0ac 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -375,7 +375,6 @@ static inline struct pci_dev *pci_physfn(struct pci_dev *dev)
 }
 
 struct pci_dev *pci_alloc_dev(struct pci_bus *bus);
-struct pci_dev * __deprecated alloc_pci_dev(void);
 
 #define	to_pci_dev(n) container_of(n, struct pci_dev, dev)
 #define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL)


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v2 10/12] PCI: Make local functions static
  2014-01-11  1:26 [PATCH v2 00/12] Remove dead code Bjorn Helgaas
                   ` (8 preceding siblings ...)
  2014-01-11  1:27 ` [PATCH v2 09/12] PCI: Remove unused alloc_pci_dev() Bjorn Helgaas
@ 2014-01-11  1:27 ` Bjorn Helgaas
  2014-01-11  1:28 ` [PATCH v2 11/12] PCI: Reorder pci.h so actual interfaces come before stubs Bjorn Helgaas
  2014-01-11  1:28 ` [PATCH v2 12/12] PCI: Cleanup pci.h whitespace Bjorn Helgaas
  11 siblings, 0 replies; 15+ messages in thread
From: Bjorn Helgaas @ 2014-01-11  1:27 UTC (permalink / raw)
  To: Stephen Hemminger, linux-pci; +Cc: Yu Zhao

From: Stephen Hemminger <stephen@networkplumber.org>

Using 'make namespacecheck' identify code which should be declared static.
Checked for users in other driver/archs as well.  Compile tested only.

This stops exporting the following interfaces to modules:

    pci_target_state()
    pci_load_saved_state()

[bhelgaas: retained pci_find_next_ext_capability() and pci_cfg_space_size()]
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/hotplug/pciehp.h      |    1 
 drivers/pci/hotplug/pciehp_core.c |    2 -
 drivers/pci/pci.c                 |   54 +++++++++---------
 drivers/pci/pci.h                 |    2 -
 drivers/pci/probe.c               |  111 +++++++++++++++++++------------------
 include/linux/pci.h               |    5 --
 6 files changed, 84 insertions(+), 91 deletions(-)

diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h
index 21e865ded1dc..8de88b052715 100644
--- a/drivers/pci/hotplug/pciehp.h
+++ b/drivers/pci/hotplug/pciehp.h
@@ -43,7 +43,6 @@
 extern bool pciehp_poll_mode;
 extern int pciehp_poll_time;
 extern bool pciehp_debug;
-extern bool pciehp_force;
 
 #define dbg(format, arg...)						\
 do {									\
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c
index bbd48bbe4e9b..67cbd3e90ffd 100644
--- a/drivers/pci/hotplug/pciehp_core.c
+++ b/drivers/pci/hotplug/pciehp_core.c
@@ -41,7 +41,7 @@
 bool pciehp_debug;
 bool pciehp_poll_mode;
 int pciehp_poll_time;
-bool pciehp_force;
+static bool pciehp_force;
 
 #define DRIVER_VERSION	"0.4"
 #define DRIVER_AUTHOR	"Dan Zink <dan.zink@compaq.com>, Greg Kroah-Hartman <greg@kroah.com>, Dely Sy <dely.l.sy@intel.com>"
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 730471a74fba..57529ffdff20 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -657,6 +657,28 @@ static int pci_platform_power_transition(struct pci_dev *dev, pci_power_t state)
 }
 
 /**
+ * pci_wakeup - Wake up a PCI device
+ * @pci_dev: Device to handle.
+ * @ign: ignored parameter
+ */
+static int pci_wakeup(struct pci_dev *pci_dev, void *ign)
+{
+	pci_wakeup_event(pci_dev);
+	pm_request_resume(&pci_dev->dev);
+	return 0;
+}
+
+/**
+ * pci_wakeup_bus - Walk given bus and wake up devices on it
+ * @bus: Top bus of the subtree to walk.
+ */
+static void pci_wakeup_bus(struct pci_bus *bus)
+{
+	if (bus)
+		pci_walk_bus(bus, pci_wakeup, NULL);
+}
+
+/**
  * __pci_start_power_transition - Start power transition of a PCI device
  * @dev: PCI device to handle.
  * @state: State to put the device into.
@@ -835,8 +857,8 @@ EXPORT_SYMBOL(pci_choose_state);
 #define PCI_EXP_SAVE_REGS	7
 
 
-static struct pci_cap_saved_state *pci_find_saved_cap(
-	struct pci_dev *pci_dev, char cap)
+static struct pci_cap_saved_state *pci_find_saved_cap(struct pci_dev *pci_dev,
+						      char cap)
 {
 	struct pci_cap_saved_state *tmp;
 
@@ -1071,7 +1093,8 @@ EXPORT_SYMBOL_GPL(pci_store_saved_state);
  * @dev: PCI device that we're dealing with
  * @state: Saved state returned from pci_store_saved_state()
  */
-int pci_load_saved_state(struct pci_dev *dev, struct pci_saved_state *state)
+static int pci_load_saved_state(struct pci_dev *dev,
+				struct pci_saved_state *state)
 {
 	struct pci_cap_saved_data *cap;
 
@@ -1099,7 +1122,6 @@ int pci_load_saved_state(struct pci_dev *dev, struct pci_saved_state *state)
 	dev->state_saved = true;
 	return 0;
 }
-EXPORT_SYMBOL_GPL(pci_load_saved_state);
 
 /**
  * pci_load_and_free_saved_state - Reload the save state pointed to by state,
@@ -1531,27 +1553,6 @@ void pci_pme_wakeup_bus(struct pci_bus *bus)
 		pci_walk_bus(bus, pci_pme_wakeup, (void *)true);
 }
 
-/**
- * pci_wakeup - Wake up a PCI device
- * @pci_dev: Device to handle.
- * @ign: ignored parameter
- */
-static int pci_wakeup(struct pci_dev *pci_dev, void *ign)
-{
-	pci_wakeup_event(pci_dev);
-	pm_request_resume(&pci_dev->dev);
-	return 0;
-}
-
-/**
- * pci_wakeup_bus - Walk given bus and wake up devices on it
- * @bus: Top bus of the subtree to walk.
- */
-void pci_wakeup_bus(struct pci_bus *bus)
-{
-	if (bus)
-		pci_walk_bus(bus, pci_wakeup, NULL);
-}
 
 /**
  * pci_pme_capable - check the capability of PCI device to generate PME#
@@ -1765,7 +1766,7 @@ int pci_wake_from_d3(struct pci_dev *dev, bool enable)
  * If the platform can't manage @dev, return the deepest state from which it
  * can generate wake events, based on any available PME info.
  */
-pci_power_t pci_target_state(struct pci_dev *dev)
+static pci_power_t pci_target_state(struct pci_dev *dev)
 {
 	pci_power_t target_state = PCI_D3hot;
 
@@ -4160,7 +4161,6 @@ EXPORT_SYMBOL(pci_restore_state);
 EXPORT_SYMBOL(pci_pme_capable);
 EXPORT_SYMBOL(pci_pme_active);
 EXPORT_SYMBOL(pci_wake_from_d3);
-EXPORT_SYMBOL(pci_target_state);
 EXPORT_SYMBOL(pci_prepare_to_sleep);
 EXPORT_SYMBOL(pci_back_from_sleep);
 EXPORT_SYMBOL_GPL(pci_set_pcie_reset_state);
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 9c91ecc1301b..4df38df224f4 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -6,7 +6,6 @@
 #define PCI_CFG_SPACE_SIZE	256
 #define PCI_CFG_SPACE_EXP_SIZE	4096
 
-extern const unsigned char pcix_bus_speed[];
 extern const unsigned char pcie_link_speed[];
 
 /* Functions internal to the PCI core code */
@@ -68,7 +67,6 @@ void pci_power_up(struct pci_dev *dev);
 void pci_disable_enabled_device(struct pci_dev *dev);
 int pci_finish_runtime_suspend(struct pci_dev *dev);
 int __pci_pme_wakeup(struct pci_dev *dev, void *ign);
-void pci_wakeup_bus(struct pci_bus *bus);
 void pci_config_pm_runtime_get(struct pci_dev *dev);
 void pci_config_pm_runtime_put(struct pci_dev *dev);
 void pci_pm_init(struct pci_dev *dev);
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index a4f53b677185..7fef23ba6bc6 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -16,7 +16,7 @@
 #define CARDBUS_LATENCY_TIMER	176	/* secondary latency timer */
 #define CARDBUS_RESERVE_BUSNR	3
 
-struct resource busn_resource = {
+static struct resource busn_resource = {
 	.name	= "PCI busn",
 	.start	= 0,
 	.end	= 255,
@@ -518,7 +518,7 @@ static struct pci_host_bridge *pci_alloc_host_bridge(struct pci_bus *b)
 	return bridge;
 }
 
-const unsigned char pcix_bus_speed[] = {
+static const unsigned char pcix_bus_speed[] = {
 	PCI_SPEED_UNKNOWN,		/* 0 */
 	PCI_SPEED_66MHz_PCIX,		/* 1 */
 	PCI_SPEED_100MHz_PCIX,		/* 2 */
@@ -999,6 +999,60 @@ void set_pcie_hotplug_bridge(struct pci_dev *pdev)
 		pdev->is_hotplug_bridge = 1;
 }
 
+
+/**
+ * pci_cfg_space_size - get the configuration space size of the PCI device.
+ * @dev: PCI device
+ *
+ * Regular PCI devices have 256 bytes, but PCI-X 2 and PCI Express devices
+ * have 4096 bytes.  Even if the device is capable, that doesn't mean we can
+ * access it.  Maybe we don't have a way to generate extended config space
+ * accesses, or the device is behind a reverse Express bridge.  So we try
+ * reading the dword at 0x100 which must either be 0 or a valid extended
+ * capability header.
+ */
+static int pci_cfg_space_size_ext(struct pci_dev *dev)
+{
+	u32 status;
+	int pos = PCI_CFG_SPACE_SIZE;
+
+	if (pci_read_config_dword(dev, pos, &status) != PCIBIOS_SUCCESSFUL)
+		goto fail;
+	if (status == 0xffffffff)
+		goto fail;
+
+	return PCI_CFG_SPACE_EXP_SIZE;
+
+ fail:
+	return PCI_CFG_SPACE_SIZE;
+}
+
+int pci_cfg_space_size(struct pci_dev *dev)
+{
+	int pos;
+	u32 status;
+	u16 class;
+
+	class = dev->class >> 8;
+	if (class == PCI_CLASS_BRIDGE_HOST)
+		return pci_cfg_space_size_ext(dev);
+
+	if (!pci_is_pcie(dev)) {
+		pos = pci_find_capability(dev, PCI_CAP_ID_PCIX);
+		if (!pos)
+			goto fail;
+
+		pci_read_config_dword(dev, pos + PCI_X_STATUS, &status);
+		if (!(status & (PCI_X_STATUS_266MHZ | PCI_X_STATUS_533MHZ)))
+			goto fail;
+	}
+
+	return pci_cfg_space_size_ext(dev);
+
+ fail:
+	return PCI_CFG_SPACE_SIZE;
+}
+
 #define LEGACY_IO_RESOURCE	(IORESOURCE_IO | IORESOURCE_PCI_FIXED)
 
 /**
@@ -1173,59 +1227,6 @@ static void pci_release_dev(struct device *dev)
 	kfree(pci_dev);
 }
 
-/**
- * pci_cfg_space_size - get the configuration space size of the PCI device.
- * @dev: PCI device
- *
- * Regular PCI devices have 256 bytes, but PCI-X 2 and PCI Express devices
- * have 4096 bytes.  Even if the device is capable, that doesn't mean we can
- * access it.  Maybe we don't have a way to generate extended config space
- * accesses, or the device is behind a reverse Express bridge.  So we try
- * reading the dword at 0x100 which must either be 0 or a valid extended
- * capability header.
- */
-int pci_cfg_space_size_ext(struct pci_dev *dev)
-{
-	u32 status;
-	int pos = PCI_CFG_SPACE_SIZE;
-
-	if (pci_read_config_dword(dev, pos, &status) != PCIBIOS_SUCCESSFUL)
-		goto fail;
-	if (status == 0xffffffff)
-		goto fail;
-
-	return PCI_CFG_SPACE_EXP_SIZE;
-
- fail:
-	return PCI_CFG_SPACE_SIZE;
-}
-
-int pci_cfg_space_size(struct pci_dev *dev)
-{
-	int pos;
-	u32 status;
-	u16 class;
-
-	class = dev->class >> 8;
-	if (class == PCI_CLASS_BRIDGE_HOST)
-		return pci_cfg_space_size_ext(dev);
-
-	if (!pci_is_pcie(dev)) {
-		pos = pci_find_capability(dev, PCI_CAP_ID_PCIX);
-		if (!pos)
-			goto fail;
-
-		pci_read_config_dword(dev, pos + PCI_X_STATUS, &status);
-		if (!(status & (PCI_X_STATUS_266MHZ | PCI_X_STATUS_533MHZ)))
-			goto fail;
-	}
-
-	return pci_cfg_space_size_ext(dev);
-
- fail:
-	return PCI_CFG_SPACE_SIZE;
-}
-
 struct pci_dev *pci_alloc_dev(struct pci_bus *bus)
 {
 	struct pci_dev *dev;
diff --git a/include/linux/pci.h b/include/linux/pci.h
index da76c757d0ac..169ef1944d14 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -384,8 +384,6 @@ static inline int pci_channel_offline(struct pci_dev *pdev)
 	return (pdev->error_state != pci_channel_io_normal);
 }
 
-extern struct resource busn_resource;
-
 struct pci_host_bridge_window {
 	struct list_head list;
 	struct resource *res;		/* host bridge aperture (CPU address) */
@@ -971,7 +969,6 @@ void __iomem __must_check *pci_platform_rom(struct pci_dev *pdev, size_t *size);
 int pci_save_state(struct pci_dev *dev);
 void pci_restore_state(struct pci_dev *dev);
 struct pci_saved_state *pci_store_saved_state(struct pci_dev *dev);
-int pci_load_saved_state(struct pci_dev *dev, struct pci_saved_state *state);
 int pci_load_and_free_saved_state(struct pci_dev *dev,
 				  struct pci_saved_state **state);
 int __pci_complete_power_transition(struct pci_dev *dev, pci_power_t state);
@@ -982,7 +979,6 @@ void pci_pme_active(struct pci_dev *dev, bool enable);
 int __pci_enable_wake(struct pci_dev *dev, pci_power_t state,
 		      bool runtime, bool enable);
 int pci_wake_from_d3(struct pci_dev *dev, bool enable);
-pci_power_t pci_target_state(struct pci_dev *dev);
 int pci_prepare_to_sleep(struct pci_dev *dev);
 int pci_back_from_sleep(struct pci_dev *dev);
 bool pci_dev_run_wake(struct pci_dev *dev);
@@ -1093,7 +1089,6 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max,
 
 void pci_walk_bus(struct pci_bus *top, int (*cb)(struct pci_dev *, void *),
 		  void *userdata);
-int pci_cfg_space_size_ext(struct pci_dev *dev);
 int pci_cfg_space_size(struct pci_dev *dev);
 unsigned char pci_bus_max_busnr(struct pci_bus *bus);
 void pci_setup_bridge(struct pci_bus *bus);


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v2 11/12] PCI: Reorder pci.h so actual interfaces come before stubs
  2014-01-11  1:26 [PATCH v2 00/12] Remove dead code Bjorn Helgaas
                   ` (9 preceding siblings ...)
  2014-01-11  1:27 ` [PATCH v2 10/12] PCI: Make local functions static Bjorn Helgaas
@ 2014-01-11  1:28 ` Bjorn Helgaas
  2014-01-11  1:28 ` [PATCH v2 12/12] PCI: Cleanup pci.h whitespace Bjorn Helgaas
  11 siblings, 0 replies; 15+ messages in thread
From: Bjorn Helgaas @ 2014-01-11  1:28 UTC (permalink / raw)
  To: Stephen Hemminger, linux-pci; +Cc: Yu Zhao

Consistently use the:

    #ifdef CONFIG_PCI_FOO
    int pci_foo(...);
    #else
    static inline int pci_foo(...) { return -1; }
    #endif

pattern, instead of sometimes using "#ifndef CONFIG_PCI_FOO".

No functional change.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 include/linux/pci.h |   43 ++++++++++++++++++++-----------------------
 1 file changed, 20 insertions(+), 23 deletions(-)

diff --git a/include/linux/pci.h b/include/linux/pci.h
index 169ef1944d14..9da6a0cf2776 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1127,7 +1127,19 @@ struct msix_entry {
 };
 
 
-#ifndef CONFIG_PCI_MSI
+#ifdef CONFIG_PCI_MSI
+int pci_enable_msi_block(struct pci_dev *dev, unsigned int nvec);
+int pci_enable_msi_block_auto(struct pci_dev *dev, unsigned int *maxvec);
+void pci_msi_shutdown(struct pci_dev *dev);
+void pci_disable_msi(struct pci_dev *dev);
+int pci_msix_table_size(struct pci_dev *dev);
+int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec);
+void pci_msix_shutdown(struct pci_dev *dev);
+void pci_disable_msix(struct pci_dev *dev);
+void msi_remove_pci_irq_vectors(struct pci_dev *dev);
+void pci_restore_msi_state(struct pci_dev *dev);
+int pci_msi_enabled(void);
+#else
 static inline int pci_enable_msi_block(struct pci_dev *dev, unsigned int nvec)
 {
 	return -1;
@@ -1168,18 +1180,6 @@ static inline int pci_msi_enabled(void)
 {
 	return 0;
 }
-#else
-int pci_enable_msi_block(struct pci_dev *dev, unsigned int nvec);
-int pci_enable_msi_block_auto(struct pci_dev *dev, unsigned int *maxvec);
-void pci_msi_shutdown(struct pci_dev *dev);
-void pci_disable_msi(struct pci_dev *dev);
-int pci_msix_table_size(struct pci_dev *dev);
-int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec);
-void pci_msix_shutdown(struct pci_dev *dev);
-void pci_disable_msix(struct pci_dev *dev);
-void msi_remove_pci_irq_vectors(struct pci_dev *dev);
-void pci_restore_msi_state(struct pci_dev *dev);
-int pci_msi_enabled(void);
 #endif
 
 #ifdef CONFIG_PCIEPORTBUS
@@ -1190,10 +1190,10 @@ extern bool pcie_ports_auto;
 #define pcie_ports_auto		false
 #endif
 
-#ifndef CONFIG_PCIEASPM
-static inline bool pcie_aspm_support_enabled(void) { return false; }
-#else
+#ifdef CONFIG_PCIEASPM
 bool pcie_aspm_support_enabled(void);
+#else
+static inline bool pcie_aspm_support_enabled(void) { return false; }
 #endif
 
 #ifdef CONFIG_PCIEAER
@@ -1204,15 +1204,12 @@ static inline void pci_no_aer(void) { }
 static inline bool pci_aer_available(void) { return false; }
 #endif
 
-#ifndef CONFIG_PCIE_ECRC
-static inline void pcie_set_ecrc_checking(struct pci_dev *dev)
-{
-	return;
-}
-static inline void pcie_ecrc_get_policy(char *str) {};
-#else
+#ifdef CONFIG_PCIE_ECRC
 void pcie_set_ecrc_checking(struct pci_dev *dev);
 void pcie_ecrc_get_policy(char *str);
+#else
+static inline void pcie_set_ecrc_checking(struct pci_dev *dev) { }
+static inline void pcie_ecrc_get_policy(char *str) { }
 #endif
 
 #define pci_enable_msi(pdev)	pci_enable_msi_block(pdev, 1)


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v2 12/12] PCI: Cleanup pci.h whitespace
  2014-01-11  1:26 [PATCH v2 00/12] Remove dead code Bjorn Helgaas
                   ` (10 preceding siblings ...)
  2014-01-11  1:28 ` [PATCH v2 11/12] PCI: Reorder pci.h so actual interfaces come before stubs Bjorn Helgaas
@ 2014-01-11  1:28 ` Bjorn Helgaas
  11 siblings, 0 replies; 15+ messages in thread
From: Bjorn Helgaas @ 2014-01-11  1:28 UTC (permalink / raw)
  To: Stephen Hemminger, linux-pci; +Cc: Yu Zhao

Put empty or trivial inline stub functions on one line when they fit.  No
functional change.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 include/linux/pci.h |   41 ++++++++++-------------------------------
 1 file changed, 10 insertions(+), 31 deletions(-)

diff --git a/include/linux/pci.h b/include/linux/pci.h
index 9da6a0cf2776..55ecc0aae669 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1151,35 +1151,21 @@ pci_enable_msi_block_auto(struct pci_dev *dev, unsigned int *maxvec)
 	return -1;
 }
 
-static inline void pci_msi_shutdown(struct pci_dev *dev)
-{ }
-static inline void pci_disable_msi(struct pci_dev *dev)
-{ }
+static inline void pci_msi_shutdown(struct pci_dev *dev) { }
+static inline void pci_disable_msi(struct pci_dev *dev) { }
 
-static inline int pci_msix_table_size(struct pci_dev *dev)
-{
-	return 0;
-}
+static inline int pci_msix_table_size(struct pci_dev *dev) { return 0; }
 static inline int pci_enable_msix(struct pci_dev *dev,
 				  struct msix_entry *entries, int nvec)
 {
 	return -1;
 }
 
-static inline void pci_msix_shutdown(struct pci_dev *dev)
-{ }
-static inline void pci_disable_msix(struct pci_dev *dev)
-{ }
-
-static inline void msi_remove_pci_irq_vectors(struct pci_dev *dev)
-{ }
-
-static inline void pci_restore_msi_state(struct pci_dev *dev)
-{ }
-static inline int pci_msi_enabled(void)
-{
-	return 0;
-}
+static inline void pci_msix_shutdown(struct pci_dev *dev) { }
+static inline void pci_disable_msix(struct pci_dev *dev) { }
+static inline void msi_remove_pci_irq_vectors(struct pci_dev *dev) { }
+static inline void pci_restore_msi_state(struct pci_dev *dev) { }
+static inline int pci_msi_enabled(void) { return 0; }
 #endif
 
 #ifdef CONFIG_PCIEPORTBUS
@@ -1233,15 +1219,8 @@ void pci_cfg_access_unlock(struct pci_dev *dev);
 extern int pci_domains_supported;
 #else
 enum { pci_domains_supported = 0 };
-static inline int pci_domain_nr(struct pci_bus *bus)
-{
-	return 0;
-}
-
-static inline int pci_proc_domain(struct pci_bus *bus)
-{
-	return 0;
-}
+static inline int pci_domain_nr(struct pci_bus *bus) { return 0; }
+static inline int pci_proc_domain(struct pci_bus *bus) { return 0; }
 #endif /* CONFIG_PCI_DOMAINS */
 
 /* some architectures require additional setup to direct VGA traffic */


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 05/12] PCI: Remove unused exclusive region support
  2014-01-11  1:27 ` [PATCH v2 05/12] PCI: Remove unused exclusive region support Bjorn Helgaas
@ 2014-01-13 18:12   ` Bjorn Helgaas
  0 siblings, 0 replies; 15+ messages in thread
From: Bjorn Helgaas @ 2014-01-13 18:12 UTC (permalink / raw)
  To: Stephen Hemminger, linux-pci; +Cc: Yu Zhao, Arjan van de Ven

On Fri, Jan 10, 2014 at 6:27 PM, Bjorn Helgaas <bhelgaas@google.com> wrote:
> From: Stephen Hemminger <stephen@networkplumber.org>
>
> My philosophy is unused code is dead code.  And dead code is subject to bit
> rot and is a likely source of bugs.  Use it or lose it.
>
> This reverts part of e8de1481fd71 ("resource: allow MMIO exclusivity for
> device drivers"), removing these interfaces:
>
>     pci_request_region_exclusive()
>     pci_request_regions_exclusive()
>
> [bhelgaas: split to separate patch, also remove prototypes from pci.h]
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> CC: Arjan van de Ven <arjan@linux.intel.com>

I think I'm going to drop this patch for now and propose that we
instead revert e8de1481fd71 completely.  As far as I can tell, e1000e
is the only driver that  uses any of this, and that's only because of
the bug hunt, not because e1000e is special in any way.

Bjorn

> ---
>  drivers/pci/pci.c   |   46 ----------------------------------------------
>  include/linux/pci.h |    2 --
>  2 files changed, 48 deletions(-)
>
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 6db2f1a441e9..730471a74fba 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -2443,28 +2443,6 @@ int pci_request_region(struct pci_dev *pdev, int bar, const char *res_name)
>  }
>
>  /**
> - *     pci_request_region_exclusive - Reserved PCI I/O and memory resource
> - *     @pdev: PCI device whose resources are to be reserved
> - *     @bar: BAR to be reserved
> - *     @res_name: Name to be associated with resource.
> - *
> - *     Mark the PCI region associated with PCI device @pdev BR @bar as
> - *     being reserved by owner @res_name.  Do not access any
> - *     address inside the PCI regions unless this call returns
> - *     successfully.
> - *
> - *     Returns 0 on success, or %EBUSY on error.  A warning
> - *     message is also printed on failure.
> - *
> - *     The key difference that _exclusive makes it that userspace is
> - *     explicitly not allowed to map the resource via /dev/mem or
> - *     sysfs.
> - */
> -int pci_request_region_exclusive(struct pci_dev *pdev, int bar, const char *res_name)
> -{
> -       return __pci_request_region(pdev, bar, res_name, IORESOURCE_EXCLUSIVE);
> -}
> -/**
>   * pci_release_selected_regions - Release selected PCI I/O and memory resources
>   * @pdev: PCI device whose resources were previously reserved
>   * @bars: Bitmask of BARs to be released
> @@ -2552,28 +2530,6 @@ int pci_request_regions(struct pci_dev *pdev, const char *res_name)
>         return pci_request_selected_regions(pdev, ((1 << 6) - 1), res_name);
>  }
>
> -/**
> - *     pci_request_regions_exclusive - Reserved PCI I/O and memory resources
> - *     @pdev: PCI device whose resources are to be reserved
> - *     @res_name: Name to be associated with resource.
> - *
> - *     Mark all PCI regions associated with PCI device @pdev as
> - *     being reserved by owner @res_name.  Do not access any
> - *     address inside the PCI regions unless this call returns
> - *     successfully.
> - *
> - *     pci_request_regions_exclusive() will mark the region so that
> - *     /dev/mem and the sysfs MMIO access will not be allowed.
> - *
> - *     Returns 0 on success, or %EBUSY on error.  A warning
> - *     message is also printed on failure.
> - */
> -int pci_request_regions_exclusive(struct pci_dev *pdev, const char *res_name)
> -{
> -       return pci_request_selected_regions_exclusive(pdev,
> -                                       ((1 << 6) - 1), res_name);
> -}
> -
>  static void __pci_set_master(struct pci_dev *dev, bool enable)
>  {
>         u16 old_cmd, cmd;
> @@ -4183,10 +4139,8 @@ EXPORT_SYMBOL(pci_find_capability);
>  EXPORT_SYMBOL(pci_bus_find_capability);
>  EXPORT_SYMBOL(pci_release_regions);
>  EXPORT_SYMBOL(pci_request_regions);
> -EXPORT_SYMBOL(pci_request_regions_exclusive);
>  EXPORT_SYMBOL(pci_release_region);
>  EXPORT_SYMBOL(pci_request_region);
> -EXPORT_SYMBOL(pci_request_region_exclusive);
>  EXPORT_SYMBOL(pci_release_selected_regions);
>  EXPORT_SYMBOL(pci_request_selected_regions);
>  EXPORT_SYMBOL(pci_request_selected_regions_exclusive);
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index f2284f1332db..efd0b8b67705 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -1026,10 +1026,8 @@ void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *),
>                     int (*)(const struct pci_dev *, u8, u8));
>  #define HAVE_PCI_REQ_REGIONS   2
>  int __must_check pci_request_regions(struct pci_dev *, const char *);
> -int __must_check pci_request_regions_exclusive(struct pci_dev *, const char *);
>  void pci_release_regions(struct pci_dev *);
>  int __must_check pci_request_region(struct pci_dev *, int, const char *);
> -int __must_check pci_request_region_exclusive(struct pci_dev *, int, const char *);
>  void pci_release_region(struct pci_dev *, int);
>  int pci_request_selected_regions(struct pci_dev *, int, const char *);
>  int pci_request_selected_regions_exclusive(struct pci_dev *, int, const char *);
>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 08/12] PCI: Remove unused pci_renumber_slot()
  2014-01-11  1:27 ` [PATCH v2 08/12] PCI: Remove unused pci_renumber_slot() Bjorn Helgaas
@ 2014-01-13 18:43   ` Alex Chiang
  0 siblings, 0 replies; 15+ messages in thread
From: Alex Chiang @ 2014-01-13 18:43 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: Stephen Hemminger, linux-pci, Yu Zhao

On Fri, Jan 10, 2014 at 5:27 PM, Bjorn Helgaas <bhelgaas@google.com> wrote:
> From: Stephen Hemminger <stephen@networkplumber.org>
>
> My philosophy is unused code is dead code.  And dead code is subject to bit
> rot and is a likely source of bugs.  Use it or lose it.
>
> This reverts part of f46753c5e354 ("PCI: introduce pci_slot") and
> d25b7c8d6ba2 ("PCI: rename pci_update_slot_number to pci_renumber_slot"),
> removing this interface:
>
>     pci_renumber_slot()
>
> [bhelgaas: split to separate patch]
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> CC: Alex Chiang <achiang@canonical.com>
> ---
>  drivers/pci/slot.c  |   26 --------------------------
>  include/linux/pci.h |    1 -
>  2 files changed, 27 deletions(-)
>
> diff --git a/drivers/pci/slot.c b/drivers/pci/slot.c
> index 448ca562d1f8..7dd62fa9d0bd 100644
> --- a/drivers/pci/slot.c
> +++ b/drivers/pci/slot.c
> @@ -320,32 +320,6 @@ err:
>  EXPORT_SYMBOL_GPL(pci_create_slot);
>
>  /**
> - * pci_renumber_slot - update %struct pci_slot -> number
> - * @slot: &struct pci_slot to update
> - * @slot_nr: new number for slot
> - *
> - * The primary purpose of this interface is to allow callers who earlier
> - * created a placeholder slot in pci_create_slot() by passing a -1 as
> - * slot_nr, to update their %struct pci_slot with the correct @slot_nr.
> - */

Reference to why this code/interface was originally thought to be needed:

https://lkml.org/lkml/2008/10/9/58

But anyway, if no one is using the interface, then I agree to kill it.

Acked-by: Alex Chiang <achiang@canonical.com>


> -void pci_renumber_slot(struct pci_slot *slot, int slot_nr)
> -{
> -       struct pci_slot *tmp;
> -
> -       down_write(&pci_bus_sem);
> -
> -       list_for_each_entry(tmp, &slot->bus->slots, list) {
> -               WARN_ON(tmp->number == slot_nr);
> -               goto out;
> -       }
> -
> -       slot->number = slot_nr;
> -out:
> -       up_write(&pci_bus_sem);
> -}
> -EXPORT_SYMBOL_GPL(pci_renumber_slot);
> -
> -/**
>   * pci_destroy_slot - decrement refcount for physical PCI slot
>   * @slot: struct pci_slot to decrement
>   *
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index 583348275085..9d860912dd88 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -763,7 +763,6 @@ struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr,
>                                  const char *name,
>                                  struct hotplug_slot *hotplug);
>  void pci_destroy_slot(struct pci_slot *slot);
> -void pci_renumber_slot(struct pci_slot *slot, int slot_nr);
>  int pci_scan_slot(struct pci_bus *bus, int devfn);
>  struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn);
>  void pci_device_add(struct pci_dev *dev, struct pci_bus *bus);
>

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2014-01-13 18:43 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-11  1:26 [PATCH v2 00/12] Remove dead code Bjorn Helgaas
2014-01-11  1:26 ` [PATCH v2 01/12] PCI: Removed unused parts of Page Request Interface support Bjorn Helgaas
2014-01-11  1:26 ` [PATCH v2 02/12] PCI: Remove unused Latency Tolerance Reporting support Bjorn Helgaas
2014-01-11  1:27 ` [PATCH v2 03/12] PCI: Remove unused Optimized Buffer Flush/Fill support Bjorn Helgaas
2014-01-11  1:27 ` [PATCH v2 04/12] PCI: Remove unused ID-Based Ordering support Bjorn Helgaas
2014-01-11  1:27 ` [PATCH v2 05/12] PCI: Remove unused exclusive region support Bjorn Helgaas
2014-01-13 18:12   ` Bjorn Helgaas
2014-01-11  1:27 ` [PATCH v2 06/12] PCI: Remove unused pci_vpd_truncate() Bjorn Helgaas
2014-01-11  1:27 ` [PATCH v2 07/12] PCI: Remove unused pcie_aspm_enabled() Bjorn Helgaas
2014-01-11  1:27 ` [PATCH v2 08/12] PCI: Remove unused pci_renumber_slot() Bjorn Helgaas
2014-01-13 18:43   ` Alex Chiang
2014-01-11  1:27 ` [PATCH v2 09/12] PCI: Remove unused alloc_pci_dev() Bjorn Helgaas
2014-01-11  1:27 ` [PATCH v2 10/12] PCI: Make local functions static Bjorn Helgaas
2014-01-11  1:28 ` [PATCH v2 11/12] PCI: Reorder pci.h so actual interfaces come before stubs Bjorn Helgaas
2014-01-11  1:28 ` [PATCH v2 12/12] PCI: Cleanup pci.h whitespace Bjorn Helgaas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.