[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1460074573-7481-25-git-send-email-yinghai@kernel.org>
Date: Thu, 7 Apr 2016 17:15:37 -0700
From: Yinghai Lu <yinghai@...nel.org>
To: Bjorn Helgaas <bhelgaas@...gle.com>,
David Miller <davem@...emloft.net>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Wei Yang <weiyang@...ux.vnet.ibm.com>, TJ <linux@....tj>,
Yijing Wang <wangyijing@...wei.com>,
Khalid Aziz <khalid.aziz@...cle.com>,
linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org,
Yinghai Lu <yinghai@...nel.org>
Subject: [PATCH v11 24/60] PCI: Cleanup res_to_dev_res() printout
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.
-v2: does not print out when add_size or min_align is 0
-v3: change to %#llx according to Bjorn.
Signed-off-by: Yinghai Lu <yinghai@...nel.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 4674e6b..dd33234 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -103,19 +103,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;
}
@@ -126,7 +116,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,
@@ -135,7 +133,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
Powered by blists - more mailing lists