aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-02-26 13:35:27 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2010-02-26 13:35:27 -0500
commit68c6b859846bd078b37c6ca5f3882032f129e72d (patch)
treee243605957f1cab3532d57d86ea87355c10b6385 /kernel
parenta4a47bc03fe520e95e0c4212bf97c86545fb14f9 (diff)
parentbb8d41330ce27edb91adb6922d3f8e1a8923f727 (diff)
Merge branch 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6
* 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6: (48 commits) x86/PCI: Prevent mmconfig memory corruption ACPI: Use GPE reference counting to support shared GPEs x86/PCI: use host bridge _CRS info by default on 2008 and newer machines PCI: augment bus resource table with a list PCI: add pci_bus_for_each_resource(), remove direct bus->resource[] refs PCI: read bridge windows before filling in subtractive decode resources PCI: split up pci_read_bridge_bases() PCIe PME: use pci_pcie_cap() PCI PM: Run-time callbacks for PCI bus type PCIe PME: use pci_is_pcie() PCI / ACPI / PM: Platform support for PCI PME wake-up ACPI / ACPICA: Multiple system notify handlers per device ACPI / PM: Add more run-time wake-up fields ACPI: Use GPE reference counting to support shared GPEs PCI PM: Make it possible to force using INTx for PCIe PME signaling PCI PM: PCIe PME root port service driver PCI PM: Add function for checking PME status of devices PCI: mark is_pcie obsolete PCI: set PCI_PREF_RANGE_TYPE_64 in pci_bridge_check_ranges PCI: pciehp: second try to get big range for pcie devices ...
Diffstat (limited to 'kernel')
-rw-r--r--kernel/power/Kconfig5
-rw-r--r--kernel/resource.c44
2 files changed, 44 insertions, 5 deletions
diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig
index 91e09d3b2eb2..4c9cffcf69c7 100644
--- a/kernel/power/Kconfig
+++ b/kernel/power/Kconfig
@@ -222,3 +222,8 @@ config PM_RUNTIME
222 and the bus type drivers of the buses the devices are on are 222 and the bus type drivers of the buses the devices are on are
223 responsible for the actual handling of the autosuspend requests and 223 responsible for the actual handling of the autosuspend requests and
224 wake-up events. 224 wake-up events.
225
226config PM_OPS
227 bool
228 depends on PM_SLEEP || PM_RUNTIME
229 default y
diff --git a/kernel/resource.c b/kernel/resource.c
index af96c1e4b54b..24e9e60c1459 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -188,6 +188,36 @@ static int __release_resource(struct resource *old)
188 return -EINVAL; 188 return -EINVAL;
189} 189}
190 190
191static void __release_child_resources(struct resource *r)
192{
193 struct resource *tmp, *p;
194 resource_size_t size;
195
196 p = r->child;
197 r->child = NULL;
198 while (p) {
199 tmp = p;
200 p = p->sibling;
201
202 tmp->parent = NULL;
203 tmp->sibling = NULL;
204 __release_child_resources(tmp);
205
206 printk(KERN_DEBUG "release child resource %pR\n", tmp);
207 /* need to restore size, and keep flags */
208 size = resource_size(tmp);
209 tmp->start = 0;
210 tmp->end = size - 1;
211 }
212}
213
214void release_child_resources(struct resource *r)
215{
216 write_lock(&resource_lock);
217 __release_child_resources(r);
218 write_unlock(&resource_lock);
219}
220
191/** 221/**
192 * request_resource - request and reserve an I/O or memory resource 222 * request_resource - request and reserve an I/O or memory resource
193 * @root: root resource descriptor 223 * @root: root resource descriptor
@@ -303,8 +333,10 @@ int walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,
303static int find_resource(struct resource *root, struct resource *new, 333static int find_resource(struct resource *root, struct resource *new,
304 resource_size_t size, resource_size_t min, 334 resource_size_t size, resource_size_t min,
305 resource_size_t max, resource_size_t align, 335 resource_size_t max, resource_size_t align,
306 void (*alignf)(void *, struct resource *, 336 resource_size_t (*alignf)(void *,
307 resource_size_t, resource_size_t), 337 const struct resource *,
338 resource_size_t,
339 resource_size_t),
308 void *alignf_data) 340 void *alignf_data)
309{ 341{
310 struct resource *this = root->child; 342 struct resource *this = root->child;
@@ -330,7 +362,7 @@ static int find_resource(struct resource *root, struct resource *new,
330 tmp.end = max; 362 tmp.end = max;
331 tmp.start = ALIGN(tmp.start, align); 363 tmp.start = ALIGN(tmp.start, align);
332 if (alignf) 364 if (alignf)
333 alignf(alignf_data, &tmp, size, align); 365 tmp.start = alignf(alignf_data, &tmp, size, align);
334 if (tmp.start < tmp.end && tmp.end - tmp.start >= size - 1) { 366 if (tmp.start < tmp.end && tmp.end - tmp.start >= size - 1) {
335 new->start = tmp.start; 367 new->start = tmp.start;
336 new->end = tmp.start + size - 1; 368 new->end = tmp.start + size - 1;
@@ -358,8 +390,10 @@ static int find_resource(struct resource *root, struct resource *new,
358int allocate_resource(struct resource *root, struct resource *new, 390int allocate_resource(struct resource *root, struct resource *new,
359 resource_size_t size, resource_size_t min, 391 resource_size_t size, resource_size_t min,
360 resource_size_t max, resource_size_t align, 392 resource_size_t max, resource_size_t align,
361 void (*alignf)(void *, struct resource *, 393 resource_size_t (*alignf)(void *,
362 resource_size_t, resource_size_t), 394 const struct resource *,
395 resource_size_t,
396 resource_size_t),
363 void *alignf_data) 397 void *alignf_data)
364{ 398{
365 int err; 399 int err;