Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b26b2d49 authored by Dominik Brodowski's avatar Dominik Brodowski Committed by Jesse Barnes
Browse files

resource/PCI: align functions now return start of resource



As suggested by Linus, align functions should return the start
of a resource, not void. An update of "res->start" is no longer
necessary.

Cc: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: default avatarDominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
parent 93da6202
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -126,7 +126,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, pcibios_fixup_final);
#define MB			(1024*KB)
#define GB			(1024*MB)

void
resource_size_t
pcibios_align_resource(void *data, struct resource *res,
		       resource_size_t size, resource_size_t align)
{
@@ -184,7 +184,7 @@ pcibios_align_resource(void *data, struct resource *res,
		}
	}

	res->start = start;
	return start;
}
#undef KB
#undef MB
+5 −3
Original line number Diff line number Diff line
@@ -616,7 +616,7 @@ char * __init pcibios_setup(char *str)
 * but we want to try to avoid allocating at 0x2900-0x2bff
 * which might be mirrored at 0x0100-0x03ff..
 */
void pcibios_align_resource(void *data, struct resource *res,
resource_size_t pcibios_align_resource(void *data, struct resource *res,
				resource_size_t size, resource_size_t align)
{
	resource_size_t start = res->start;
@@ -624,7 +624,9 @@ void pcibios_align_resource(void *data, struct resource *res,
	if (res->flags & IORESOURCE_IO && start & 0x300)
		start = (start + 0x3ff) & ~0x3ff;

	res->start = (start + align - 1) & ~(align - 1);
	start = (start + align - 1) & ~(align - 1);

	return start;
}

/**
+6 −8
Original line number Diff line number Diff line
@@ -41,18 +41,16 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
	return 0;
}

void
resource_size_t
pcibios_align_resource(void *data, struct resource *res,
		       resource_size_t size, resource_size_t align)
{
	if (res->flags & IORESOURCE_IO) {
	resource_size_t start = res->start;

		if (start & 0x300) {
	if ((res->flags & IORESOURCE_IO) && (start & 0x300))
		start = (start + 0x3ff) & ~0x3ff;
			res->start = start;
		}
	}

	return start
}

int pcibios_enable_resources(struct pci_dev *dev, int mask)
+6 −8
Original line number Diff line number Diff line
@@ -32,18 +32,16 @@
 * but we want to try to avoid allocating at 0x2900-0x2bff
 * which might have be mirrored at 0x0100-0x03ff..
 */
void
resource_size_t
pcibios_align_resource(void *data, struct resource *res,
		       resource_size_t size, resource_size_t align)
{
	if (res->flags & IORESOURCE_IO) {
	resource_size_t start = res->start;

		if (start & 0x300) {
	if ((res->flags & IORESOURCE_IO) && (start & 0x300))
		start = (start + 0x3ff) & ~0x3ff;
			res->start = start;
		}
	}

	return start
}


+2 −1
Original line number Diff line number Diff line
@@ -547,10 +547,11 @@ pcibios_disable_device (struct pci_dev *dev)
		acpi_pci_irq_disable(dev);
}

void
resource_size_t
pcibios_align_resource (void *data, struct resource *res,
		        resource_size_t size, resource_size_t align)
{
	return res->start;
}

/*
Loading