aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/pci_bind.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2012-12-22 18:02:54 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-01-03 07:09:41 -0500
commit38a9a67a281eeebcd7cccf87f0e371f58ae625e3 (patch)
tree91f8dd1862d8f46739d01d89299eed82fe3a6545 /drivers/acpi/pci_bind.c
parentd2e5f0c16ad60a7208fd371233e63b73c990ece2 (diff)
ACPI / PCI: Move the _PRT setup and cleanup code to pci-acpi.c
Move the code related to _PRT setup and removal and to power resources from acpi_pci_bind() and acpi_pci_unbind() to the .setup() and .cleanup() callbacks in acpi_pci_bus and remove acpi_pci_bind() and acpi_pci_unbind() that have no purpose any more. Accordingly, remove the code related to device .bind() and .unbind() operations from the ACPI PCI root bridge driver. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Yinghai Lu <yinghai@kernel.org> Acked-by: Toshi Kani <toshi.kani@hp.com>
Diffstat (limited to 'drivers/acpi/pci_bind.c')
-rw-r--r--drivers/acpi/pci_bind.c117
1 files changed, 0 insertions, 117 deletions
diff --git a/drivers/acpi/pci_bind.c b/drivers/acpi/pci_bind.c
deleted file mode 100644
index bbddcc9c894f..000000000000
--- a/drivers/acpi/pci_bind.c
+++ /dev/null
@@ -1,117 +0,0 @@
1/*
2 * pci_bind.c - ACPI PCI Device Binding ($Revision: 2 $)
3 *
4 * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
5 * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
6 *
7 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or (at
12 * your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
22 *
23 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
24 */
25
26#include <linux/kernel.h>
27#include <linux/types.h>
28#include <linux/pci.h>
29#include <linux/pci-acpi.h>
30#include <linux/acpi.h>
31#include <linux/pm_runtime.h>
32#include <acpi/acpi_bus.h>
33#include <acpi/acpi_drivers.h>
34
35#define _COMPONENT ACPI_PCI_COMPONENT
36ACPI_MODULE_NAME("pci_bind");
37
38static int acpi_pci_unbind(struct acpi_device *device)
39{
40 struct pci_dev *dev;
41
42 dev = acpi_get_pci_dev(device->handle);
43 if (!dev)
44 goto out;
45
46 acpi_power_resource_unregister_device(&dev->dev, device->handle);
47
48 if (!dev->subordinate)
49 goto out;
50
51 acpi_pci_irq_del_prt(pci_domain_nr(dev->bus), dev->subordinate->number);
52
53 device->ops.bind = NULL;
54 device->ops.unbind = NULL;
55
56out:
57 pci_dev_put(dev);
58 return 0;
59}
60
61static int acpi_pci_bind(struct acpi_device *device)
62{
63 acpi_status status;
64 acpi_handle handle;
65 unsigned char bus;
66 struct pci_dev *dev;
67
68 dev = acpi_get_pci_dev(device->handle);
69 if (!dev)
70 return 0;
71
72 acpi_power_resource_register_device(&dev->dev, device->handle);
73
74 /*
75 * Install the 'bind' function to facilitate callbacks for
76 * children of the P2P bridge.
77 */
78 if (dev->subordinate) {
79 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
80 "Device %04x:%02x:%02x.%d is a PCI bridge\n",
81 pci_domain_nr(dev->bus), dev->bus->number,
82 PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn)));
83 device->ops.bind = acpi_pci_bind;
84 device->ops.unbind = acpi_pci_unbind;
85 }
86
87 /*
88 * Evaluate and parse _PRT, if exists. This code allows parsing of
89 * _PRT objects within the scope of non-bridge devices. Note that
90 * _PRTs within the scope of a PCI bridge assume the bridge's
91 * subordinate bus number.
92 *
93 * TBD: Can _PRTs exist within the scope of non-bridge PCI devices?
94 */
95 status = acpi_get_handle(device->handle, METHOD_NAME__PRT, &handle);
96 if (ACPI_FAILURE(status))
97 goto out;
98
99 if (dev->subordinate)
100 bus = dev->subordinate->number;
101 else
102 bus = dev->bus->number;
103
104 acpi_pci_irq_add_prt(device->handle, pci_domain_nr(dev->bus), bus);
105
106out:
107 pci_dev_put(dev);
108 return 0;
109}
110
111int acpi_pci_bind_root(struct acpi_device *device)
112{
113 device->ops.bind = acpi_pci_bind;
114 device->ops.unbind = acpi_pci_unbind;
115
116 return 0;
117}