public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/1] PCI: Improve printout in pdev_sort_resources()
@ 2024-10-17  9:55 Ilpo Järvinen
  2024-10-17 11:12 ` Jonathan Cameron
  2024-10-17 13:49 ` Philipp Stanner
  0 siblings, 2 replies; 6+ messages in thread
From: Ilpo Järvinen @ 2024-10-17  9:55 UTC (permalink / raw)
  To: Philipp Stanner, Bjorn Helgaas, linux-pci, linux-kernel
  Cc: Ilpo Järvinen

Use pci_resource_name() helper in pdev_sort_resources() to print
resources in user-friendly format. Also replace the vague "bogus
alignment" with a more precise explanation of the problem.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---

v2:
- Place colon after %s %pR to be consistent with other printouts
- Replace vague "bogus alignment" with the exact cause

 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..0fd286f79674 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: alignment must not be zero\n",
+				 r_name, r);
 			continue;
 		}
 
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/1] PCI: Improve printout in pdev_sort_resources()
  2024-10-17  9:55 Ilpo Järvinen
@ 2024-10-17 11:12 ` Jonathan Cameron
  2024-10-17 11:35   ` Ilpo Järvinen
  2024-10-17 13:49 ` Philipp Stanner
  1 sibling, 1 reply; 6+ messages in thread
From: Jonathan Cameron @ 2024-10-17 11:12 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Philipp Stanner, Bjorn Helgaas, linux-pci, linux-kernel

On Thu, 17 Oct 2024 12:55:45 +0300
Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> wrote:

> Use pci_resource_name() helper in pdev_sort_resources() to print
> resources in user-friendly format. Also replace the vague "bogus
> alignment" with a more precise explanation of the problem.
> 
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> ---
> 
> v2:
> - Place colon after %s %pR to be consistent with other printouts
> - Replace vague "bogus alignment" with the exact cause
> 
>  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..0fd286f79674 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: alignment must not be zero\n",
> +				 r_name, r);
Why bother with local variable if only used here?
Absolutely fine if you have more code coming that uses it again though!

Otherwise seems sensible change.

>  			continue;
>  		}
>  


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/1] PCI: Improve printout in pdev_sort_resources()
  2024-10-17 11:12 ` Jonathan Cameron
@ 2024-10-17 11:35   ` Ilpo Järvinen
  2024-10-17 13:29     ` Jonathan Cameron
  0 siblings, 1 reply; 6+ messages in thread
From: Ilpo Järvinen @ 2024-10-17 11:35 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: Philipp Stanner, Bjorn Helgaas, linux-pci, LKML

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

On Thu, 17 Oct 2024, Jonathan Cameron wrote:

> On Thu, 17 Oct 2024 12:55:45 +0300
> Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> wrote:
> 
> > Use pci_resource_name() helper in pdev_sort_resources() to print
> > resources in user-friendly format. Also replace the vague "bogus
> > alignment" with a more precise explanation of the problem.
> > 
> > Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> > ---
> > 
> > v2:
> > - Place colon after %s %pR to be consistent with other printouts
> > - Replace vague "bogus alignment" with the exact cause
> > 
> >  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..0fd286f79674 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: alignment must not be zero\n",
> > +				 r_name, r);
>
> Why bother with local variable if only used here?

No other reason than it seems to always be a local variable in the other 
places too regardless the number of uses.

> Absolutely fine if you have more code coming that uses it again though!
> 
> Otherwise seems sensible change.

-- 
 i.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/1] PCI: Improve printout in pdev_sort_resources()
  2024-10-17 11:35   ` Ilpo Järvinen
@ 2024-10-17 13:29     ` Jonathan Cameron
  0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2024-10-17 13:29 UTC (permalink / raw)
  To: Ilpo Järvinen; +Cc: Philipp Stanner, Bjorn Helgaas, linux-pci, LKML

On Thu, 17 Oct 2024 14:35:55 +0300 (EEST)
Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> wrote:

