Skip to contentSkip to conversation

Janitorial cleanup of GET_INDEX macro in arch/i386/pci/fixup.c

PATCH In review Neil Horman 4 participants 5 messages Jun 27, 2005 – Jun 30, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Janitorial cleanup of GET_INDEX macro in arch/i386/pci/fixup.c

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

 fixup.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)
arch/i386/pci/fixup.c renamed from arch/i386/pci/fixup.c.orig +1 -1
@@ -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)
 {
Signature · 8 lines
/***************************************************
 *Neil Horman
 *Software Engineer
 *Red Hat, Inc.
 *[email protected]
 *gpg keyid: 1024D / 0x92A74FA1
 *http://pgp.mit.edu
 ***************************************************/
#1 lore raw
Quoted 3 lines · Neil Horman

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:

arch/i386/pci/fixup.c line 256

Quoted 2 lines
arch/i386/pci/fixup.c renamed from arch/i386/pci/fixup.c.orig +1 -1
-#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

#2 lore raw
Quoted 17 lines · Linus Torvalds
Quoted 3 lines · Neil Horman

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:

arch/i386/pci/fixup.c line 256

Quoted 2 lines
arch/i386/pci/fixup.c renamed from arch/i386/pci/fixup.c.orig +1 -1
-#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

Quoted 7 lines

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

#3 lore raw
Quoted 27 lines · Greg KH
Quoted 16 lines · Linus Torvalds
Quoted 2 lines · Neil Horman

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:

arch/i386/pci/fixup.c line 256

Quoted 2 lines
arch/i386/pci/fixup.c renamed from arch/i386/pci/fixup.c.orig +1 -1
-#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

Quoted 7 lines

rather than

(a - PCI_DEVICE_ID_INTEL_MCH_PA)

methinks.

Other than that... Greg?

Quoted 7 lines

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

#4 lore raw
Quoted 40 lines · Jeff Garzik
Quoted 31 lines · Greg KH
Quoted 20 lines · Linus Torvalds
Quoted 4 lines · Neil Horman

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:

Quoted 3 lines

-#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

Quoted 7 lines

rather than

(a - PCI_DEVICE_ID_INTEL_MCH_PA)

methinks.

Other than that... Greg?

Quoted 7 lines

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.

Quoted 6 lines

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