diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-21 21:58:52 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-21 21:58:52 -0400 |
| commit | 6109e2ce2600e2db26cd0424bb9c6ed019723288 (patch) | |
| tree | 54b5d347bf12e0a987edfb52f287399f748a9a38 /kernel/resource.c | |
| parent | 0961d6581c870850342ad6ea25263763433d666f (diff) | |
| parent | ac81860ea073daed50246af54db706c6e491f240 (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: (36 commits)
PCI: hotplug: pciehp: Removed check for hotplug of display devices
PCI: read memory ranges out of Broadcom CNB20LE host bridge
PCI: Allow manual resource allocation for PCI hotplug bridges
x86/PCI: make ACPI MCFG reserved error messages ACPI specific
PCI hotplug: Use kmemdup
PM/PCI: Update PCI power management documentation
PCI: output FW warning in pci_read/write_vpd
PCI: fix typos pci_device_dis/enable to pci_dis/enable_device in comments
PCI quirks: disable msi on AMD rs4xx internal gfx bridges
PCI: Disable MSI for MCP55 on P5N32-E SLI
x86/PCI: irq and pci_ids patch for additional Intel Cougar Point DeviceIDs
PCI: aerdrv: trivial cleanup for aerdrv_core.c
PCI: aerdrv: trivial cleanup for aerdrv.c
PCI: aerdrv: introduce default_downstream_reset_link
PCI: aerdrv: rework find_aer_service
PCI: aerdrv: remove is_downstream
PCI: aerdrv: remove magical ROOT_ERR_STATUS_MASKS
PCI: aerdrv: redefine PCI_ERR_ROOT_*_SRC
PCI: aerdrv: rework do_recovery
PCI: aerdrv: rework get_e_source()
...
Diffstat (limited to 'kernel/resource.c')
| -rw-r--r-- | kernel/resource.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/kernel/resource.c b/kernel/resource.c index 9c358e263534..7b36976e5dea 100644 --- a/kernel/resource.c +++ b/kernel/resource.c | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | #include <linux/spinlock.h> | 15 | #include <linux/spinlock.h> |
| 16 | #include <linux/fs.h> | 16 | #include <linux/fs.h> |
| 17 | #include <linux/proc_fs.h> | 17 | #include <linux/proc_fs.h> |
| 18 | #include <linux/sched.h> | ||
| 18 | #include <linux/seq_file.h> | 19 | #include <linux/seq_file.h> |
| 19 | #include <linux/device.h> | 20 | #include <linux/device.h> |
| 20 | #include <linux/pfn.h> | 21 | #include <linux/pfn.h> |
| @@ -681,6 +682,8 @@ resource_size_t resource_alignment(struct resource *res) | |||
| 681 | * release_region releases a matching busy region. | 682 | * release_region releases a matching busy region. |
| 682 | */ | 683 | */ |
| 683 | 684 | ||
| 685 | static DECLARE_WAIT_QUEUE_HEAD(muxed_resource_wait); | ||
| 686 | |||
| 684 | /** | 687 | /** |
| 685 | * __request_region - create a new busy resource region | 688 | * __request_region - create a new busy resource region |
| 686 | * @parent: parent resource descriptor | 689 | * @parent: parent resource descriptor |
| @@ -693,6 +696,7 @@ struct resource * __request_region(struct resource *parent, | |||
| 693 | resource_size_t start, resource_size_t n, | 696 | resource_size_t start, resource_size_t n, |
| 694 | const char *name, int flags) | 697 | const char *name, int flags) |
| 695 | { | 698 | { |
| 699 | DECLARE_WAITQUEUE(wait, current); | ||
| 696 | struct resource *res = kzalloc(sizeof(*res), GFP_KERNEL); | 700 | struct resource *res = kzalloc(sizeof(*res), GFP_KERNEL); |
| 697 | 701 | ||
| 698 | if (!res) | 702 | if (!res) |
| @@ -717,7 +721,15 @@ struct resource * __request_region(struct resource *parent, | |||
| 717 | if (!(conflict->flags & IORESOURCE_BUSY)) | 721 | if (!(conflict->flags & IORESOURCE_BUSY)) |
| 718 | continue; | 722 | continue; |
| 719 | } | 723 | } |
| 720 | 724 | if (conflict->flags & flags & IORESOURCE_MUXED) { | |
| 725 | add_wait_queue(&muxed_resource_wait, &wait); | ||
| 726 | write_unlock(&resource_lock); | ||
| 727 | set_current_state(TASK_UNINTERRUPTIBLE); | ||
| 728 | schedule(); | ||
| 729 | remove_wait_queue(&muxed_resource_wait, &wait); | ||
| 730 | write_lock(&resource_lock); | ||
| 731 | continue; | ||
| 732 | } | ||
| 721 | /* Uhhuh, that didn't work out.. */ | 733 | /* Uhhuh, that didn't work out.. */ |
| 722 | kfree(res); | 734 | kfree(res); |
| 723 | res = NULL; | 735 | res = NULL; |
| @@ -791,6 +803,8 @@ void __release_region(struct resource *parent, resource_size_t start, | |||
| 791 | break; | 803 | break; |
| 792 | *p = res->sibling; | 804 | *p = res->sibling; |
| 793 | write_unlock(&resource_lock); | 805 | write_unlock(&resource_lock); |
| 806 | if (res->flags & IORESOURCE_MUXED) | ||
| 807 | wake_up(&muxed_resource_wait); | ||
| 794 | kfree(res); | 808 | kfree(res); |
| 795 | return; | 809 | return; |
| 796 | } | 810 | } |
