PCI: PCIe portdrv: Fix suspend and resume of PCI Express port services
[linux-2.6/mini2440.git] / drivers / pci / pcie / portdrv_bus.c
blob3a03db4323ad25f6882808f07100e4f43b04abdb
1 /*
2 * File: portdrv_bus.c
3 * Purpose: PCI Express Port Bus Driver's Bus Overloading Functions
5 * Copyright (C) 2004 Intel
6 * Copyright (C) Tom Long Nguyen (tom.l.nguyen@intel.com)
7 */
9 #include <linux/module.h>
10 #include <linux/pci.h>
11 #include <linux/kernel.h>
12 #include <linux/errno.h>
13 #include <linux/pm.h>
15 #include <linux/pcieport_if.h>
16 #include "portdrv.h"
18 static int pcie_port_bus_match(struct device *dev, struct device_driver *drv);
20 struct bus_type pcie_port_bus_type = {
21 .name = "pci_express",
22 .match = pcie_port_bus_match,
24 EXPORT_SYMBOL_GPL(pcie_port_bus_type);
26 static int pcie_port_bus_match(struct device *dev, struct device_driver *drv)
28 struct pcie_device *pciedev;
29 struct pcie_port_service_driver *driver;
31 if (drv->bus != &pcie_port_bus_type || dev->bus != &pcie_port_bus_type)
32 return 0;
34 pciedev = to_pcie_device(dev);
35 driver = to_service_driver(drv);
36 if ( (driver->id_table->vendor != PCI_ANY_ID &&
37 driver->id_table->vendor != pciedev->id.vendor) ||
38 (driver->id_table->device != PCI_ANY_ID &&
39 driver->id_table->device != pciedev->id.device) ||
40 (driver->id_table->port_type != PCIE_ANY_PORT &&
41 driver->id_table->port_type != pciedev->id.port_type) ||
42 driver->id_table->service_type != pciedev->id.service_type )
43 return 0;
45 return 1;