aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/pcie
diff options
context:
space:
mode:
authorKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>2009-11-25 07:00:53 -0500
committerJesse Barnes <jbarnes@virtuousgeek.org>2009-12-04 18:55:12 -0500
commit898294c97500b1cdff6edce52fd34e024eb070ec (patch)
tree0f5faec54c06f3775c164b48a1c48659c6ceeb4c /drivers/pci/pcie
parent59353ea30e65ab3ae181d6175e3212e1361c3787 (diff)
PCI: portdrv: remove redundant pcie_port_device_probe
We don't need pcie_port_device_probe() because we can get pci device/port type using pci_is_pcie() and 'pcie_type' fields in struct pci_dev. Remove pcie_port_device_probe(). Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci/pcie')
-rw-r--r--drivers/pci/pcie/portdrv.h1
-rw-r--r--drivers/pci/pcie/portdrv_core.c22
-rw-r--r--drivers/pci/pcie/portdrv_pci.c14
3 files changed, 8 insertions, 29 deletions
diff --git a/drivers/pci/pcie/portdrv.h b/drivers/pci/pcie/portdrv.h
index 17ad53868f9f..cc1f8435ee20 100644
--- a/drivers/pci/pcie/portdrv.h
+++ b/drivers/pci/pcie/portdrv.h
@@ -35,7 +35,6 @@
35#define get_descriptor_id(type, service) (((type - 4) << 4) | service) 35#define get_descriptor_id(type, service) (((type - 4) << 4) | service)
36 36
37extern struct bus_type pcie_port_bus_type; 37extern struct bus_type pcie_port_bus_type;
38extern int pcie_port_device_probe(struct pci_dev *dev);
39extern int pcie_port_device_register(struct pci_dev *dev); 38extern int pcie_port_device_register(struct pci_dev *dev);
40#ifdef CONFIG_PM 39#ifdef CONFIG_PM
41extern int pcie_port_device_suspend(struct device *dev); 40extern int pcie_port_device_suspend(struct device *dev);
diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c
index ce99c7121372..a0376f80bc5e 100644
--- a/drivers/pci/pcie/portdrv_core.c
+++ b/drivers/pci/pcie/portdrv_core.c
@@ -297,28 +297,6 @@ static struct pcie_device* alloc_pcie_device(struct pci_dev *parent,
297} 297}
298 298
299/** 299/**
300 * pcie_port_device_probe - check if device is a PCI Express port
301 * @dev: Device to check
302 */
303int pcie_port_device_probe(struct pci_dev *dev)
304{
305 int pos, type;
306 u16 reg;
307
308 pos = pci_pcie_cap(dev);
309 if (!pos)
310 return -ENODEV;
311
312 pci_read_config_word(dev, pos + PCIE_CAPABILITIES_REG, &reg);
313 type = (reg >> 4) & PORT_TYPE_MASK;
314 if ( type == PCIE_RC_PORT || type == PCIE_SW_UPSTREAM_PORT ||
315 type == PCIE_SW_DOWNSTREAM_PORT )
316 return 0;
317
318 return -ENODEV;
319}
320
321/**
322 * pcie_port_device_register - register PCI Express port 300 * pcie_port_device_register - register PCI Express port
323 * @dev: PCI Express port to register 301 * @dev: PCI Express port to register
324 * 302 *
diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c
index f635e476d632..ce52ea34fee5 100644
--- a/drivers/pci/pcie/portdrv_pci.c
+++ b/drivers/pci/pcie/portdrv_pci.c
@@ -67,14 +67,16 @@ static struct dev_pm_ops pcie_portdrv_pm_ops = {
67 * this port device. 67 * this port device.
68 * 68 *
69 */ 69 */
70static int __devinit pcie_portdrv_probe (struct pci_dev *dev, 70static int __devinit pcie_portdrv_probe(struct pci_dev *dev,
71 const struct pci_device_id *id ) 71 const struct pci_device_id *id)
72{ 72{
73 int status; 73 int status;
74 74
75 status = pcie_port_device_probe(dev); 75 if (!pci_is_pcie(dev) ||
76 if (status) 76 ((dev->pcie_type != PCI_EXP_TYPE_ROOT_PORT) &&
77 return status; 77 (dev->pcie_type != PCI_EXP_TYPE_UPSTREAM) &&
78 (dev->pcie_type != PCI_EXP_TYPE_DOWNSTREAM)))
79 return -ENODEV;
78 80
79 if (!dev->irq && dev->pin) { 81 if (!dev->irq && dev->pin) {
80 dev_warn(&dev->dev, "device [%04x:%04x] has invalid IRQ; " 82 dev_warn(&dev->dev, "device [%04x:%04x] has invalid IRQ; "