public inbox for linux-pci@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Philipp Stanner <pstanner@redhat.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
	linux-pci@vger.kernel.org,  LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/1] PCI: Convert pdev_sort_resources() to use resource name helper
Date: Wed, 16 Oct 2024 16:34:51 +0300 (EEST)	[thread overview]
Message-ID: <d1202665-1fb7-0a10-7c27-1a9bb0b2ecc4@linux.intel.com> (raw)
In-Reply-To: <ac50d7cf2a2071f196552fa4dc4109f9a551c7e7.camel@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 2463 bytes --]

On Wed, 16 Oct 2024, Philipp Stanner wrote:

> On Wed, 2024-10-16 at 16:15 +0300, Ilpo Järvinen wrote:
> > On Wed, 16 Oct 2024, Philipp Stanner wrote:
> > 
> > > On Wed, 2024-10-16 at 15:00 +0300, Ilpo Järvinen wrote:
> > > > Use pci_resource_name() helper in pdev_sort_resources() to print
> > > > resources in user-friendly format.
> > > > 
> > > > Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> > > > ---
> > > >  drivers/pci/setup-bus.c | 5 +++--
> > > >  1 file changed, 3 insertions(+), 2 deletions(-)
> > > > 
> > > > diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
> > > > index 23082bc0ca37..071c5436b4a5 100644
> > > > --- a/drivers/pci/setup-bus.c
> > > > +++ b/drivers/pci/setup-bus.c
> > > > @@ -134,6 +134,7 @@ static void pdev_sort_resources(struct
> > > > pci_dev
> > > > *dev, struct list_head *head)
> > > >  	int i;
> > > >  
> > > >  	pci_dev_for_each_resource(dev, r, i) {
> > > > +		const char *r_name = pci_resource_name(dev, i);
> > > >  		struct pci_dev_resource *dev_res, *tmp;
> > > >  		resource_size_t r_align;
> > > >  		struct list_head *n;
> > > > @@ -146,8 +147,8 @@ static void pdev_sort_resources(struct
> > > > pci_dev
> > > > *dev, struct list_head *head)
> > > >  
> > > >  		r_align = pci_resource_alignment(dev, r);
> > > >  		if (!r_align) {
> > > > -			pci_warn(dev, "BAR %d: %pR has bogus
> > > > alignment\n",
> > > > -				 i, r);
> > > > +			pci_warn(dev, "%s: %pR has bogus
> > > > alignment\n",
> > > > +				 r_name, r);
> > > 
> > > Why do you remove the BAR index number, don't you think this
> > > information is also useful?
> > 
> > That's because of how pci_resource_name() works. The number will be 
> > included in the returned string and it won't be always same as i.
> > So that change is done on purpose.
> > 
> > > One could also consider printing r_align, would that be useful?
> > 
> > As per the preceeding condition, it's known to be zero so it's not 
> > that useful for any developer looking at these code lines.
> 
> Ah, right. Would it then make sense then to do:
> 
> pci_warn(dev, "%s: %pR: Alignment must not be zero.\n", ...);
> 
> Would tell then exactly what the problem is. Unless the devs know that
> a bogus alignment is definitely always 0.
> 
> ?

While I personally don't need that given the surrounding code, I can 
change the string to be more precise. Thanks.

-- 
 i.

      reply	other threads:[~2024-10-16 13:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-16 12:00 [PATCH 1/1] PCI: Convert pdev_sort_resources() to use resource name helper Ilpo Järvinen
2024-10-16 13:05 ` Philipp Stanner
2024-10-16 13:15   ` Ilpo Järvinen
2024-10-16 13:19     ` Ilpo Järvinen
2024-10-16 13:21     ` Philipp Stanner
2024-10-16 13:34       ` Ilpo Järvinen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d1202665-1fb7-0a10-7c27-1a9bb0b2ecc4@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=bhelgaas@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=pstanner@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox