]> Git Repo - linux.git/blob - drivers/pci/pcie/portdrv_bus.c
mm: disable interrupts while initializing deferred pages
[linux.git] / drivers / pci / pcie / portdrv_bus.c
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * File:        portdrv_bus.c
4  * Purpose:     PCI Express Port Bus Driver's Bus Overloading Functions
5  *
6  * Copyright (C) 2004 Intel
7  * Copyright (C) Tom Long Nguyen ([email protected])
8  */
9
10 #include <linux/module.h>
11 #include <linux/pci.h>
12 #include <linux/kernel.h>
13 #include <linux/errno.h>
14 #include <linux/pm.h>
15
16 #include <linux/pcieport_if.h>
17 #include "portdrv.h"
18
19 static int pcie_port_bus_match(struct device *dev, struct device_driver *drv);
20
21 struct bus_type pcie_port_bus_type = {
22         .name           = "pci_express",
23         .match          = pcie_port_bus_match,
24 };
25 EXPORT_SYMBOL_GPL(pcie_port_bus_type);
26
27 static int pcie_port_bus_match(struct device *dev, struct device_driver *drv)
28 {
29         struct pcie_device *pciedev;
30         struct pcie_port_service_driver *driver;
31
32         if (drv->bus != &pcie_port_bus_type || dev->bus != &pcie_port_bus_type)
33                 return 0;
34
35         pciedev = to_pcie_device(dev);
36         driver = to_service_driver(drv);
37
38         if (driver->service != pciedev->service)
39                 return 0;
40
41         if ((driver->port_type != PCIE_ANY_PORT) &&
42             (driver->port_type != pci_pcie_type(pciedev->port)))
43                 return 0;
44
45         return 1;
46 }
47
48 int pcie_port_bus_register(void)
49 {
50         return bus_register(&pcie_port_bus_type);
51 }
52
53 void pcie_port_bus_unregister(void)
54 {
55         bus_unregister(&pcie_port_bus_type);
56 }
This page took 0.03409 seconds and 4 git commands to generate.