public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [Patch] Janitorial cleanup of GET_INDEX macro in arch/i386/pci/fixup.c
@ 2005-06-27 14:09 Neil Horman
  2005-06-27 22:19 ` Linus Torvalds
  0 siblings, 1 reply; 5+ messages in thread
From: Neil Horman @ 2005-06-27 14:09 UTC (permalink / raw)
  To: linux-kernel; +Cc: greg, jeff.garzik, akpm, torvalds

Patch to clean up the implementation of the GET_INDEX macro in the i386 pci
fixup code so that it uses the PCI_DEVFN macro, rather than re-implements it.

Thanks and Regards
Neil

Signed-off-by: Neil Horman <nhorman@redhat.com>

 fixup.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


--- linux-2.6.git/arch/i386/pci/fixup.c.orig	2005-06-27 09:42:31.000000000 -0400
+++ linux-2.6.git/arch/i386/pci/fixup.c	2005-06-27 09:43:46.000000000 -0400
@@ -253,7 +253,7 @@
 #define MAX_PCIEROOT	6
 static int quirk_aspm_offset[MAX_PCIEROOT << 3];
 
-#define GET_INDEX(a, b) ((((a) - PCI_DEVICE_ID_INTEL_MCH_PA) << 3) + ((b) & 7))
+#define GET_INDEX(a, b) PCI_DEVFN((a - PCI_DEVICE_ID_INTEL_MCH_PA),b)
 
 static int quirk_pcie_aspm_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *value)
 {
-- 
/***************************************************
 *Neil Horman
 *Software Engineer
 *Red Hat, Inc.
 *nhorman@redhat.com
 *gpg keyid: 1024D / 0x92A74FA1
 *http://pgp.mit.edu
 ***************************************************/

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

* Re: [Patch] Janitorial cleanup of GET_INDEX macro in arch/i386/pci/fixup.c
  2005-06-27 14:09 [Patch] Janitorial cleanup of GET_INDEX macro in arch/i386/pci/fixup.c Neil Horman
@ 2005-06-27 22:19 ` Linus Torvalds
  2005-06-27 22:32   ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Linus Torvalds @ 2005-06-27 22:19 UTC (permalink / raw)
  To: Neil Horman; +Cc: linux-kernel, greg, jeff.garzik, akpm



On Mon, 27 Jun 2005, Neil Horman wrote:
>
> Patch to clean up the implementation of the GET_INDEX macro in the i386 pci
> fixup code so that it uses the PCI_DEVFN macro, rather than re-implements it.

This looks wrong:

> -#define GET_INDEX(a, b) ((((a) - PCI_DEVICE_ID_INTEL_MCH_PA) << 3) + ((b) & 7))
> +#define GET_INDEX(a, b) PCI_DEVFN((a - PCI_DEVICE_ID_INTEL_MCH_PA),b)

that first argument looks like it has parentheses at the wrong place, it 
should be

	(a) - PCI_DEVICE_ID_INTEL_MCH_PA

rather than

	(a - PCI_DEVICE_ID_INTEL_MCH_PA)

methinks.

Other than that... Greg?

		Linus

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

* Re: [Patch] Janitorial cleanup of GET_INDEX macro in arch/i386/pci/fixup.c
  2005-06-27 22:19 ` Linus Torvalds
@ 2005-06-27 22:32   ` Greg KH
  2005-06-28 17:13     ` Jeff Garzik
  0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2005-06-27 22:32 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Neil Horman, linux-kernel, jeff.garzik, akpm

On Mon, Jun 27, 2005 at 03:19:11PM -0700, Linus Torvalds wrote:
> 
> 
> On Mon, 27 Jun 2005, Neil Horman wrote:
> >
> > Patch to clean up the implementation of the GET_INDEX macro in the i386 pci
> > fixup code so that it uses the PCI_DEVFN macro, rather than re-implements it.
> 
> This looks wrong:
> 
> > -#define GET_INDEX(a, b) ((((a) - PCI_DEVICE_ID_INTEL_MCH_PA) << 3) + ((b) & 7))
> > +#define GET_INDEX(a, b) PCI_DEVFN((a - PCI_DEVICE_ID_INTEL_MCH_PA),b)
> 
> that first argument looks like it has parentheses at the wrong place, it 
> should be
> 
> 	(a) - PCI_DEVICE_ID_INTEL_MCH_PA
> 
> rather than
> 
> 	(a - PCI_DEVICE_ID_INTEL_MCH_PA)
> 
> methinks.
> 
> Other than that... Greg?

I'd like to say yes, but I'll get an ack by the pci express people from
Intel first (PCI_DEVFN masks off bits that might be needed here, don't
really know...)  Also, this is only used for an array index, not a
pci devfn memory access (look at how it is used in the code...)

I'll put it in my tree for now, and let it get testing, I would not
recommend it for yours just yet.

thanks,

greg k-h

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

* Re: [Patch] Janitorial cleanup of GET_INDEX macro in arch/i386/pci/fixup.c
  2005-06-27 22:32   ` Greg KH
