public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [x86] pci: Get rid of magic number in AMD bus discovery
@ 2009-07-16  0:28 dann frazier
  2009-07-16 10:09 ` Yinghai Lu
  0 siblings, 1 reply; 3+ messages in thread
From: dann frazier @ 2009-07-16  0:28 UTC (permalink / raw)
  To: linux-kernel; +Cc: Yinghai Lu

The number 4 is hardcoded in a couple of loops.
Use the already-defined PCI_ROOT_NR macro instead.

Signed-off-by: dann frazier <dannf@hp.com>
---
 arch/x86/pci/amd_bus.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/pci/amd_bus.c b/arch/x86/pci/amd_bus.c
index 3ffa10d..feb3e09 100644
--- a/arch/x86/pci/amd_bus.c
+++ b/arch/x86/pci/amd_bus.c
@@ -332,7 +332,7 @@ static int __init early_fill_mp_bus_info(void)
 		return 0;
 
 	pci_root_num = 0;
-	for (i = 0; i < 4; i++) {
+	for (i = 0; i < PCI_ROOT_NR; i++) {
 		int min_bus;
 		int max_bus;
 		reg = read_pci_config(bus, slot, 1, 0xe0 + (i << 2));
@@ -368,7 +368,7 @@ static int __init early_fill_mp_bus_info(void)
 	memset(range, 0, sizeof(range));
 	range[0].end = 0xffff;
 	/* io port resource */
-	for (i = 0; i < 4; i++) {
+	for (i = 0; i < PCI_ROOT_NR; i++) {
 		reg = read_pci_config(bus, slot, 1, 0xc0 + (i << 3));
 		if (!(reg & 3))
 			continue;
-- 
1.6.3.3




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

* Re: [PATCH] [x86] pci: Get rid of magic number in AMD bus discovery
  2009-07-16  0:28 [PATCH] [x86] pci: Get rid of magic number in AMD bus discovery dann frazier
@ 2009-07-16 10:09 ` Yinghai Lu
  2009-07-16 14:58   ` dann frazier
  0 siblings, 1 reply; 3+ messages in thread
From: Yinghai Lu @ 2009-07-16 10:09 UTC (permalink / raw)
  To: dann frazier; +Cc: linux-kernel

dann frazier wrote:
> The number 4 is hardcoded in a couple of loops.
> Use the already-defined PCI_ROOT_NR macro instead.
> 
> Signed-off-by: dann frazier <dannf@hp.com>
> ---
>  arch/x86/pci/amd_bus.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/pci/amd_bus.c b/arch/x86/pci/amd_bus.c
> index 3ffa10d..feb3e09 100644
> --- a/arch/x86/pci/amd_bus.c
> +++ b/arch/x86/pci/amd_bus.c
> @@ -332,7 +332,7 @@ static int __init early_fill_mp_bus_info(void)
>  		return 0;
>  
>  	pci_root_num = 0;
> -	for (i = 0; i < 4; i++) {
> +	for (i = 0; i < PCI_ROOT_NR; i++) {
>  		int min_bus;
>  		int max_bus;
>  		reg = read_pci_config(bus, slot, 1, 0xe0 + (i << 2));
> @@ -368,7 +368,7 @@ static int __init early_fill_mp_bus_info(void)
>  	memset(range, 0, sizeof(range));
>  	range[0].end = 0xffff;
>  	/* io port resource */
> -	for (i = 0; i < 4; i++) {
> +	for (i = 0; i < PCI_ROOT_NR; i++) {
>  		reg = read_pci_config(bus, slot, 1, 0xc0 + (i << 3));
>  		if (!(reg & 3))
>  			continue;

please don't do that.

how about
        /* mmio resource */
        for (i = 0; i < 8; i++) {

those value is decided by HW...

YH

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

* Re: [PATCH] [x86] pci: Get rid of magic number in AMD bus discovery
  2009-07-16 10:09 ` Yinghai Lu
@ 2009-07-16 14:58   ` dann frazier
  0 siblings, 0 replies; 3+ messages in thread
From: dann frazier @ 2009-07-16 14:58 UTC (permalink / raw)
  To: Yinghai Lu; +Cc: linux-kernel

On Thu, Jul 16, 2009 at 03:09:22AM -0700, Yinghai Lu wrote:
> dann frazier wrote:
> > The number 4 is hardcoded in a couple of loops.
> > Use the already-defined PCI_ROOT_NR macro instead.
> > 
> > Signed-off-by: dann frazier <dannf@hp.com>
> > ---
> >  arch/x86/pci/amd_bus.c |    4 ++--
> >  1 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/arch/x86/pci/amd_bus.c b/arch/x86/pci/amd_bus.c
> > index 3ffa10d..feb3e09 100644
> > --- a/arch/x86/pci/amd_bus.c
> > +++ b/arch/x86/pci/amd_bus.c
> > @@ -332,7 +332,7 @@ static int __init early_fill_mp_bus_info(void)
> >  		return 0;
> >  
> >  	pci_root_num = 0;
> > -	for (i = 0; i < 4; i++) {
> > +	for (i = 0; i < PCI_ROOT_NR; i++) {
> >  		int min_bus;
> >  		int max_bus;
> >  		reg = read_pci_config(bus, slot, 1, 0xe0 + (i << 2));
> > @@ -368,7 +368,7 @@ static int __init early_fill_mp_bus_info(void)
> >  	memset(range, 0, sizeof(range));
> >  	range[0].end = 0xffff;
> >  	/* io port resource */
> > -	for (i = 0; i < 4; i++) {
> > +	for (i = 0; i < PCI_ROOT_NR; i++) {
> >  		reg = read_pci_config(bus, slot, 1, 0xc0 + (i << 3));
> >  		if (!(reg & 3))
> >  			continue;
> 
> please don't do that.
> 
> how about
>         /* mmio resource */
>         for (i = 0; i < 8; i++) {
> 
> those value is decided by HW...

Sorry, I don't follow.
My goal was just to remove the magic '4' number and replace it with a
macro instead - not to bump it up. PCI_ROOT_NR looked like the right
value (used in declaring the array we are indexing), but if not maybe
some other macro should be defined?

-- 
dann frazier


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

end of thread, other threads:[~2009-07-16 14:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-16  0:28 [PATCH] [x86] pci: Get rid of magic number in AMD bus discovery dann frazier
2009-07-16 10:09 ` Yinghai Lu
2009-07-16 14:58   ` dann frazier

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