From patchwork Thu Oct 1 05:52:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinghai Lu X-Patchwork-Id: 7304981 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 070979F32B for ; Thu, 1 Oct 2015 06:11:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 37AED20557 for ; Thu, 1 Oct 2015 06:10:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4A6B920426 for ; Thu, 1 Oct 2015 06:10:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751027AbbJAGK5 (ORCPT ); Thu, 1 Oct 2015 02:10:57 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:26979 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750836AbbJAGK4 (ORCPT ); Thu, 1 Oct 2015 02:10:56 -0400 Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t915rwP9017372 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 1 Oct 2015 05:53:59 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.13.8/8.13.8) with ESMTP id t915rwSY011005 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Thu, 1 Oct 2015 05:53:58 GMT Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by userv0122.oracle.com (8.13.8/8.13.8) with ESMTP id t915rwXw027757; Thu, 1 Oct 2015 05:53:58 GMT Received: from linux-siqj.site (/10.154.161.115) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 30 Sep 2015 22:53:57 -0700 From: Yinghai Lu To: Bjorn Helgaas , David Miller , Benjamin Herrenschmidt , Wei Yang , TJ , Yijing Wang Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Yinghai Lu Subject: [PATCH v6 12/53] PCI: Cleanup res_to_dev_res() printout Date: Wed, 30 Sep 2015 22:52:46 -0700 Message-Id: <1443678807-786-13-git-send-email-yinghai@kernel.org> X-Mailer: git-send-email 1.8.4.5 In-Reply-To: <1443678807-786-1-git-send-email-yinghai@kernel.org> References: <1443678807-786-1-git-send-email-yinghai@kernel.org> X-Source-IP: userv0021.oracle.com [156.151.31.71] Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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 6b6a4ed..2256ce6 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; }