@ 2005-06-28 17:13     ` Jeff Garzik
  2005-06-30  6:42       ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Jeff Garzik @ 2005-06-28 17:13 UTC (permalink / raw)
  To: Greg KH; +Cc: Linus Torvalds, Neil Horman, linux-kernel, jeff.garzik, akpm

Greg KH wrote:
> On Mon, Jun 27, 2005 at 03:19:11PM -0700, Linus Torvalds wrote:
> 
>>
>>On Mon, 27 Jun 2005, Neil Horman wrote:
>>
>>>Patch to clean up the implementation of the GET_INDEX macro in the i386 pci
>>>fixup code so that it uses the PCI_DEVFN macro, rather than re-implements it.
>>
>>This looks wrong:
>>
>>
>>>-#define GET_INDEX(a, b) ((((a) - PCI_DEVICE_ID_INTEL_MCH_PA) << 3) + ((b) & 7))
>>>+#define GET_INDEX(a, b) PCI_DEVFN((a - PCI_DEVICE_ID_INTEL_MCH_PA),b)
>>
>>that first argument looks like it has parentheses at the wrong place, it 
>>should be
>>
>>	(a) - PCI_DEVICE_ID_INTEL_MCH_PA
>>
>>rather than
>>
>>	(a - PCI_DEVICE_ID_INTEL_MCH_PA)
>>
>>methinks.
>>
>>Other than that... Greg?
> 
> 
> I'd like to say yes, but I'll get an ack by the pci express people from
> Intel first (PCI_DEVFN masks off bits that might be needed here, don't
> really know...)  Also, this is only used for an array index, not a
> pci devfn memory access (look at how it is used in the code...)
> 
> I'll put it in my tree for now, and let it get testing, I would not
> recommend it for yours just yet.

Please let me know, as I suggested this patch to Neil.

It sure seems like the code wants a real PCI devfn, even though it is 
obviously doing a table index.

Comments?

	Jeff




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

* Re: [Patch] Janitorial cleanup of GET_INDEX macro in arch/i386/pci/fixup.c
  2005-06-28 17:13     ` Jeff Garzik
@ 2005-06-30  6:42       ` Greg KH
  0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2005-06-30  6:42 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Linus Torvalds, Neil Horman, linux-kernel, jeff.garzik, akpm

On Tue, Jun 28, 2005 at 01:13:39PM -0400, Jeff Garzik wrote:
> Greg KH wrote:
> >On Mon, Jun 27, 2005 at 03:19:11PM -0700, Linus Torvalds wrote:
> >
> >>
> >>On Mon, 27 Jun 2005, Neil Horman wrote:
> >>
> >>>Patch to clean up the implementation of the GET_INDEX macro in the i386 
> >>>pci
> >>>fixup code so that it uses the PCI_DEVFN macro, rather than 
> >>>re-implements it.
> >>
> >>This looks wrong:
> >>
> >>
> >>>-#define GET_INDEX(a, b) ((((a) - PCI_DEVICE_ID_INTEL_MCH_PA) << 3) + 
> >>>((b) & 7))
> >>>+#define GET_INDEX(a, b) PCI_DEVFN((a - PCI_DEVICE_ID_INTEL_MCH_PA),b)
> >>
> >>that first argument looks like it has parentheses at the wrong place, it 
> >>should be
> >>
> >>	(a) - PCI_DEVICE_ID_INTEL_MCH_PA
> >>
> >>rather than
> >>
> >>	(a - PCI_DEVICE_ID_INTEL_MCH_PA)
> >>
> >>methinks.
> >>
> >>Other than that... Greg?
> >
> >
> >I'd like to say yes, but I'll get an ack by the pci express people from
> >Intel first (PCI_DEVFN masks off bits that might be needed here, don't
> >really know...)  Also, this is only used for an array index, not a
> >pci devfn memory access (look at how it is used in the code...)
> >
> >I'll put it in my tree for now, and let it get testing, I would not
> >recommend it for yours just yet.
> 
> Please let me know, as I suggested this patch to Neil.
> 
> It sure seems like the code wants a real PCI devfn, even though it is 
> obviously doing a table index.
> 
> Comments?

I told Andrew to drop the patch, as the code does not want a real PCI devfn.

thanks,

greg k-h

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

end of thread, other threads:[~2005-06-30  8:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-27 14:09 [Patch] Janitorial cleanup of GET_INDEX macro in arch/i386/pci/fixup.c Neil Horman
2005-06-27 22:19 ` Linus Torvalds
2005-06-27 22:32   ` Greg KH
2005-06-28 17:13     ` Jeff Garzik
2005-06-30  6:42       ` Greg KH

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