> On Thu, 17 Oct 2024, Jonathan Cameron wrote:
> 
> > On Thu, 17 Oct 2024 12:55:45 +0300
> > Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> wrote:
> >   
> > > Use pci_resource_name() helper in pdev_sort_resources() to print
> > > resources in user-friendly format. Also replace the vague "bogus
> > > alignment" with a more precise explanation of the problem.
> > > 
> > > Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> > > ---
> > > 
> > > v2:
> > > - Place colon after %s %pR to be consistent with other printouts
> > > - Replace vague "bogus alignment" with the exact cause
> > > 
> > >  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..0fd286f79674 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: alignment must not be zero\n",
> > > +				 r_name, r);  
> >
> > Why bother with local variable if only used here?  
> 
> No other reason than it seems to always be a local variable in the other 
> places too regardless the number of uses.
Fair enough. local style is perfectly valid reasoning.

Jonathan

> 
> > Absolutely fine if you have more code coming that uses it again though!
> > 
> > Otherwise seems sensible change.  
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/1] PCI: Improve printout in pdev_sort_resources()
  2024-10-17  9:55 Ilpo Järvinen
  2024-10-17 11:12 ` Jonathan Cameron
@ 2024-10-17 13:49 ` Philipp Stanner
  1 sibling, 0 replies; 6+ messages in thread
From: Philipp Stanner @ 2024-10-17 13:49 UTC (permalink / raw)
  To: Ilpo Järvinen, Bjorn Helgaas, linux-pci, linux-kernel

On Thu, 2024-10-17 at 12:55 +0300, Ilpo Järvinen wrote:
> Use pci_resource_name() helper in pdev_sort_resources() to print
> resources in user-friendly format. Also replace the vague "bogus
> alignment" with a more precise explanation of the problem.
> 
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Reviewed-by: Philipp Stanner <pstanner@redhat.com>

> ---
> 
> v2:
> - Place colon after %s %pR to be consistent with other printouts
> - Replace vague "bogus alignment" with the exact cause
> 
>  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..0fd286f79674 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: alignment must not be
> zero\n",
> +				 r_name, r);
>  			continue;
>  		}
>  


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/1] PCI: Improve printout in pdev_sort_resources()
       [not found] <20241018234258.GA770341@bhelgaas>
@ 2024-10-21 17:53 ` Bjorn Helgaas
  0 siblings, 0 replies; 6+ messages in thread
From: Bjorn Helgaas @ 2024-10-21 17:53 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Jonathan Cameron, Philipp Stanner, linux-pci, linux-kernel

Oops, I inadvertently removed the cc list when I sent the response
below.  Adding it back here.

On Fri, Oct 18, 2024 at 06:42:59PM -0500, Bjorn Helgaas wrote:
> [+cc Jonathan]
> 
> On Thu, Oct 17, 2024 at 12:55:45PM +0300, Ilpo Järvinen wrote:
> > Use pci_resource_name() helper in pdev_sort_resources() to print
> > resources in user-friendly format. Also replace the vague "bogus
> > alignment" with a more precise explanation of the problem.
> > 
> > Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> 
> Applied with Philipp's reviewed-by to pci/resource for v6.13, thanks!
> 
> Happy to add yours, too, Jonathan, if you want.  You basically said
> so, but I don't want to presume :)
> 
> > ---
> > 
> > v2:
> > - Place colon after %s %pR to be consistent with other printouts
> > - Replace vague "bogus alignment" with the exact cause
> > 
> >  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..0fd286f79674 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: alignment must not be zero\n",
> > +				 r_name, r);
> >  			continue;
> >  		}
> >  
> > -- 
> > 2.39.5
> > 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-10-21 17:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20241018234258.GA770341@bhelgaas>
2024-10-21 17:53 ` [PATCH v2 1/1] PCI: Improve printout in pdev_sort_resources() Bjorn Helgaas
2024-10-17  9:55 Ilpo Järvinen
2024-10-17 11:12 ` Jonathan Cameron
2024-10-17 11:35   ` Ilpo Järvinen
2024-10-17 13:29     ` Jonathan Cameron
2024-10-17 13:49 ` Philipp Stanner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox