diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-26 19:34:29 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-26 19:34:29 -0400 |
| commit | b72c40949b0f04728f2993a1434598d3bad094ea (patch) | |
| tree | 612b99ceac1f713d15cb288d370578e138537e49 /kernel | |
| parent | e4d50423d773fb8d5b714430ba5358e8a1b87c14 (diff) | |
| parent | d558b483d5a73f5718705b270cb2090f66ea48c8 (diff) | |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6:
x86/PCI: truncate _CRS windows with _LEN > _MAX - _MIN + 1
x86/PCI: for host bridge address space collisions, show conflicting resource
frv/PCI: remove redundant warnings
x86/PCI: remove redundant warnings
PCI: don't say we claimed a resource if we failed
PCI quirk: Disable MSI on VIA K8T890 systems
PCI quirk: RS780/RS880: work around missing MSI initialization
PCI quirk: only apply CX700 PCI bus parking quirk if external VT6212L is present
PCI: complain about devices that seem to be broken
PCI: print resources consistently with %pR
PCI: make disabled window printk style match the enabled ones
PCI: break out primary/secondary/subordinate for readability
PCI: for address space collisions, show conflicting resource
resources: add interfaces that return conflict information
PCI: cleanup error return for pcix get and set mmrbc functions
PCI: fix access of PCI_X_CMD by pcix get and set mmrbc functions
PCI: kill off pci_register_set_vga_state() symbol export.
PCI: fix return value from pcix_get_max_mmrbc()
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/resource.c | 44 |
1 files changed, 37 insertions, 7 deletions
diff --git a/kernel/resource.c b/kernel/resource.c index 2d5be5d9bf5f..9c358e263534 100644 --- a/kernel/resource.c +++ b/kernel/resource.c | |||
| @@ -219,19 +219,34 @@ void release_child_resources(struct resource *r) | |||
| 219 | } | 219 | } |
| 220 | 220 | ||
| 221 | /** | 221 | /** |
| 222 | * request_resource - request and reserve an I/O or memory resource | 222 | * request_resource_conflict - request and reserve an I/O or memory resource |
| 223 | * @root: root resource descriptor | 223 | * @root: root resource descriptor |
| 224 | * @new: resource descriptor desired by caller | 224 | * @new: resource descriptor desired by caller |
| 225 | * | 225 | * |
| 226 | * Returns 0 for success, negative error code on error. | 226 | * Returns 0 for success, conflict resource on error. |
| 227 | */ | 227 | */ |
| 228 | int request_resource(struct resource *root, struct resource *new) | 228 | struct resource *request_resource_conflict(struct resource *root, struct resource *new) |
| 229 | { | 229 | { |
| 230 | struct resource *conflict; | 230 | struct resource *conflict; |
| 231 | 231 | ||
| 232 | write_lock(&resource_lock); | 232 | write_lock(&resource_lock); |
| 233 | conflict = __request_resource(root, new); | 233 | conflict = __request_resource(root, new); |
| 234 | write_unlock(&resource_lock); | 234 | write_unlock(&resource_lock); |
| 235 | return conflict; | ||
| 236 | } | ||
| 237 | |||
| 238 | /** | ||
| 239 | * request_resource - request and reserve an I/O or memory resource | ||
| 240 | * @root: root resource descriptor | ||
| 241 | * @new: resource descriptor desired by caller | ||
| 242 | * | ||
| 243 | * Returns 0 for success, negative error code on error. | ||
| 244 | */ | ||
| 245 | int request_resource(struct resource *root, struct resource *new) | ||
| 246 | { | ||
| 247 | struct resource *conflict; | ||
| 248 | |||
| 249 | conflict = request_resource_conflict(root, new); | ||
| 235 | return conflict ? -EBUSY : 0; | 250 | return conflict ? -EBUSY : 0; |
| 236 | } | 251 | } |
| 237 | 252 | ||
| @@ -474,25 +489,40 @@ static struct resource * __insert_resource(struct resource *parent, struct resou | |||
| 474 | } | 489 | } |
| 475 | 490 | ||
| 476 | /** | 491 | /** |
| 477 | * insert_resource - Inserts a resource in the resource tree | 492 | * insert_resource_conflict - Inserts resource in the resource tree |
| 478 | * @parent: parent of the new resource | 493 | * @parent: parent of the new resource |
| 479 | * @new: new resource to insert | 494 | * @new: new resource to insert |
| 480 | * | 495 | * |
| 481 | * Returns 0 on success, -EBUSY if the resource can't be inserted. | 496 | * Returns 0 on success, conflict resource if the resource can't be inserted. |
| 482 | * | 497 | * |
| 483 | * This function is equivalent to request_resource when no conflict | 498 | * This function is equivalent to request_resource_conflict when no conflict |
| 484 | * happens. If a conflict happens, and the conflicting resources | 499 | * happens. If a conflict happens, and the conflicting resources |
| 485 | * entirely fit within the range of the new resource, then the new | 500 | * entirely fit within the range of the new resource, then the new |
| 486 | * resource is inserted and the conflicting resources become children of | 501 | * resource is inserted and the conflicting resources become children of |
| 487 | * the new resource. | 502 | * the new resource. |
| 488 | */ | 503 | */ |
| 489 | int insert_resource(struct resource *parent, struct resource *new) | 504 | struct resource *insert_resource_conflict(struct resource *parent, struct resource *new) |
| 490 | { | 505 | { |
| 491 | struct resource *conflict; | 506 | struct resource *conflict; |
| 492 | 507 | ||
| 493 | write_lock(&resource_lock); | 508 | write_lock(&resource_lock); |
| 494 | conflict = __insert_resource(parent, new); | 509 | conflict = __insert_resource(parent, new); |
| 495 | write_unlock(&resource_lock); | 510 | write_unlock(&resource_lock); |
| 511 | return conflict; | ||
| 512 | } | ||
| 513 | |||
| 514 | /** | ||
| 515 | * insert_resource - Inserts a resource in the resource tree | ||
| 516 | * @parent: parent of the new resource | ||
| 517 | * @new: new resource to insert | ||
| 518 | * | ||
| 519 | * Returns 0 on success, -EBUSY if the resource can't be inserted. | ||
| 520 | */ | ||
| 521 | int insert_resource(struct resource *parent, struct resource *new) | ||
| 522 | { | ||
| 523 | struct resource *conflict; | ||
| 524 | |||
| 525 | conflict = insert_resource_conflict(parent, new); | ||
| 496 | return conflict ? -EBUSY : 0; | 526 | return conflict ? -EBUSY : 0; |
| 497 | } | 527 | } |
| 498 | 528 | ||
