Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751984AbbHQWut (ORCPT ); Mon, 17 Aug 2015 18:50:49 -0400 Received: from mail-pa0-f42.google.com ([209.85.220.42]:33130 "EHLO mail-pa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751336AbbHQWur (ORCPT ); Mon, 17 Aug 2015 18:50:47 -0400 Date: Mon, 17 Aug 2015 17:50:41 -0500 From: Bjorn Helgaas To: Yinghai Lu Cc: David Miller , Benjamin Herrenschmidt , Wei Yang , TJ , Yijing Wang , Andrew Morton , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 01/51] PCI: Cleanup res_to_dev_res() printout for addon resources Message-ID: <20150817225041.GN26431@google.com> References: <1438039809-24957-1-git-send-email-yinghai@kernel.org> <1438039809-24957-2-git-send-email-yinghai@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1438039809-24957-2-git-send-email-yinghai@kernel.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2750 Lines: 83 On Mon, Jul 27, 2015 at 04:29:19PM -0700, Yinghai Lu wrote: > 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(), > and later we will reuse res_to_dev_res() in other functions. > > 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 508cc56..f0fa705 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); Please use %#llx so we have a "0x" prefix like other hex numbers. > + > + return dev_res->min_align; > } > > > -- > 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/