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


Groups > linux.kernel > #1342744

[PATCH v10 23/59] PCI: Cleanup res_to_dev_res() printout

From Yinghai Lu <yinghai@kernel.org>
Newsgroups linux.kernel
Subject [PATCH v10 23/59] PCI: Cleanup res_to_dev_res() printout
Date 2016-02-25 04:20 +0100
Message-ID <r5UD9-6ag-47@gated-at.bofh.it> (permalink)
References <r5TH3-5ok-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Now get_res_add_size() and get_res_add_align() all have same printout
from res_to_dev_res(), and it is confusing.

Move out debug messages printout from res_to_dev_res(),
so later we will reuse res_to_dev_res() in other functions.

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

diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 3349a83..49f4a27 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -104,19 +104,9 @@ static struct pci_dev_resource *res_to_dev_res(struct list_head *head,
 {
 	struct pci_dev_resource *dev_res;
 
-	list_for_each_entry(dev_res, head, list) {
-		if (dev_res->res == res) {
-			int idx = res - &dev_res->dev->resource[0];
-
-			dev_printk(KERN_DEBUG, &dev_res->dev->dev,
-				 "res[%d]=%pR res_to_dev_res add_size %llx min_align %llx\n",
-				 idx, dev_res->res,
-				 (unsigned long long)dev_res->add_size,
-				 (unsigned long long)dev_res->min_align);
-
+	list_for_each_entry(dev_res, head, list)
+		if (dev_res->res == res)
 			return dev_res;
-		}
-	}
 
 	return NULL;
 }
@@ -127,7 +117,15 @@ static resource_size_t get_res_add_size(struct list_head *head,
 	struct pci_dev_resource *dev_res;
 
 	dev_res = res_to_dev_res(head, res);
-	return dev_res ? dev_res->add_size : 0;
+	if (!dev_res || !dev_res->add_size)
+		return 0;
+
+	dev_printk(KERN_DEBUG, &dev_res->dev->dev,
+		   "BAR %d: %pR get_res_add_size add_size   %#llx\n",
+		   (int)(res - &dev_res->dev->resource[0]),
+		   res, (unsigned long long)dev_res->add_size);
+
+	return dev_res->add_size;
 }
 
 static resource_size_t get_res_add_align(struct list_head *head,
@@ -136,7 +134,15 @@ static resource_size_t get_res_add_align(struct list_head *head,
 	struct pci_dev_resource *dev_res;
 
 	dev_res = res_to_dev_res(head, res);
-	return dev_res ? dev_res->min_align : 0;
+	if (!dev_res || !dev_res->min_align)
+		return 0;
+
+	dev_printk(KERN_DEBUG, &dev_res->dev->dev,
+		   "BAR %d: %pR get_res_add_align min_align %#llx\n",
+		   (int)(res - &dev_res->dev->resource[0]),
+		   res, (unsigned long long)dev_res->min_align);
+
+	return dev_res->min_align;
 }
 
 
-- 
1.8.4.5

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


Thread

[PATCH v10 00/59] PCI: Resource allocation cleanup for v4.6 Yinghai Lu <yinghai@kernel.org> - 2016-02-25 03:40 +0100
  [PATCH v10 16/59] PCI: Don't release fixed resource for realloc Yinghai Lu <yinghai@kernel.org> - 2016-02-25 03:40 +0100
  [PATCH v10 12/59] PCI: Only treat non-pref mmio64 as pref if all bridges have MEM_64 Yinghai Lu <yinghai@kernel.org> - 2016-02-25 03:40 +0100
  [PATCH v10 04/59] sparc/PCI: Add IORESOURCE_MEM_64 for 64-bit resource in OF parsing Yinghai Lu <yinghai@kernel.org> - 2016-02-25 03:40 +0100
  [PATCH v10 14/59] PCI: Only treat non-pref mmio64 as pref if host bridge has mmio64 Yinghai Lu <yinghai@kernel.org> - 2016-02-25 03:40 +0100
  [PATCH v10 41/59] PCI: Skip required+optional if there is no optional Yinghai Lu <yinghai@kernel.org> - 2016-02-25 03:40 +0100
  [PATCH v10 01/59] PCI: Add pci_find_root_bus_resource() Yinghai Lu <yinghai@kernel.org> - 2016-02-25 03:40 +0100
  [PATCH v10 07/59] PCI: Ignore BAR for ALi M1533 PCI-ISA bridge Yinghai Lu <yinghai@kernel.org> - 2016-02-25 03:40 +0100
  [PATCH v10 13/59] PCI: Add has_mem64 for struct host_bridge Yinghai Lu <yinghai@kernel.org> - 2016-02-25 04:20 +0100
  [PATCH v10 27/59] PCI: Optimize bus align/size calculation for optional during sizing Yinghai Lu <yinghai@kernel.org> - 2016-02-25 04:20 +0100
  [PATCH v10 33/59] PCI: Add debug printout during releasing partial assigned resources Yinghai Lu <yinghai@kernel.org> - 2016-02-25 04:20 +0100
  [PATCH v10 19/59] PCI: Separate realloc list checking after allocation Yinghai Lu <yinghai@kernel.org> - 2016-02-25 04:20 +0100
  [PATCH v10 23/59] PCI: Cleanup res_to_dev_res() printout Yinghai Lu <yinghai@kernel.org> - 2016-02-25 04:20 +0100

csiph-web