diff mbox

[1/3] x86/PCI: allocate space from the end of a region, not the beginning

Message ID 20100915210902.12365.19911.stgit@bob.kio (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Bjorn Helgaas Sept. 15, 2010, 9:09 p.m. UTC
None
diff mbox

Patch

diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
index 5525309..1ff3e9f 100644
--- a/arch/x86/pci/i386.c
+++ b/arch/x86/pci/i386.c
@@ -65,7 +65,10 @@  pcibios_align_resource(void *data, const struct resource *res,
 			resource_size_t size, resource_size_t align)
 {
 	struct pci_dev *dev = data;
-	resource_size_t start = res->start;
+	resource_size_t start = ALIGN(res->end - size + 1, align);
+
+	if (start < res->start)
+		start = res->start;
 
 	if (res->flags & IORESOURCE_IO) {
 		if (skip_isa_ioresource_align(dev))