aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>2009-11-25 07:06:15 -0500
committerJesse Barnes <jbarnes@virtuousgeek.org>2009-12-04 18:56:19 -0500
commit694f88ef7ada0d99e304f687ba92e268a594358b (patch)
treef7095c20f3a6111947a0edaa99dfddd366dbf4b2 /drivers/pci
parent40717c39b1e6c064f48a263a27e58642221e8661 (diff)
PCI: portdrv: remove unnecessary struct pcie_port_data
Remove 'port_type' field in struct pcie_port_data(), because we can get port type information from struct pci_dev. With this change, this patch also does followings: - Remove struct pcie_port_data because it no longer has any field. - Remove portdrv private definitions about port type (PCIE_RC_PORT, PCIE_SW_UPSTREAM_PORT and PCIE_SW_DOWNSTREAM_PORT), and use generic definitions instead. Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/pcie/aer/aerdrv.c2
-rw-r--r--drivers/pci/pcie/aer/aerdrv_core.c11
-rw-r--r--drivers/pci/pcie/portdrv_bus.c7
-rw-r--r--drivers/pci/pcie/portdrv_core.c15
4 files changed, 9 insertions, 26 deletions
diff --git a/drivers/pci/pcie/aer/aerdrv.c b/drivers/pci/pcie/aer/aerdrv.c
index 6d30e795a10d..97a345927b55 100644
--- a/drivers/pci/pcie/aer/aerdrv.c
+++ b/drivers/pci/pcie/aer/aerdrv.c
@@ -53,7 +53,7 @@ static struct pci_error_handlers aer_error_handlers = {
53 53
54static struct pcie_port_service_driver aerdriver = { 54static struct pcie_port_service_driver aerdriver = {
55 .name = "aer", 55 .name = "aer",
56 .port_type = PCIE_RC_PORT, 56 .port_type = PCI_EXP_TYPE_ROOT_PORT,
57 .service = PCIE_PORT_SERVICE_AER, 57 .service = PCIE_PORT_SERVICE_AER,
58 58
59 .probe = aer_probe, 59 .probe = aer_probe,
diff --git a/drivers/pci/pcie/aer/aerdrv_core.c b/drivers/pci/pcie/aer/aerdrv_core.c
index 5391a9b412e5..2fbbcee033a7 100644
--- a/drivers/pci/pcie/aer/aerdrv_core.c
+++ b/drivers/pci/pcie/aer/aerdrv_core.c
@@ -123,9 +123,9 @@ static int set_device_error_reporting(struct pci_dev *dev, void *data)
123{ 123{
124 bool enable = *((bool *)data); 124 bool enable = *((bool *)data);
125 125
126 if (dev->pcie_type == PCIE_RC_PORT || 126 if ((dev->pcie_type == PCI_EXP_TYPE_ROOT_PORT) ||
127 dev->pcie_type == PCIE_SW_UPSTREAM_PORT || 127 (dev->pcie_type == PCI_EXP_TYPE_UPSTREAM) ||
128 dev->pcie_type == PCIE_SW_DOWNSTREAM_PORT) { 128 (dev->pcie_type == PCI_EXP_TYPE_DOWNSTREAM)) {
129 if (enable) 129 if (enable)
130 pci_enable_pcie_error_reporting(dev); 130 pci_enable_pcie_error_reporting(dev);
131 else 131 else
@@ -437,10 +437,9 @@ static int find_aer_service_iter(struct device *device, void *data)
437 result = (struct find_aer_service_data *) data; 437 result = (struct find_aer_service_data *) data;
438 438
439 if (device->bus == &pcie_port_bus_type) { 439 if (device->bus == &pcie_port_bus_type) {
440 struct pcie_port_data *port_data; 440 struct pcie_device *pcie = to_pcie_device(device);
441 441
442 port_data = pci_get_drvdata(to_pcie_device(device)->port); 442 if (pcie->port->pcie_type == PCI_EXP_TYPE_DOWNSTREAM)
443 if (port_data->port_type == PCIE_SW_DOWNSTREAM_PORT)
444 result->is_downstream = 1; 443 result->is_downstream = 1;
445 444
446 driver = device->driver; 445 driver = device->driver;
diff --git a/drivers/pci/pcie/portdrv_bus.c b/drivers/pci/pcie/portdrv_bus.c
index ef3a4eeaebb4..18bf90f748f6 100644
--- a/drivers/pci/pcie/portdrv_bus.c
+++ b/drivers/pci/pcie/portdrv_bus.c
@@ -26,7 +26,6 @@ EXPORT_SYMBOL_GPL(pcie_port_bus_type);
26static int pcie_port_bus_match(struct device *dev, struct device_driver *drv) 26static int pcie_port_bus_match(struct device *dev, struct device_driver *drv)
27{ 27{
28 struct pcie_device *pciedev; 28 struct pcie_device *pciedev;
29 struct pcie_port_data *port_data;
30 struct pcie_port_service_driver *driver; 29 struct pcie_port_service_driver *driver;
31 30
32 if (drv->bus != &pcie_port_bus_type || dev->bus != &pcie_port_bus_type) 31 if (drv->bus != &pcie_port_bus_type || dev->bus != &pcie_port_bus_type)
@@ -38,10 +37,8 @@ static int pcie_port_bus_match(struct device *dev, struct device_driver *drv)
38 if (driver->service != pciedev->service) 37 if (driver->service != pciedev->service)
39 return 0; 38 return 0;
40 39
41 port_data = pci_get_drvdata(pciedev->port); 40 if ((driver->port_type != PCIE_ANY_PORT) &&
42 41 (driver->port_type != pciedev->port->pcie_type))
43 if (driver->port_type != PCIE_ANY_PORT
44 && driver->port_type != port_data->port_type)
45 return 0; 42 return 0;
46 43
47 return 1; 44 return 1;
diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c
index 758e3d339287..9318b96bb255 100644
--- a/drivers/pci/pcie/portdrv_core.c
+++ b/drivers/pci/pcie/portdrv_core.c
@@ -296,7 +296,6 @@ static int pcie_device_init(struct pci_dev *pdev, int service, int irq)
296 */ 296 */
297int pcie_port_device_register(struct pci_dev *dev) 297int pcie_port_device_register(struct pci_dev *dev)
298{ 298{
299 struct pcie_port_data *port_data;
300 int status, capabilities, i, nr_service; 299 int status, capabilities, i, nr_service;
301 int irqs[PCIE_PORT_DEVICE_MAXSERVICES]; 300 int irqs[PCIE_PORT_DEVICE_MAXSERVICES];
302 301
@@ -305,17 +304,10 @@ int pcie_port_device_register(struct pci_dev *dev)
305 if (!capabilities) 304 if (!capabilities)
306 return -ENODEV; 305 return -ENODEV;
307 306
308 /* Allocate driver data for port device */
309 port_data = kzalloc(sizeof(*port_data), GFP_KERNEL);
310 if (!port_data)
311 return -ENOMEM;
312 port_data->port_type = dev->pcie_type;
313 pci_set_drvdata(dev, port_data);
314
315 /* Enable PCI Express port device */ 307 /* Enable PCI Express port device */
316 status = pci_enable_device(dev); 308 status = pci_enable_device(dev);
317 if (status) 309 if (status)
318 goto error_kfree; 310 return status;
319 pci_set_master(dev); 311 pci_set_master(dev);
320 /* 312 /*
321 * Initialize service irqs. Don't use service devices that 313 * Initialize service irqs. Don't use service devices that
@@ -347,8 +339,6 @@ error_cleanup_irqs:
347 cleanup_service_irqs(dev); 339 cleanup_service_irqs(dev);
348error_disable: 340error_disable:
349 pci_disable_device(dev); 341 pci_disable_device(dev);
350error_kfree:
351 kfree(port_data);
352 return status; 342 return status;
353} 343}
354 344
@@ -416,12 +406,9 @@ static int remove_iter(struct device *dev, void *data)
416 */ 406 */
417void pcie_port_device_remove(struct pci_dev *dev) 407void pcie_port_device_remove(struct pci_dev *dev)
418{ 408{
419 struct pcie_port_data *port_data = pci_get_drvdata(dev);
420
421 device_for_each_child(&dev->dev, NULL, remove_iter); 409 device_for_each_child(&dev->dev, NULL, remove_iter);
422 cleanup_service_irqs(dev); 410 cleanup_service_irqs(dev);
423 pci_disable_device(dev); 411 pci_disable_device(dev);
424 kfree(port_data);
425} 412}
426 413
427/** 414/**