Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1210964

[PATCH v4 29/52] PCI: Unify calculate_size() for io port and MMIO

From Yinghai Lu <yinghai@kernel.org>
Newsgroups linux.kernel
Subject [PATCH v4 29/52] PCI: Unify calculate_size() for io port and MMIO
Date 2015-08-21 09:30 +0200
Message-ID <pZOVZ-5dT-23@gated-at.bofh.it> (permalink)
References <pZNZT-3SZ-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Now calculate_memsize() and calculate_iosize() is the same.

Change them to calculate_size().

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
 drivers/pci/setup-bus.c | 25 +++++--------------------
 1 file changed, 5 insertions(+), 20 deletions(-)

diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index f3d89d1..2d26745 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -1110,22 +1110,7 @@ static struct resource *find_free_bus_resource(struct pci_bus *bus,
 	return NULL;
 }
 
-static resource_size_t calculate_iosize(resource_size_t size,
-		resource_size_t min_size,
-		resource_size_t old_size,
-		resource_size_t align)
-{
-	if (size < min_size)
-		size = min_size;
-	if (old_size == 1)
-		old_size = 0;
-	size = ALIGN(size, align);
-	if (size < old_size)
-		size = old_size;
-	return size;
-}
-
-static resource_size_t calculate_memsize(resource_size_t size,
+static resource_size_t calculate_size(resource_size_t size,
 		resource_size_t min_size,
 		resource_size_t old_size,
 		resource_size_t align)
@@ -1251,14 +1236,14 @@ static void pbus_size_io(struct pci_bus *bus, resource_size_t min_size,
 
 	size = size_aligned_for_isa(size);
 	size += size1;
-	size0 = calculate_iosize(size, min_size,
+	size0 = calculate_size(size, min_size,
 			resource_size(b_res), min_align);
 	sum_add_size = size_aligned_for_isa(sum_add_size);
 	sum_add_size += sum_add_size1;
 	if (sum_add_size < min_sum_size)
 		sum_add_size = min_sum_size;
 	size1 = !realloc_head ? size0 :
-		calculate_iosize(sum_add_size, min_size,
+		calculate_size(sum_add_size, min_size,
 			resource_size(b_res), min_align);
 	if (!size0 && !size1) {
 		if (b_res->start || b_res->end)
@@ -1611,7 +1596,7 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,
 	if (size || min_size) {
 		min_align = calculate_mem_align(&align_test_list, max_align,
 						size, window_align);
-		size0 = calculate_memsize(size, min_size,
+		size0 = calculate_size(size, min_size,
 				  resource_size(b_res), min_align);
 	}
 	free_align_test_list(&align_test_list);
@@ -1636,7 +1621,7 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,
 		min_add_align = calculate_mem_align(&align_test_add_list,
 					max_add_align, sum_add_size,
 					window_align);
-		size1 = calculate_memsize(sum_add_size, min_size,
+		size1 = calculate_size(sum_add_size, min_size,
 				 resource_size(b_res), min_add_align);
 	}
 	free_align_test_list(&align_test_add_list);
-- 
1.8.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH v4 00/52] PCI: Resource allocation cleanup for v4.3 Yinghai Lu <yinghai@kernel.org> - 2015-08-21 08:40 +0200
  [PATCH v4 23/52] PCI: Add support for more than two alt_size under same bridge Yinghai Lu <yinghai@kernel.org> - 2015-08-21 08:40 +0200
  [PATCH v4 09/52] PCI: Rename pdev_sort_resources() to pdev_assign_resources_prepare() Yinghai Lu <yinghai@kernel.org> - 2015-08-21 08:40 +0200
  [PATCH v4 18/52] PCI: Move comment to pci_need_to_release() Yinghai Lu <yinghai@kernel.org> - 2015-08-21 08:40 +0200
  [PATCH v4 04/52] PCI: Optimize bus min_align/size calculation during sizing Yinghai Lu <yinghai@kernel.org> - 2015-08-21 08:40 +0200
  [PATCH v4 27/52] PCI: Move ISA io port align out of calculate_iosize() Yinghai Lu <yinghai@kernel.org> - 2015-08-21 08:40 +0200
  [PATCH v4 08/52] PCI: Remove duplicated code for resource sorting Yinghai Lu <yinghai@kernel.org> - 2015-08-21 08:40 +0200
  [PATCH v4 05/52] PCI: Optimize bus align/size calculation for optional during sizing Yinghai Lu <yinghai@kernel.org> - 2015-08-21 08:40 +0200
  [PATCH v4 36/52] PCI: Only treat non-pref mmio64 as pref if all bridges have MEM_64 Yinghai Lu <yinghai@kernel.org> - 2015-08-21 08:40 +0200
  [PATCH v4 43/52] OF/PCI: Add IORESOURCE_MEM_64 for 64-bit resource Yinghai Lu <yinghai@kernel.org> - 2015-08-21 08:40 +0200
    Re: [PATCH v4 43/52] OF/PCI: Add IORESOURCE_MEM_64 for 64-bit resource Rob Herring <robherring2@gmail.com> - 2015-08-21 20:20 +0200
      Re: [PATCH v4 43/52] OF/PCI: Add IORESOURCE_MEM_64 for 64-bit resource Yinghai Lu <yinghai@kernel.org> - 2015-08-21 20:30 +0200
  [PATCH v4 15/52] PCI: Cache window alignment value during bus sizing Yinghai Lu <yinghai@kernel.org> - 2015-08-21 08:40 +0200
  [PATCH v4 01/52] PCI: Cleanup res_to_dev_res() printout Yinghai Lu <yinghai@kernel.org> - 2015-08-21 08:40 +0200
  [PATCH v4 32/52] PCI: Kill macro checking for bus io port sizing Yinghai Lu <yinghai@kernel.org> - 2015-08-21 08:40 +0200
  [PATCH v4 21/52] PCI: Move saved required resource list out of required+optional assigning Yinghai Lu <yinghai@kernel.org> - 2015-08-21 08:40 +0200
  [PATCH v4 22/52] PCI: Add alt_size ressource allocation support Yinghai Lu <yinghai@kernel.org> - 2015-08-21 09:30 +0200
  [PATCH v4 44/52] PCI: Treat optional as required in first try for bridge rescan Yinghai Lu <yinghai@kernel.org> - 2015-08-21 09:30 +0200
  [PATCH v4 29/52] PCI: Unify calculate_size() for io port and MMIO Yinghai Lu <yinghai@kernel.org> - 2015-08-21 09:30 +0200

csiph-web