Re: [PATCH] kernel/fork.c: VM accounting bugfix (2.6.11-rc3-bk5)

2005-02-09 Thread Mark F. Haigh
Chris Wright wrote:

You missed one subtle point.  That failure case actually unaccts 0 pages
(note the use of charge).  Not the nicest, but I believe correct.
Right.  I did miss that.  Thanks for the explanations, Chris and Hugh, I 
appreciate it.

Mark F. Haigh
[EMAIL PROTECTED]
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] kernel/fork.c: VM accounting bugfix (2.6.11-rc3-bk5)

2005-02-09 Thread Mark F. Haigh
Chris Wright wrote:
snip
You missed one subtle point.  That failure case actually unaccts 0 pages
(note the use of charge).  Not the nicest, but I believe correct.
Right.  I did miss that.  Thanks for the explanations, Chris and Hugh, I 
appreciate it.

Mark F. Haigh
[EMAIL PROTECTED]
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] kernel/fork.c: VM accounting bugfix (2.6.11-rc3-bk5)

2005-02-08 Thread Mark F. Haigh
[Aargh!  Missing Signed-off-by.]
Unless I'm missing something, in kernel/fork.c, dup_mmap():
if (security_vm_enough_memory(len))
goto fail_nomem;
/* ... */
fail_nomem:
retval = -ENOMEM;
vm_unacct_memory(charge);
/* ... */
If security_vm_enough_memory() fails there, then we vm_unacct_memory()
that we never accounted (if security_vm_enough_memory() fails, no memory
is accounted).
If it is in fact a bug, a simple but largely untested patch (against
2.6.11-rc3-bk5) is included.
Mark F. Haigh
[EMAIL PROTECTED]
Signed-off-by: Mark F. Haigh  <[EMAIL PROTECTED]>
--- linux-2.6.11-rc3-bk5/kernel/fork.c.orig 2005-02-08 19:12:26.254589504 
-0800
+++ linux-2.6.11-rc3-bk5/kernel/fork.c  2005-02-08 19:16:30.756419576 -0800
@@ -193,8 +193,10 @@
charge = 0;
if (mpnt->vm_flags & VM_ACCOUNT) {
unsigned int len = (mpnt->vm_end - mpnt->vm_start) >> 
PAGE_SHIFT;
-   if (security_vm_enough_memory(len))
-   goto fail_nomem;
+   if (security_vm_enough_memory(len)) {
+   retval = -ENOMEM;
+   goto out;
+   }
charge = len;
}
tmp = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);



[PATCH] kernel/fork.c: VM accounting bugfix (2.6.11-rc3-bk5)

2005-02-08 Thread Mark F. Haigh
Unless I'm missing something, in kernel/fork.c, dup_mmap():
if (security_vm_enough_memory(len))
goto fail_nomem;
/* ... */
fail_nomem:
retval = -ENOMEM;
vm_unacct_memory(charge);
/* ... */
If security_vm_enough_memory() fails there, then we vm_unacct_memory() 
that we never accounted (if security_vm_enough_memory() fails, no memory 
is accounted).

If it is in fact a bug, a simple but largely untested patch (against 
2.6.11-rc3-bk5) is included.

Mark F. Haigh
[EMAIL PROTECTED]
--- linux-2.6.11-rc3-bk5/kernel/fork.c.orig 2005-02-08 19:12:26.254589504 
-0800
+++ linux-2.6.11-rc3-bk5/kernel/fork.c  2005-02-08 19:16:30.756419576 -0800
@@ -193,8 +193,10 @@
charge = 0;
if (mpnt->vm_flags & VM_ACCOUNT) {
unsigned int len = (mpnt->vm_end - mpnt->vm_start) >> 
PAGE_SHIFT;
-   if (security_vm_enough_memory(len))
-   goto fail_nomem;
+   if (security_vm_enough_memory(len)) {
+   retval = -ENOMEM;
+   goto out;
+   }
charge = len;
}
tmp = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);


[PATCH] kernel/fork.c: VM accounting bugfix (2.6.11-rc3-bk5)

2005-02-08 Thread Mark F. Haigh
Unless I'm missing something, in kernel/fork.c, dup_mmap():
if (security_vm_enough_memory(len))
goto fail_nomem;
/* ... */
fail_nomem:
retval = -ENOMEM;
vm_unacct_memory(charge);
/* ... */
If security_vm_enough_memory() fails there, then we vm_unacct_memory() 
that we never accounted (if security_vm_enough_memory() fails, no memory 
is accounted).

If it is in fact a bug, a simple but largely untested patch (against 
2.6.11-rc3-bk5) is included.

Mark F. Haigh
[EMAIL PROTECTED]
--- linux-2.6.11-rc3-bk5/kernel/fork.c.orig 2005-02-08 19:12:26.254589504 
-0800
+++ linux-2.6.11-rc3-bk5/kernel/fork.c  2005-02-08 19:16:30.756419576 -0800
@@ -193,8 +193,10 @@
charge = 0;
if (mpnt-vm_flags  VM_ACCOUNT) {
unsigned int len = (mpnt-vm_end - mpnt-vm_start)  
PAGE_SHIFT;
-   if (security_vm_enough_memory(len))
-   goto fail_nomem;
+   if (security_vm_enough_memory(len)) {
+   retval = -ENOMEM;
+   goto out;
+   }
charge = len;
}
tmp = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);


[PATCH] kernel/fork.c: VM accounting bugfix (2.6.11-rc3-bk5)

2005-02-08 Thread Mark F. Haigh
[Aargh!  Missing Signed-off-by.]
Unless I'm missing something, in kernel/fork.c, dup_mmap():
if (security_vm_enough_memory(len))
goto fail_nomem;
/* ... */
fail_nomem:
retval = -ENOMEM;
vm_unacct_memory(charge);
/* ... */
If security_vm_enough_memory() fails there, then we vm_unacct_memory()
that we never accounted (if security_vm_enough_memory() fails, no memory
is accounted).
If it is in fact a bug, a simple but largely untested patch (against
2.6.11-rc3-bk5) is included.
Mark F. Haigh
[EMAIL PROTECTED]
Signed-off-by: Mark F. Haigh  [EMAIL PROTECTED]
--- linux-2.6.11-rc3-bk5/kernel/fork.c.orig 2005-02-08 19:12:26.254589504 
-0800
+++ linux-2.6.11-rc3-bk5/kernel/fork.c  2005-02-08 19:16:30.756419576 -0800
@@ -193,8 +193,10 @@
charge = 0;
if (mpnt-vm_flags  VM_ACCOUNT) {
unsigned int len = (mpnt-vm_end - mpnt-vm_start)  
PAGE_SHIFT;
-   if (security_vm_enough_memory(len))
-   goto fail_nomem;
+   if (security_vm_enough_memory(len)) {
+   retval = -ENOMEM;
+   goto out;
+   }
charge = len;
}
tmp = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);



Re: [PATCH 2.4.19-bk8] arch/i386/kernel/pci-irq.c: Wrong message output

2005-02-07 Thread Mark F. Haigh
Mark F. Haigh wrote:
Apologies.  Patch now -p1-able.
[Apologies yet again, now includes description]
I'd submitted a patch earlier for this file, fixing a warning.  When I 
looked at it further, I noticed it can output an incorrect warning 
message under certain circumstances.  I've confirmed that this can and 
does happen in the wild:

PCI: Enabling device :00:0a.0 ( -> 0001)
PCI: No IRQ known for interrupt pin @ of device :00:0a.0. Probably 
buggy MP table.

It should read "No IRQ known for interrupt pin A", but the 'pin' 
variable has already been decremented (from 1 to 0), so the line:

printk(KERN_WARNING "PCI: No IRQ known for interrupt pin %c of device 
%s.%s\n", 'A' + pin - 1, dev->slot_name, msg);

causes "pin @" to be output, because 'A' + 0 - 1 == '@'.
This patch also fixes the original warning:
pci-irq.c: In function `pcibios_enable_irq':
pci-irq.c:1128: warning: 'msg' might be used uninitialized in this function
Thanks,
Mark Haigh
[EMAIL PROTECTED]
Signed-off-by:  Mark F. Haigh  <[EMAIL PROTECTED]>
--- linux-2.4.29-bk8/arch/i386/kernel/pci-irq.c.orig2005-02-07 
19:55:23.0 -0800
+++ linux-2.4.29-bk8/arch/i386/kernel/pci-irq.c 2005-02-07 20:13:38.0 
-0800
@@ -1127,6 +1127,8 @@
if (pin && !pcibios_lookup_irq(dev, 1) && !dev->irq) {
char *msg;
 
+   pin--;  /* interrupt pins are numbered starting from 1 
*/
+
/* With IDE legacy devices the IRQ lookup failure is not a 
problem.. */
if (dev->class >> 8 == PCI_CLASS_STORAGE_IDE && !(dev->class & 
0x5))
return;
@@ -1134,42 +1136,39 @@
if (io_apic_assign_pci_irqs) {
int irq;
 
-   if (pin) {
-   pin--;  /* interrupt pins are numbered 
starting from 1 */
-   irq = 
IO_APIC_get_PCI_irq_vector(dev->bus->number, PCI_SLOT(dev->devfn), pin);
-   /*
-* Busses behind bridges are typically not 
listed in the MP-table.
-* In this case we have to look up the IRQ 
based on the parent bus,
-* parent slot, and pin number. The SMP code 
detects such bridged
-* busses itself so we should get into this 
branch reliably.
-*/
-   temp_dev = dev;
-   while (irq < 0 && dev->bus->parent) { /* go 
back to the bridge */
-   struct pci_dev * bridge = 
dev->bus->self;
+   irq = IO_APIC_get_PCI_irq_vector(dev->bus->number, 
PCI_SLOT(dev->devfn), pin);
+   /*
+* Busses behind bridges are typically not listed in 
the MP-table.
+* In this case we have to look up the IRQ based on the 
parent bus,
+* parent slot, and pin number. The SMP code detects 
such bridged
+* busses itself so we should get into this branch 
reliably.
+*/
+   temp_dev = dev;
+   while (irq < 0 && dev->bus->parent) { /* go back to the 
bridge */
+   struct pci_dev * bridge = dev->bus->self;
 
-   pin = (pin + PCI_SLOT(dev->devfn)) % 4;
-   irq = 
IO_APIC_get_PCI_irq_vector(bridge->bus->number, 
-   
PCI_SLOT(bridge->devfn), pin);
-   if (irq >= 0)
-   printk(KERN_WARNING "PCI: using 
PPB(B%d,I%d,P%d) to get irq %d\n", 
-   bridge->bus->number, 
PCI_SLOT(bridge->devfn), pin, irq);
-   dev = bridge;
-   }
-   dev = temp_dev;
-   if (irq >= 0) {
-   printk(KERN_INFO "PCI->APIC IRQ 
transform: (B%d,I%d,P%d) -> %d\n",
-   dev->bus->number, 
PCI_SLOT(dev->devfn), pin, irq);
-   dev->irq = irq;
-   return;
-   } else
-   msg = " Probably buggy MP table.";
+   pin = (pin + PCI_SLOT(dev->devfn)) % 4;
+   irq = 
IO_APIC_get_PCI_irq_vector(bridge->bus->number

Re: [PATCH 2.4.29-bk8] Resend: sym53c8xx.c: Add ULL suffix to fix warning

2005-02-07 Thread Mark F. Haigh
Mark F. Haigh wrote:
Apologies.  Patch now -p1-able.
[Apolgies yet again, description included now]
Noticed that in drivers/scsi/sym53c8xx.c:
sym53c8xx.c:13185: warning: integer constant is too large for "long" type
Since we're not dealing with C99 (yet), this 64 bit integer constant
needs to be suffixed with ULL.  Patch included.
Mark F. Haigh
[EMAIL PROTECTED]
Signed-off-by: Mark F. Haigh  <[EMAIL PROTECTED]>
--- linux-2.4.29-bk8/drivers/scsi/sym53c8xx.c.orig  2005-02-07 
19:53:05.0 -0800
+++ linux-2.4.29-bk8/drivers/scsi/sym53c8xx.c   2005-02-07 19:53:36.0 
-0800
@@ -13182,7 +13182,7 @@
** descriptors.
*/
if (chip && (chip->features & FE_DAC)) {
-   if (pci_set_dma_mask(pdev, (u64) 0xff))
+   if (pci_set_dma_mask(pdev, (u64) 0xffULL))
chip->features &= ~FE_DAC_IN_USE;
else
chip->features |= FE_DAC_IN_USE;


Re: [PATCH 2.6.11-rc3-bk4] arch/i386/kernel/pci/irq.c: Wrong message output

2005-02-07 Thread Mark F. Haigh
Greg KH wrote:

Oops, this time you forgot the whole description of the patch :(
Third time's the charm...
The following has been reported in the wild for kernel 2.6.8-24:
PCI: Enabling device :00:05.0 ( -> 0002)
PCI: No IRQ known for interrupt pin @ of device :00:05.0. Probably 
buggy MP table.

It should read "No IRQ known for interrupt pin A", but the 'pin' 
variable has already been decremented (from 1 to 0), so the line:

printk(KERN_WARNING "PCI: No IRQ known for interrupt pin %c of device 
%s.%s\n", 'A' + pin - 1, dev->slot_name, msg);

causes "pin @" to be output, because 'A' + 0 - 1 == '@'.
The supplied patch should fix it.  It also removes a redundant check for 
a nonzero pin.

Mark F. Haigh
[EMAIL PROTECTED]
Signed-off-by: Mark F. Haigh  <[EMAIL PROTECTED]>
--- linux-2.6.11-rc3-bk4/arch/i386/pci/irq.c.orig   2005-02-07 
20:40:58.0 -0800
+++ linux-2.6.11-rc3-bk4/arch/i386/pci/irq.c2005-02-07 21:39:15.091239272 
-0800
@@ -1031,56 +1031,55 @@
 
pci_read_config_byte(dev, PCI_INTERRUPT_PIN, );
if (pin && !pcibios_lookup_irq(dev, 1) && !dev->irq) {
-   char *msg;
-   msg = "";
+   char *msg = "";
+
+   pin--;  /* interrupt pins are numbered starting from 1 
*/
+
if (io_apic_assign_pci_irqs) {
int irq;
 
-   if (pin) {
-   pin--;  /* interrupt pins are numbered 
starting from 1 */
-   irq = 
IO_APIC_get_PCI_irq_vector(dev->bus->number, PCI_SLOT(dev->devfn), pin);
-   /*
-* Busses behind bridges are typically not 
listed in the MP-table.
-* In this case we have to look up the IRQ 
based on the parent bus,
-* parent slot, and pin number. The SMP code 
detects such bridged
-* busses itself so we should get into this 
branch reliably.
-*/
-   temp_dev = dev;
-   while (irq < 0 && dev->bus->parent) { /* go 
back to the bridge */
-   struct pci_dev * bridge = 
dev->bus->self;
-
-   pin = (pin + PCI_SLOT(dev->devfn)) % 4;
-   irq = 
IO_APIC_get_PCI_irq_vector(bridge->bus->number, 
-   
PCI_SLOT(bridge->devfn), pin);
-   if (irq >= 0)
-   printk(KERN_WARNING "PCI: using 
PPB %s[%c] to get irq %d\n",
-   pci_name(bridge), 'A' + 
pin, irq);
-   dev = bridge;
-   }
-   dev = temp_dev;
-   if (irq >= 0) {
+   irq = IO_APIC_get_PCI_irq_vector(dev->bus->number, 
PCI_SLOT(dev->devfn), pin);
+   /*
+* Busses behind bridges are typically not listed in 
the MP-table.
+* In this case we have to look up the IRQ based on the 
parent bus,
+* parent slot, and pin number. The SMP code detects 
such bridged
+* busses itself so we should get into this branch 
reliably.
+*/
+   temp_dev = dev;
+   while (irq < 0 && dev->bus->parent) { /* go back to the 
bridge */
+   struct pci_dev * bridge = dev->bus->self;
+
+   pin = (pin + PCI_SLOT(dev->devfn)) % 4;
+   irq = 
IO_APIC_get_PCI_irq_vector(bridge->bus->number, 
+   PCI_SLOT(bridge->devfn), pin);
+   if (irq >= 0)
+   printk(KERN_WARNING "PCI: using PPB 
%s[%c] to get irq %d\n",
+   pci_name(bridge), 'A' + pin, 
irq);
+   dev = bridge;
+   }
+   dev = temp_dev;
+   if (irq >= 0) {
 #ifdef CONFIG_PCI_MSI
-   if (!platform_legacy_irq(irq))
-   irq = IO_APIC_VECTOR(irq);
+   if (!platform_legacy_irq(irq))
+   irq = IO_APIC_VECTOR(irq);
 #endif
-   printk(KERN_INFO "PCI->APIC IRQ 
transfo

Re: [PATCH 2.4.19-bk8] arch/i386/kernel/pci-irq.c: Wrong message output

2005-02-07 Thread Mark F. Haigh
Mark F. Haigh wrote:
--- arch/i386/kernel/pci-irq.c.orig 2005-02-07 19:55:23.852531544 -0800
+++ arch/i386/kernel/pci-irq.c  2005-02-07 20:13:38.835068896 -0800
Apologies.  Patch now -p1-able.
Mark F. Haigh
[EMAIL PROTECTED]
Signed-off-by: Mark F. Haigh  <[EMAIL PROTECTED]>
--- linux-2.4.29-bk8/arch/i386/kernel/pci-irq.c.orig2005-02-07 
19:55:23.0 -0800
+++ linux-2.4.29-bk8/arch/i386/kernel/pci-irq.c 2005-02-07 20:13:38.0 
-0800
@@ -1127,6 +1127,8 @@
if (pin && !pcibios_lookup_irq(dev, 1) && !dev->irq) {
char *msg;
 
+   pin--;  /* interrupt pins are numbered starting from 1 
*/
+
/* With IDE legacy devices the IRQ lookup failure is not a 
problem.. */
if (dev->class >> 8 == PCI_CLASS_STORAGE_IDE && !(dev->class & 
0x5))
return;
@@ -1134,42 +1136,39 @@
if (io_apic_assign_pci_irqs) {
int irq;
 
-   if (pin) {
-   pin--;  /* interrupt pins are numbered 
starting from 1 */
-   irq = 
IO_APIC_get_PCI_irq_vector(dev->bus->number, PCI_SLOT(dev->devfn), pin);
-   /*
-* Busses behind bridges are typically not 
listed in the MP-table.
-* In this case we have to look up the IRQ 
based on the parent bus,
-* parent slot, and pin number. The SMP code 
detects such bridged
-* busses itself so we should get into this 
branch reliably.
-*/
-   temp_dev = dev;
-   while (irq < 0 && dev->bus->parent) { /* go 
back to the bridge */
-   struct pci_dev * bridge = 
dev->bus->self;
+   irq = IO_APIC_get_PCI_irq_vector(dev->bus->number, 
PCI_SLOT(dev->devfn), pin);
+   /*
+* Busses behind bridges are typically not listed in 
the MP-table.
+* In this case we have to look up the IRQ based on the 
parent bus,
+* parent slot, and pin number. The SMP code detects 
such bridged
+* busses itself so we should get into this branch 
reliably.
+*/
+   temp_dev = dev;
+   while (irq < 0 && dev->bus->parent) { /* go back to the 
bridge */
+   struct pci_dev * bridge = dev->bus->self;
 
-   pin = (pin + PCI_SLOT(dev->devfn)) % 4;
-   irq = 
IO_APIC_get_PCI_irq_vector(bridge->bus->number, 
-   
PCI_SLOT(bridge->devfn), pin);
-   if (irq >= 0)
-   printk(KERN_WARNING "PCI: using 
PPB(B%d,I%d,P%d) to get irq %d\n", 
-   bridge->bus->number, 
PCI_SLOT(bridge->devfn), pin, irq);
-   dev = bridge;
-   }
-   dev = temp_dev;
-   if (irq >= 0) {
-   printk(KERN_INFO "PCI->APIC IRQ 
transform: (B%d,I%d,P%d) -> %d\n",
-   dev->bus->number, 
PCI_SLOT(dev->devfn), pin, irq);
-   dev->irq = irq;
-   return;
-   } else
-   msg = " Probably buggy MP table.";
+   pin = (pin + PCI_SLOT(dev->devfn)) % 4;
+   irq = 
IO_APIC_get_PCI_irq_vector(bridge->bus->number, 
+   PCI_SLOT(bridge->devfn), pin);
+   if (irq >= 0)
+   printk(KERN_WARNING "PCI: using 
PPB(B%d,I%d,P%d) to get irq %d\n", 
+   bridge->bus->number, 
PCI_SLOT(bridge->devfn), pin, irq);
+   dev = bridge;
}
+   dev = temp_dev;
+   if (irq >= 0) {
+   printk(KERN_INFO "PCI->APIC IRQ transform: 
(B%d,I%d,P%d) -> %d\n",
+   dev->bus->number, PCI_SLOT(dev->devfn), 
pin, irq);
+   dev->irq = irq;
+   return;
+ 

Re: [PATCH 2.4.29-bk8] Resend: sym53c8xx.c: Add ULL suffix to fix warning

2005-02-07 Thread Mark F. Haigh
Mark F. Haigh wrote:
--- drivers/scsi/sym53c8xx.c.orig   2005-02-07 19:53:05.741527608 -0800
+++ drivers/scsi/sym53c8xx.c2005-02-07 19:53:36.782808616 -0800
Apologies.  Patch now -p1-able.
Mark F. Haigh
[EMAIL PROTECTED]
Signed-off-by: Mark F. Haigh  <[EMAIL PROTECTED]>
--- linux-2.4.29-bk8/drivers/scsi/sym53c8xx.c.orig  2005-02-07 
19:53:05.0 -0800
+++ linux-2.4.29-bk8/drivers/scsi/sym53c8xx.c   2005-02-07 19:53:36.0 
-0800
@@ -13182,7 +13182,7 @@
** descriptors.
*/
if (chip && (chip->features & FE_DAC)) {
-   if (pci_set_dma_mask(pdev, (u64) 0xff))
+   if (pci_set_dma_mask(pdev, (u64) 0xffULL))
chip->features &= ~FE_DAC_IN_USE;
else
chip->features |= FE_DAC_IN_USE;


Re: [PATCH 2.6.11-rc3-bk4] arch/i386/kernel/pci/irq.c: Wrong message output

2005-02-07 Thread Mark F. Haigh
Greg KH wrote:
On Mon, Feb 07, 2005 at 09:06:18PM -0800, Mark F. Haigh wrote:

 > --- arch/i386/pci/irq.c.orig  2005-02-07 20:40:58.140856536 -0800
 > +++ arch/i386/pci/irq.c   2005-02-07 20:46:06.713946296 -0800
Can you resend this so it can be applied with -p1 to patch, and a
Signed-off-by: line?
Ack, my fault.
Mark F. Haigh
[EMAIL PROTECTED]
Signed-off-by: Mark F. Haigh  <[EMAIL PROTECTED]>
--- linux-2.6.11-rc3-bk4/arch/i386/pci/irq.c.orig   2005-02-07 
20:40:58.0 -0800
+++ linux-2.6.11-rc3-bk4/arch/i386/pci/irq.c2005-02-07 20:46:06.0 
-0800
@@ -1031,56 +1031,55 @@
 
pci_read_config_byte(dev, PCI_INTERRUPT_PIN, );
if (pin && !pcibios_lookup_irq(dev, 1) && !dev->irq) {
-   char *msg;
-   msg = "";
+   char *msg = "";
+
+   pin--;  /* interrupt pins are numbered starting from 1 
*/
+
if (io_apic_assign_pci_irqs) {
int irq;
 
-   if (pin) {
-   pin--;  /* interrupt pins are numbered 
starting from 1 */
-   irq = 
IO_APIC_get_PCI_irq_vector(dev->bus->number, PCI_SLOT(dev->devfn), pin);
-   /*
-* Busses behind bridges are typically not 
listed in the MP-table.
-* In this case we have to look up the IRQ 
based on the parent bus,
-* parent slot, and pin number. The SMP code 
detects such bridged
-* busses itself so we should get into this 
branch reliably.
-*/
-   temp_dev = dev;
-   while (irq < 0 && dev->bus->parent) { /* go 
back to the bridge */
-   struct pci_dev * bridge = 
dev->bus->self;
-
-   pin = (pin + PCI_SLOT(dev->devfn)) % 4;
-   irq = 
IO_APIC_get_PCI_irq_vector(bridge->bus->number, 
-   
PCI_SLOT(bridge->devfn), pin);
-   if (irq >= 0)
-   printk(KERN_WARNING "PCI: using 
PPB %s[%c] to get irq %d\n",
-   pci_name(bridge), 'A' + 
pin, irq);
-   dev = bridge;
-   }
-   dev = temp_dev;
-   if (irq >= 0) {
+   irq = IO_APIC_get_PCI_irq_vector(dev->bus->number, 
PCI_SLOT(dev->devfn), pin);
+   /*
+* Busses behind bridges are typically not listed in 
the MP-table.
+* In this case we have to look up the IRQ based on the 
parent bus,
+* parent slot, and pin number. The SMP code detects 
such bridged
+* busses itself so we should get into this branch 
reliably.
+*/
+   temp_dev = dev;
+   while (irq < 0 && dev->bus->parent) { /* go back to the 
bridge */
+   struct pci_dev * bridge = dev->bus->self;
+
+   pin = (pin + PCI_SLOT(dev->devfn)) % 4;
+   irq = 
IO_APIC_get_PCI_irq_vector(bridge->bus->number, 
+   PCI_SLOT(bridge->devfn), pin);
+   if (irq >= 0)
+   printk(KERN_WARNING "PCI: using PPB 
%s[%c] to get irq %d\n",
+   pci_name(bridge), 'A' + pin, 
irq);
+   dev = bridge;
+   }
+   dev = temp_dev;
+   if (irq >= 0) {
 #ifdef CONFIG_PCI_MSI
-   if (!platform_legacy_irq(irq))
-   irq = IO_APIC_VECTOR(irq);
+   if (!platform_legacy_irq(irq))
+   irq = IO_APIC_VECTOR(irq);
 #endif
-   printk(KERN_INFO "PCI->APIC IRQ 
transform: %s[%c] -> IRQ %d\n",
-   pci_name(dev), 'A' + pin, irq);
-   dev->irq = irq;
-   return 0;
-   } else
-   msg = " Probably buggy MP table.";
-   }
+   printk(KERN_INFO "PC

[PATCH 2.6.11-rc3-bk4] arch/i386/kernel/pci/irq.c: Wrong message output

2005-02-07 Thread Mark F. Haigh
(Same basic problem I just reported in a seperate thread against 2.4.29-bk8)
The following has been reported in the wild for kernel 2.6.8-24:
PCI: Enabling device :00:05.0 ( -> 0002)
PCI: No IRQ known for interrupt pin @ of device :00:05.0. Probably 
buggy MP table.

It should read "No IRQ known for interrupt pin A", but the 'pin' 
variable has already been decremented (from 1 to 0), so the line:

printk(KERN_WARNING "PCI: No IRQ known for interrupt pin %c of device 
%s.%s\n", 'A' + pin - 1, dev->slot_name, msg);

causes "pin @" to be output, because 'A' + 0 - 1 == '@'.
The supplied patch should fix it.  It also removes a redundant check for 
a nonzero pin.

Mark F. Haigh
[EMAIL PROTECTED]
--- arch/i386/pci/irq.c.orig2005-02-07 20:40:58.140856536 -0800
+++ arch/i386/pci/irq.c 2005-02-07 20:46:06.713946296 -0800
@@ -1031,56 +1031,55 @@
 
pci_read_config_byte(dev, PCI_INTERRUPT_PIN, );
if (pin && !pcibios_lookup_irq(dev, 1) && !dev->irq) {
-   char *msg;
-   msg = "";
+   char *msg = "";
+
+   pin--;  /* interrupt pins are numbered starting from 1 
*/
+
if (io_apic_assign_pci_irqs) {
int irq;
 
-   if (pin) {
-   pin--;  /* interrupt pins are numbered 
starting from 1 */
-   irq = 
IO_APIC_get_PCI_irq_vector(dev->bus->number, PCI_SLOT(dev->devfn), pin);
-   /*
-* Busses behind bridges are typically not 
listed in the MP-table.
-* In this case we have to look up the IRQ 
based on the parent bus,
-* parent slot, and pin number. The SMP code 
detects such bridged
-* busses itself so we should get into this 
branch reliably.
-*/
-   temp_dev = dev;
-   while (irq < 0 && dev->bus->parent) { /* go 
back to the bridge */
-   struct pci_dev * bridge = 
dev->bus->self;
-
-   pin = (pin + PCI_SLOT(dev->devfn)) % 4;
-   irq = 
IO_APIC_get_PCI_irq_vector(bridge->bus->number, 
-   
PCI_SLOT(bridge->devfn), pin);
-   if (irq >= 0)
-   printk(KERN_WARNING "PCI: using 
PPB %s[%c] to get irq %d\n",
-   pci_name(bridge), 'A' + 
pin, irq);
-   dev = bridge;
-   }
-   dev = temp_dev;
-   if (irq >= 0) {
+   irq = IO_APIC_get_PCI_irq_vector(dev->bus->number, 
PCI_SLOT(dev->devfn), pin);
+   /*
+* Busses behind bridges are typically not listed in 
the MP-table.
+* In this case we have to look up the IRQ based on the 
parent bus,
+* parent slot, and pin number. The SMP code detects 
such bridged
+* busses itself so we should get into this branch 
reliably.
+*/
+   temp_dev = dev;
+   while (irq < 0 && dev->bus->parent) { /* go back to the 
bridge */
+   struct pci_dev * bridge = dev->bus->self;
+
+   pin = (pin + PCI_SLOT(dev->devfn)) % 4;
+   irq = 
IO_APIC_get_PCI_irq_vector(bridge->bus->number, 
+   PCI_SLOT(bridge->devfn), pin);
+   if (irq >= 0)
+   printk(KERN_WARNING "PCI: using PPB 
%s[%c] to get irq %d\n",
+   pci_name(bridge), 'A' + pin, 
irq);
+   dev = bridge;
+   }
+   dev = temp_dev;
+   if (irq >= 0) {
 #ifdef CONFIG_PCI_MSI
-   if (!platform_legacy_irq(irq))
-   irq = IO_APIC_VECTOR(irq);
+   if (!platform_legacy_irq(irq))
+   irq = IO_APIC_VECTOR(irq);
 #endif
-   printk(KERN_INFO "PCI->APIC IRQ 
transform: %s[%c] -> IRQ %d\n",
-   pci_name(dev), 'A' + pin, irq);
-

[PATCH 2.4.29-bk8] Resend: sym53c8xx.c: Add ULL suffix to fix warning

2005-02-07 Thread Mark F. Haigh
Same patch, now against 2.4.29-bk8:
Noticed that in drivers/scsi/sym53c8xx.c:
sym53c8xx.c:13185: warning: integer constant is too large for "long" type
Since we're not dealing with C99 (yet), this 64 bit integer constant
needs to be suffixed with ULL.  Patch included.
Mark F. Haigh
[EMAIL PROTECTED]

--- drivers/scsi/sym53c8xx.c.orig   2005-02-07 19:53:05.741527608 -0800
+++ drivers/scsi/sym53c8xx.c2005-02-07 19:53:36.782808616 -0800
@@ -13182,7 +13182,7 @@
** descriptors.
*/
if (chip && (chip->features & FE_DAC)) {
-   if (pci_set_dma_mask(pdev, (u64) 0xff))
+   if (pci_set_dma_mask(pdev, (u64) 0xffULL))
chip->features &= ~FE_DAC_IN_USE;
else
chip->features |= FE_DAC_IN_USE;


[PATCH 2.4.19-bk8] arch/i386/kernel/pci-irq.c: Wrong message output

2005-02-07 Thread Mark F. Haigh
I'd submitted a patch earlier for this file, fixing a warning.  When I 
looked at it further, I noticed it can output an incorrect warning 
message under certain circumstances.  I've confirmed that this can and 
does happen in the wild:

PCI: Enabling device :00:0a.0 ( -> 0001)
PCI: No IRQ known for interrupt pin @ of device :00:0a.0. Probably 
buggy MP table.

It should read "No IRQ known for interrupt pin A", but the 'pin' 
variable has already been decremented (from 1 to 0), so the line:

printk(KERN_WARNING "PCI: No IRQ known for interrupt pin %c of device 
%s.%s\n", 'A' + pin - 1, dev->slot_name, msg);

causes "pin @" to be output, because 'A' + 0 - 1 == '@'.
This patch also fixes the original warning:
pci-irq.c: In function `pcibios_enable_irq':
pci-irq.c:1128: warning: 'msg' might be used uninitialized in this function
Thanks,
Mark Haigh
[EMAIL PROTECTED]
--- arch/i386/kernel/pci-irq.c.orig 2005-02-07 19:55:23.852531544 -0800
+++ arch/i386/kernel/pci-irq.c  2005-02-07 20:13:38.835068896 -0800
@@ -1127,6 +1127,8 @@
if (pin && !pcibios_lookup_irq(dev, 1) && !dev->irq) {
char *msg;
 
+   pin--;  /* interrupt pins are numbered starting from 1 
*/
+
/* With IDE legacy devices the IRQ lookup failure is not a 
problem.. */
if (dev->class >> 8 == PCI_CLASS_STORAGE_IDE && !(dev->class & 
0x5))
return;
@@ -1134,42 +1136,39 @@
if (io_apic_assign_pci_irqs) {
int irq;
 
-   if (pin) {
-   pin--;  /* interrupt pins are numbered 
starting from 1 */
-   irq = 
IO_APIC_get_PCI_irq_vector(dev->bus->number, PCI_SLOT(dev->devfn), pin);
-   /*
-* Busses behind bridges are typically not 
listed in the MP-table.
-* In this case we have to look up the IRQ 
based on the parent bus,
-* parent slot, and pin number. The SMP code 
detects such bridged
-* busses itself so we should get into this 
branch reliably.
-*/
-   temp_dev = dev;
-   while (irq < 0 && dev->bus->parent) { /* go 
back to the bridge */
-   struct pci_dev * bridge = 
dev->bus->self;
+   irq = IO_APIC_get_PCI_irq_vector(dev->bus->number, 
PCI_SLOT(dev->devfn), pin);
+   /*
+* Busses behind bridges are typically not listed in 
the MP-table.
+* In this case we have to look up the IRQ based on the 
parent bus,
+* parent slot, and pin number. The SMP code detects 
such bridged
+* busses itself so we should get into this branch 
reliably.
+*/
+   temp_dev = dev;
+   while (irq < 0 && dev->bus->parent) { /* go back to the 
bridge */
+   struct pci_dev * bridge = dev->bus->self;
 
-   pin = (pin + PCI_SLOT(dev->devfn)) % 4;
-   irq = 
IO_APIC_get_PCI_irq_vector(bridge->bus->number, 
-   
PCI_SLOT(bridge->devfn), pin);
-   if (irq >= 0)
-   printk(KERN_WARNING "PCI: using 
PPB(B%d,I%d,P%d) to get irq %d\n", 
-   bridge->bus->number, 
PCI_SLOT(bridge->devfn), pin, irq);
-   dev = bridge;
-   }
-   dev = temp_dev;
-   if (irq >= 0) {
-   printk(KERN_INFO "PCI->APIC IRQ 
transform: (B%d,I%d,P%d) -> %d\n",
-   dev->bus->number, 
PCI_SLOT(dev->devfn), pin, irq);
-   dev->irq = irq;
-   return;
-   } else
-   msg = " Probably buggy MP table.";
+   pin = (pin + PCI_SLOT(dev->devfn)) % 4;
+   irq = 
IO_APIC_get_PCI_irq_vector(bridge->bus->number, 
+   PCI_SLOT(bridge->devfn), pin);
+   if (irq >= 0)
+   printk(KERN_WARNING "PCI: using 
PPB(B%d,I%d,P%d) to get irq %d\n", 
+   bridge->bus->number, 
PCI_SLOT(bridge->devfn), pin, irq);
+   dev = bridge;
}
+   dev = temp_dev;
+   

[PATCH 2.4.19-bk8] arch/i386/kernel/pci-irq.c: Wrong message output

2005-02-07 Thread Mark F. Haigh
I'd submitted a patch earlier for this file, fixing a warning.  When I 
looked at it further, I noticed it can output an incorrect warning 
message under certain circumstances.  I've confirmed that this can and 
does happen in the wild:

PCI: Enabling device :00:0a.0 ( - 0001)
PCI: No IRQ known for interrupt pin @ of device :00:0a.0. Probably 
buggy MP table.

It should read No IRQ known for interrupt pin A, but the 'pin' 
variable has already been decremented (from 1 to 0), so the line:

printk(KERN_WARNING PCI: No IRQ known for interrupt pin %c of device 
%s.%s\n, 'A' + pin - 1, dev-slot_name, msg);

causes pin @ to be output, because 'A' + 0 - 1 == '@'.
This patch also fixes the original warning:
pci-irq.c: In function `pcibios_enable_irq':
pci-irq.c:1128: warning: 'msg' might be used uninitialized in this function
Thanks,
Mark Haigh
[EMAIL PROTECTED]
--- arch/i386/kernel/pci-irq.c.orig 2005-02-07 19:55:23.852531544 -0800
+++ arch/i386/kernel/pci-irq.c  2005-02-07 20:13:38.835068896 -0800
@@ -1127,6 +1127,8 @@
if (pin  !pcibios_lookup_irq(dev, 1)  !dev-irq) {
char *msg;
 
+   pin--;  /* interrupt pins are numbered starting from 1 
*/
+
/* With IDE legacy devices the IRQ lookup failure is not a 
problem.. */
if (dev-class  8 == PCI_CLASS_STORAGE_IDE  !(dev-class  
0x5))
return;
@@ -1134,42 +1136,39 @@
if (io_apic_assign_pci_irqs) {
int irq;
 
-   if (pin) {
-   pin--;  /* interrupt pins are numbered 
starting from 1 */
-   irq = 
IO_APIC_get_PCI_irq_vector(dev-bus-number, PCI_SLOT(dev-devfn), pin);
-   /*
-* Busses behind bridges are typically not 
listed in the MP-table.
-* In this case we have to look up the IRQ 
based on the parent bus,
-* parent slot, and pin number. The SMP code 
detects such bridged
-* busses itself so we should get into this 
branch reliably.
-*/
-   temp_dev = dev;
-   while (irq  0  dev-bus-parent) { /* go 
back to the bridge */
-   struct pci_dev * bridge = 
dev-bus-self;
+   irq = IO_APIC_get_PCI_irq_vector(dev-bus-number, 
PCI_SLOT(dev-devfn), pin);
+   /*
+* Busses behind bridges are typically not listed in 
the MP-table.
+* In this case we have to look up the IRQ based on the 
parent bus,
+* parent slot, and pin number. The SMP code detects 
such bridged
+* busses itself so we should get into this branch 
reliably.
+*/
+   temp_dev = dev;
+   while (irq  0  dev-bus-parent) { /* go back to the 
bridge */
+   struct pci_dev * bridge = dev-bus-self;
 
-   pin = (pin + PCI_SLOT(dev-devfn)) % 4;
-   irq = 
IO_APIC_get_PCI_irq_vector(bridge-bus-number, 
-   
PCI_SLOT(bridge-devfn), pin);
-   if (irq = 0)
-   printk(KERN_WARNING PCI: using 
PPB(B%d,I%d,P%d) to get irq %d\n, 
-   bridge-bus-number, 
PCI_SLOT(bridge-devfn), pin, irq);
-   dev = bridge;
-   }
-   dev = temp_dev;
-   if (irq = 0) {
-   printk(KERN_INFO PCI-APIC IRQ 
transform: (B%d,I%d,P%d) - %d\n,
-   dev-bus-number, 
PCI_SLOT(dev-devfn), pin, irq);
-   dev-irq = irq;
-   return;
-   } else
-   msg =  Probably buggy MP table.;
+   pin = (pin + PCI_SLOT(dev-devfn)) % 4;
+   irq = 
IO_APIC_get_PCI_irq_vector(bridge-bus-number, 
+   PCI_SLOT(bridge-devfn), pin);
+   if (irq = 0)
+   printk(KERN_WARNING PCI: using 
PPB(B%d,I%d,P%d) to get irq %d\n, 
+   bridge-bus-number, 
PCI_SLOT(bridge-devfn), pin, irq);
+   dev = bridge;
}
+   dev = temp_dev;
+   if (irq = 0) {
+   

[PATCH 2.4.29-bk8] Resend: sym53c8xx.c: Add ULL suffix to fix warning

2005-02-07 Thread Mark F. Haigh
Same patch, now against 2.4.29-bk8:
Noticed that in drivers/scsi/sym53c8xx.c:
sym53c8xx.c:13185: warning: integer constant is too large for long type
Since we're not dealing with C99 (yet), this 64 bit integer constant
needs to be suffixed with ULL.  Patch included.
Mark F. Haigh
[EMAIL PROTECTED]

--- drivers/scsi/sym53c8xx.c.orig   2005-02-07 19:53:05.741527608 -0800
+++ drivers/scsi/sym53c8xx.c2005-02-07 19:53:36.782808616 -0800
@@ -13182,7 +13182,7 @@
** descriptors.
*/
if (chip  (chip-features  FE_DAC)) {
-   if (pci_set_dma_mask(pdev, (u64) 0xff))
+   if (pci_set_dma_mask(pdev, (u64) 0xffULL))
chip-features = ~FE_DAC_IN_USE;
else
chip-features |= FE_DAC_IN_USE;


[PATCH 2.6.11-rc3-bk4] arch/i386/kernel/pci/irq.c: Wrong message output

2005-02-07 Thread Mark F. Haigh
(Same basic problem I just reported in a seperate thread against 2.4.29-bk8)
The following has been reported in the wild for kernel 2.6.8-24:
PCI: Enabling device :00:05.0 ( - 0002)
PCI: No IRQ known for interrupt pin @ of device :00:05.0. Probably 
buggy MP table.

It should read No IRQ known for interrupt pin A, but the 'pin' 
variable has already been decremented (from 1 to 0), so the line:

printk(KERN_WARNING PCI: No IRQ known for interrupt pin %c of device 
%s.%s\n, 'A' + pin - 1, dev-slot_name, msg);

causes pin @ to be output, because 'A' + 0 - 1 == '@'.
The supplied patch should fix it.  It also removes a redundant check for 
a nonzero pin.

Mark F. Haigh
[EMAIL PROTECTED]
--- arch/i386/pci/irq.c.orig2005-02-07 20:40:58.140856536 -0800
+++ arch/i386/pci/irq.c 2005-02-07 20:46:06.713946296 -0800
@@ -1031,56 +1031,55 @@
 
pci_read_config_byte(dev, PCI_INTERRUPT_PIN, pin);
if (pin  !pcibios_lookup_irq(dev, 1)  !dev-irq) {
-   char *msg;
-   msg = ;
+   char *msg = ;
+
+   pin--;  /* interrupt pins are numbered starting from 1 
*/
+
if (io_apic_assign_pci_irqs) {
int irq;
 
-   if (pin) {
-   pin--;  /* interrupt pins are numbered 
starting from 1 */
-   irq = 
IO_APIC_get_PCI_irq_vector(dev-bus-number, PCI_SLOT(dev-devfn), pin);
-   /*
-* Busses behind bridges are typically not 
listed in the MP-table.
-* In this case we have to look up the IRQ 
based on the parent bus,
-* parent slot, and pin number. The SMP code 
detects such bridged
-* busses itself so we should get into this 
branch reliably.
-*/
-   temp_dev = dev;
-   while (irq  0  dev-bus-parent) { /* go 
back to the bridge */
-   struct pci_dev * bridge = 
dev-bus-self;
-
-   pin = (pin + PCI_SLOT(dev-devfn)) % 4;
-   irq = 
IO_APIC_get_PCI_irq_vector(bridge-bus-number, 
-   
PCI_SLOT(bridge-devfn), pin);
-   if (irq = 0)
-   printk(KERN_WARNING PCI: using 
PPB %s[%c] to get irq %d\n,
-   pci_name(bridge), 'A' + 
pin, irq);
-   dev = bridge;
-   }
-   dev = temp_dev;
-   if (irq = 0) {
+   irq = IO_APIC_get_PCI_irq_vector(dev-bus-number, 
PCI_SLOT(dev-devfn), pin);
+   /*
+* Busses behind bridges are typically not listed in 
the MP-table.
+* In this case we have to look up the IRQ based on the 
parent bus,
+* parent slot, and pin number. The SMP code detects 
such bridged
+* busses itself so we should get into this branch 
reliably.
+*/
+   temp_dev = dev;
+   while (irq  0  dev-bus-parent) { /* go back to the 
bridge */
+   struct pci_dev * bridge = dev-bus-self;
+
+   pin = (pin + PCI_SLOT(dev-devfn)) % 4;
+   irq = 
IO_APIC_get_PCI_irq_vector(bridge-bus-number, 
+   PCI_SLOT(bridge-devfn), pin);
+   if (irq = 0)
+   printk(KERN_WARNING PCI: using PPB 
%s[%c] to get irq %d\n,
+   pci_name(bridge), 'A' + pin, 
irq);
+   dev = bridge;
+   }
+   dev = temp_dev;
+   if (irq = 0) {
 #ifdef CONFIG_PCI_MSI
-   if (!platform_legacy_irq(irq))
-   irq = IO_APIC_VECTOR(irq);
+   if (!platform_legacy_irq(irq))
+   irq = IO_APIC_VECTOR(irq);
 #endif
-   printk(KERN_INFO PCI-APIC IRQ 
transform: %s[%c] - IRQ %d\n,
-   pci_name(dev), 'A' + pin, irq);
-   dev-irq = irq;
-   return 0;
-   } else
-   msg =  Probably buggy MP table.;
-   }
+   printk(KERN_INFO PCI-APIC IRQ transform: 
%s[%c

Re: [PATCH 2.6.11-rc3-bk4] arch/i386/kernel/pci/irq.c: Wrong message output

2005-02-07 Thread Mark F. Haigh
Greg KH wrote:
On Mon, Feb 07, 2005 at 09:06:18PM -0800, Mark F. Haigh wrote:
snip
  --- arch/i386/pci/irq.c.orig  2005-02-07 20:40:58.140856536 -0800
  +++ arch/i386/pci/irq.c   2005-02-07 20:46:06.713946296 -0800
Can you resend this so it can be applied with -p1 to patch, and a
Signed-off-by: line?
Ack, my fault.
Mark F. Haigh
[EMAIL PROTECTED]
Signed-off-by: Mark F. Haigh  [EMAIL PROTECTED]
--- linux-2.6.11-rc3-bk4/arch/i386/pci/irq.c.orig   2005-02-07 
20:40:58.0 -0800
+++ linux-2.6.11-rc3-bk4/arch/i386/pci/irq.c2005-02-07 20:46:06.0 
-0800
@@ -1031,56 +1031,55 @@
 
pci_read_config_byte(dev, PCI_INTERRUPT_PIN, pin);
if (pin  !pcibios_lookup_irq(dev, 1)  !dev-irq) {
-   char *msg;
-   msg = ;
+   char *msg = ;
+
+   pin--;  /* interrupt pins are numbered starting from 1 
*/
+
if (io_apic_assign_pci_irqs) {
int irq;
 
-   if (pin) {
-   pin--;  /* interrupt pins are numbered 
starting from 1 */
-   irq = 
IO_APIC_get_PCI_irq_vector(dev-bus-number, PCI_SLOT(dev-devfn), pin);
-   /*
-* Busses behind bridges are typically not 
listed in the MP-table.
-* In this case we have to look up the IRQ 
based on the parent bus,
-* parent slot, and pin number. The SMP code 
detects such bridged
-* busses itself so we should get into this 
branch reliably.
-*/
-   temp_dev = dev;
-   while (irq  0  dev-bus-parent) { /* go 
back to the bridge */
-   struct pci_dev * bridge = 
dev-bus-self;
-
-   pin = (pin + PCI_SLOT(dev-devfn)) % 4;
-   irq = 
IO_APIC_get_PCI_irq_vector(bridge-bus-number, 
-   
PCI_SLOT(bridge-devfn), pin);
-   if (irq = 0)
-   printk(KERN_WARNING PCI: using 
PPB %s[%c] to get irq %d\n,
-   pci_name(bridge), 'A' + 
pin, irq);
-   dev = bridge;
-   }
-   dev = temp_dev;
-   if (irq = 0) {
+   irq = IO_APIC_get_PCI_irq_vector(dev-bus-number, 
PCI_SLOT(dev-devfn), pin);
+   /*
+* Busses behind bridges are typically not listed in 
the MP-table.
+* In this case we have to look up the IRQ based on the 
parent bus,
+* parent slot, and pin number. The SMP code detects 
such bridged
+* busses itself so we should get into this branch 
reliably.
+*/
+   temp_dev = dev;
+   while (irq  0  dev-bus-parent) { /* go back to the 
bridge */
+   struct pci_dev * bridge = dev-bus-self;
+
+   pin = (pin + PCI_SLOT(dev-devfn)) % 4;
+   irq = 
IO_APIC_get_PCI_irq_vector(bridge-bus-number, 
+   PCI_SLOT(bridge-devfn), pin);
+   if (irq = 0)
+   printk(KERN_WARNING PCI: using PPB 
%s[%c] to get irq %d\n,
+   pci_name(bridge), 'A' + pin, 
irq);
+   dev = bridge;
+   }
+   dev = temp_dev;
+   if (irq = 0) {
 #ifdef CONFIG_PCI_MSI
-   if (!platform_legacy_irq(irq))
-   irq = IO_APIC_VECTOR(irq);
+   if (!platform_legacy_irq(irq))
+   irq = IO_APIC_VECTOR(irq);
 #endif
-   printk(KERN_INFO PCI-APIC IRQ 
transform: %s[%c] - IRQ %d\n,
-   pci_name(dev), 'A' + pin, irq);
-   dev-irq = irq;
-   return 0;
-   } else
-   msg =  Probably buggy MP table.;
-   }
+   printk(KERN_INFO PCI-APIC IRQ transform: 
%s[%c] - IRQ %d\n,
+   pci_name(dev), 'A' + pin, irq);
+   dev-irq = irq;
+   return 0;
+   } else
+   msg =  Probably

Re: [PATCH 2.4.29-bk8] Resend: sym53c8xx.c: Add ULL suffix to fix warning

2005-02-07 Thread Mark F. Haigh
Mark F. Haigh wrote:
--- drivers/scsi/sym53c8xx.c.orig   2005-02-07 19:53:05.741527608 -0800
+++ drivers/scsi/sym53c8xx.c2005-02-07 19:53:36.782808616 -0800
Apologies.  Patch now -p1-able.
Mark F. Haigh
[EMAIL PROTECTED]
Signed-off-by: Mark F. Haigh  [EMAIL PROTECTED]
--- linux-2.4.29-bk8/drivers/scsi/sym53c8xx.c.orig  2005-02-07 
19:53:05.0 -0800
+++ linux-2.4.29-bk8/drivers/scsi/sym53c8xx.c   2005-02-07 19:53:36.0 
-0800
@@ -13182,7 +13182,7 @@
** descriptors.
*/
if (chip  (chip-features  FE_DAC)) {
-   if (pci_set_dma_mask(pdev, (u64) 0xff))
+   if (pci_set_dma_mask(pdev, (u64) 0xffULL))
chip-features = ~FE_DAC_IN_USE;
else
chip-features |= FE_DAC_IN_USE;


Re: [PATCH 2.4.19-bk8] arch/i386/kernel/pci-irq.c: Wrong message output

2005-02-07 Thread Mark F. Haigh
Mark F. Haigh wrote:
--- arch/i386/kernel/pci-irq.c.orig 2005-02-07 19:55:23.852531544 -0800
+++ arch/i386/kernel/pci-irq.c  2005-02-07 20:13:38.835068896 -0800
Apologies.  Patch now -p1-able.
Mark F. Haigh
[EMAIL PROTECTED]
Signed-off-by: Mark F. Haigh  [EMAIL PROTECTED]
--- linux-2.4.29-bk8/arch/i386/kernel/pci-irq.c.orig2005-02-07 
19:55:23.0 -0800
+++ linux-2.4.29-bk8/arch/i386/kernel/pci-irq.c 2005-02-07 20:13:38.0 
-0800
@@ -1127,6 +1127,8 @@
if (pin  !pcibios_lookup_irq(dev, 1)  !dev-irq) {
char *msg;
 
+   pin--;  /* interrupt pins are numbered starting from 1 
*/
+
/* With IDE legacy devices the IRQ lookup failure is not a 
problem.. */
if (dev-class  8 == PCI_CLASS_STORAGE_IDE  !(dev-class  
0x5))
return;
@@ -1134,42 +1136,39 @@
if (io_apic_assign_pci_irqs) {
int irq;
 
-   if (pin) {
-   pin--;  /* interrupt pins are numbered 
starting from 1 */
-   irq = 
IO_APIC_get_PCI_irq_vector(dev-bus-number, PCI_SLOT(dev-devfn), pin);
-   /*
-* Busses behind bridges are typically not 
listed in the MP-table.
-* In this case we have to look up the IRQ 
based on the parent bus,
-* parent slot, and pin number. The SMP code 
detects such bridged
-* busses itself so we should get into this 
branch reliably.
-*/
-   temp_dev = dev;
-   while (irq  0  dev-bus-parent) { /* go 
back to the bridge */
-   struct pci_dev * bridge = 
dev-bus-self;
+   irq = IO_APIC_get_PCI_irq_vector(dev-bus-number, 
PCI_SLOT(dev-devfn), pin);
+   /*
+* Busses behind bridges are typically not listed in 
the MP-table.
+* In this case we have to look up the IRQ based on the 
parent bus,
+* parent slot, and pin number. The SMP code detects 
such bridged
+* busses itself so we should get into this branch 
reliably.
+*/
+   temp_dev = dev;
+   while (irq  0  dev-bus-parent) { /* go back to the 
bridge */
+   struct pci_dev * bridge = dev-bus-self;
 
-   pin = (pin + PCI_SLOT(dev-devfn)) % 4;
-   irq = 
IO_APIC_get_PCI_irq_vector(bridge-bus-number, 
-   
PCI_SLOT(bridge-devfn), pin);
-   if (irq = 0)
-   printk(KERN_WARNING PCI: using 
PPB(B%d,I%d,P%d) to get irq %d\n, 
-   bridge-bus-number, 
PCI_SLOT(bridge-devfn), pin, irq);
-   dev = bridge;
-   }
-   dev = temp_dev;
-   if (irq = 0) {
-   printk(KERN_INFO PCI-APIC IRQ 
transform: (B%d,I%d,P%d) - %d\n,
-   dev-bus-number, 
PCI_SLOT(dev-devfn), pin, irq);
-   dev-irq = irq;
-   return;
-   } else
-   msg =  Probably buggy MP table.;
+   pin = (pin + PCI_SLOT(dev-devfn)) % 4;
+   irq = 
IO_APIC_get_PCI_irq_vector(bridge-bus-number, 
+   PCI_SLOT(bridge-devfn), pin);
+   if (irq = 0)
+   printk(KERN_WARNING PCI: using 
PPB(B%d,I%d,P%d) to get irq %d\n, 
+   bridge-bus-number, 
PCI_SLOT(bridge-devfn), pin, irq);
+   dev = bridge;
}
+   dev = temp_dev;
+   if (irq = 0) {
+   printk(KERN_INFO PCI-APIC IRQ transform: 
(B%d,I%d,P%d) - %d\n,
+   dev-bus-number, PCI_SLOT(dev-devfn), 
pin, irq);
+   dev-irq = irq;
+   return;
+   } else
+   msg =  Probably buggy MP table.;
} else if (pci_probe  PCI_BIOS_IRQ_SCAN)
msg = ;
else
msg =  Please try using pci=biosirq.;
printk(KERN_WARNING PCI: No IRQ known for interrupt pin %c

Re: [PATCH 2.6.11-rc3-bk4] arch/i386/kernel/pci/irq.c: Wrong message output

2005-02-07 Thread Mark F. Haigh
Greg KH wrote:
snip
Oops, this time you forgot the whole description of the patch :(
Third time's the charm...
The following has been reported in the wild for kernel 2.6.8-24:
PCI: Enabling device :00:05.0 ( - 0002)
PCI: No IRQ known for interrupt pin @ of device :00:05.0. Probably 
buggy MP table.

It should read No IRQ known for interrupt pin A, but the 'pin' 
variable has already been decremented (from 1 to 0), so the line:

printk(KERN_WARNING PCI: No IRQ known for interrupt pin %c of device 
%s.%s\n, 'A' + pin - 1, dev-slot_name, msg);

causes pin @ to be output, because 'A' + 0 - 1 == '@'.
The supplied patch should fix it.  It also removes a redundant check for 
a nonzero pin.

Mark F. Haigh
[EMAIL PROTECTED]
Signed-off-by: Mark F. Haigh  [EMAIL PROTECTED]
--- linux-2.6.11-rc3-bk4/arch/i386/pci/irq.c.orig   2005-02-07 
20:40:58.0 -0800
+++ linux-2.6.11-rc3-bk4/arch/i386/pci/irq.c2005-02-07 21:39:15.091239272 
-0800
@@ -1031,56 +1031,55 @@
 
pci_read_config_byte(dev, PCI_INTERRUPT_PIN, pin);
if (pin  !pcibios_lookup_irq(dev, 1)  !dev-irq) {
-   char *msg;
-   msg = ;
+   char *msg = ;
+
+   pin--;  /* interrupt pins are numbered starting from 1 
*/
+
if (io_apic_assign_pci_irqs) {
int irq;
 
-   if (pin) {
-   pin--;  /* interrupt pins are numbered 
starting from 1 */
-   irq = 
IO_APIC_get_PCI_irq_vector(dev-bus-number, PCI_SLOT(dev-devfn), pin);
-   /*
-* Busses behind bridges are typically not 
listed in the MP-table.
-* In this case we have to look up the IRQ 
based on the parent bus,
-* parent slot, and pin number. The SMP code 
detects such bridged
-* busses itself so we should get into this 
branch reliably.
-*/
-   temp_dev = dev;
-   while (irq  0  dev-bus-parent) { /* go 
back to the bridge */
-   struct pci_dev * bridge = 
dev-bus-self;
-
-   pin = (pin + PCI_SLOT(dev-devfn)) % 4;
-   irq = 
IO_APIC_get_PCI_irq_vector(bridge-bus-number, 
-   
PCI_SLOT(bridge-devfn), pin);
-   if (irq = 0)
-   printk(KERN_WARNING PCI: using 
PPB %s[%c] to get irq %d\n,
-   pci_name(bridge), 'A' + 
pin, irq);
-   dev = bridge;
-   }
-   dev = temp_dev;
-   if (irq = 0) {
+   irq = IO_APIC_get_PCI_irq_vector(dev-bus-number, 
PCI_SLOT(dev-devfn), pin);
+   /*
+* Busses behind bridges are typically not listed in 
the MP-table.
+* In this case we have to look up the IRQ based on the 
parent bus,
+* parent slot, and pin number. The SMP code detects 
such bridged
+* busses itself so we should get into this branch 
reliably.
+*/
+   temp_dev = dev;
+   while (irq  0  dev-bus-parent) { /* go back to the 
bridge */
+   struct pci_dev * bridge = dev-bus-self;
+
+   pin = (pin + PCI_SLOT(dev-devfn)) % 4;
+   irq = 
IO_APIC_get_PCI_irq_vector(bridge-bus-number, 
+   PCI_SLOT(bridge-devfn), pin);
+   if (irq = 0)
+   printk(KERN_WARNING PCI: using PPB 
%s[%c] to get irq %d\n,
+   pci_name(bridge), 'A' + pin, 
irq);
+   dev = bridge;
+   }
+   dev = temp_dev;
+   if (irq = 0) {
 #ifdef CONFIG_PCI_MSI
-   if (!platform_legacy_irq(irq))
-   irq = IO_APIC_VECTOR(irq);
+   if (!platform_legacy_irq(irq))
+   irq = IO_APIC_VECTOR(irq);
 #endif
-   printk(KERN_INFO PCI-APIC IRQ 
transform: %s[%c] - IRQ %d\n,
-   pci_name(dev), 'A' + pin, irq);
-   dev-irq = irq;
-   return 0;
-   } else
-   msg

Re: [PATCH 2.4.29-bk8] Resend: sym53c8xx.c: Add ULL suffix to fix warning

2005-02-07 Thread Mark F. Haigh
Mark F. Haigh wrote:
Apologies.  Patch now -p1-able.
[Apolgies yet again, description included now]
Noticed that in drivers/scsi/sym53c8xx.c:
sym53c8xx.c:13185: warning: integer constant is too large for long type
Since we're not dealing with C99 (yet), this 64 bit integer constant
needs to be suffixed with ULL.  Patch included.
Mark F. Haigh
[EMAIL PROTECTED]
Signed-off-by: Mark F. Haigh  [EMAIL PROTECTED]
--- linux-2.4.29-bk8/drivers/scsi/sym53c8xx.c.orig  2005-02-07 
19:53:05.0 -0800
+++ linux-2.4.29-bk8/drivers/scsi/sym53c8xx.c   2005-02-07 19:53:36.0 
-0800
@@ -13182,7 +13182,7 @@
** descriptors.
*/
if (chip  (chip-features  FE_DAC)) {
-   if (pci_set_dma_mask(pdev, (u64) 0xff))
+   if (pci_set_dma_mask(pdev, (u64) 0xffULL))
chip-features = ~FE_DAC_IN_USE;
else
chip-features |= FE_DAC_IN_USE;


Re: [PATCH 2.4.19-bk8] arch/i386/kernel/pci-irq.c: Wrong message output

2005-02-07 Thread Mark F. Haigh
Mark F. Haigh wrote:
Apologies.  Patch now -p1-able.
[Apologies yet again, now includes description]
I'd submitted a patch earlier for this file, fixing a warning.  When I 
looked at it further, I noticed it can output an incorrect warning 
message under certain circumstances.  I've confirmed that this can and 
does happen in the wild:

PCI: Enabling device :00:0a.0 ( - 0001)
PCI: No IRQ known for interrupt pin @ of device :00:0a.0. Probably 
buggy MP table.

It should read No IRQ known for interrupt pin A, but the 'pin' 
variable has already been decremented (from 1 to 0), so the line:

printk(KERN_WARNING PCI: No IRQ known for interrupt pin %c of device 
%s.%s\n, 'A' + pin - 1, dev-slot_name, msg);

causes pin @ to be output, because 'A' + 0 - 1 == '@'.
This patch also fixes the original warning:
pci-irq.c: In function `pcibios_enable_irq':
pci-irq.c:1128: warning: 'msg' might be used uninitialized in this function
Thanks,
Mark Haigh
[EMAIL PROTECTED]
Signed-off-by:  Mark F. Haigh  [EMAIL PROTECTED]
--- linux-2.4.29-bk8/arch/i386/kernel/pci-irq.c.orig2005-02-07 
19:55:23.0 -0800
+++ linux-2.4.29-bk8/arch/i386/kernel/pci-irq.c 2005-02-07 20:13:38.0 
-0800
@@ -1127,6 +1127,8 @@
if (pin  !pcibios_lookup_irq(dev, 1)  !dev-irq) {
char *msg;
 
+   pin--;  /* interrupt pins are numbered starting from 1 
*/
+
/* With IDE legacy devices the IRQ lookup failure is not a 
problem.. */
if (dev-class  8 == PCI_CLASS_STORAGE_IDE  !(dev-class  
0x5))
return;
@@ -1134,42 +1136,39 @@
if (io_apic_assign_pci_irqs) {
int irq;
 
-   if (pin) {
-   pin--;  /* interrupt pins are numbered 
starting from 1 */
-   irq = 
IO_APIC_get_PCI_irq_vector(dev-bus-number, PCI_SLOT(dev-devfn), pin);
-   /*
-* Busses behind bridges are typically not 
listed in the MP-table.
-* In this case we have to look up the IRQ 
based on the parent bus,
-* parent slot, and pin number. The SMP code 
detects such bridged
-* busses itself so we should get into this 
branch reliably.
-*/
-   temp_dev = dev;
-   while (irq  0  dev-bus-parent) { /* go 
back to the bridge */
-   struct pci_dev * bridge = 
dev-bus-self;
+   irq = IO_APIC_get_PCI_irq_vector(dev-bus-number, 
PCI_SLOT(dev-devfn), pin);
+   /*
+* Busses behind bridges are typically not listed in 
the MP-table.
+* In this case we have to look up the IRQ based on the 
parent bus,
+* parent slot, and pin number. The SMP code detects 
such bridged
+* busses itself so we should get into this branch 
reliably.
+*/
+   temp_dev = dev;
+   while (irq  0  dev-bus-parent) { /* go back to the 
bridge */
+   struct pci_dev * bridge = dev-bus-self;
 
-   pin = (pin + PCI_SLOT(dev-devfn)) % 4;
-   irq = 
IO_APIC_get_PCI_irq_vector(bridge-bus-number, 
-   
PCI_SLOT(bridge-devfn), pin);
-   if (irq = 0)
-   printk(KERN_WARNING PCI: using 
PPB(B%d,I%d,P%d) to get irq %d\n, 
-   bridge-bus-number, 
PCI_SLOT(bridge-devfn), pin, irq);
-   dev = bridge;
-   }
-   dev = temp_dev;
-   if (irq = 0) {
-   printk(KERN_INFO PCI-APIC IRQ 
transform: (B%d,I%d,P%d) - %d\n,
-   dev-bus-number, 
PCI_SLOT(dev-devfn), pin, irq);
-   dev-irq = irq;
-   return;
-   } else
-   msg =  Probably buggy MP table.;
+   pin = (pin + PCI_SLOT(dev-devfn)) % 4;
+   irq = 
IO_APIC_get_PCI_irq_vector(bridge-bus-number, 
+   PCI_SLOT(bridge-devfn), pin);
+   if (irq = 0)
+   printk(KERN_WARNING PCI: using 
PPB(B%d,I%d,P%d) to get irq %d\n, 
+   bridge-bus-number, 
PCI_SLOT(bridge-devfn), pin, irq

[PATCH 2.4.29] arch/i386/kernel/pci-irq.c - Remove redundant check

2005-02-02 Thread Mark F. Haigh
In arch/i386/kernel/pci-irq.c:pcibios_enable_irq(), there is a redundant 
check:

if (pin && !pcibios_lookup_irq(dev, 1) && !dev->irq) {
/* ... */
if (pin) {
We don't need the second 'if (pin)', as we already know it's nonzero 
from the first check.  Also note that this fixes the following warning 
(which happens because gcc's isn't always perfect with determining 
whether a variable is used uninitialized):

pci-irq.c: In function `pcibios_enable_irq':
pci-irq.c:1128: warning: 'msg' might be used uninitialized in this function
All the patch does is remove the duplicate check and shift everything 
else over.

Mark F. Haigh
[EMAIL PROTECTED]
--- arch/i386/kernel/pci-irq.c.orig 2005-02-02 18:33:56.694474944 -0800
+++ arch/i386/kernel/pci-irq.c  2005-02-02 18:58:18.828196832 -0800
@@ -1134,36 +1134,34 @@
if (io_apic_assign_pci_irqs) {
int irq;
 
-   if (pin) {
-   pin--;  /* interrupt pins are numbered 
starting from 1 */
-   irq = 
IO_APIC_get_PCI_irq_vector(dev->bus->number, PCI_SLOT(dev->devfn), pin);
-   /*
-* Busses behind bridges are typically not 
listed in the MP-table.
-* In this case we have to look up the IRQ 
based on the parent bus,
-* parent slot, and pin number. The SMP code 
detects such bridged
-* busses itself so we should get into this 
branch reliably.
-*/
-   temp_dev = dev;
-   while (irq < 0 && dev->bus->parent) { /* go 
back to the bridge */
-   struct pci_dev * bridge = 
dev->bus->self;
+   pin--;  /* interrupt pins are numbered starting 
from 1 */
+   irq = IO_APIC_get_PCI_irq_vector(dev->bus->number, 
PCI_SLOT(dev->devfn), pin);
+   /*
+* Busses behind bridges are typically not listed in 
the MP-table.
+* In this case we have to look up the IRQ based on the 
parent bus,
+* parent slot, and pin number. The SMP code detects 
such bridged
+* busses itself so we should get into this branch 
reliably.
+*/
+   temp_dev = dev;
+   while (irq < 0 && dev->bus->parent) { /* go back to the 
bridge */
+   struct pci_dev * bridge = dev->bus->self;
 
-   pin = (pin + PCI_SLOT(dev->devfn)) % 4;
-   irq = 
IO_APIC_get_PCI_irq_vector(bridge->bus->number, 
-   
PCI_SLOT(bridge->devfn), pin);
-   if (irq >= 0)
-   printk(KERN_WARNING "PCI: using 
PPB(B%d,I%d,P%d) to get irq %d\n", 
-   bridge->bus->number, 
PCI_SLOT(bridge->devfn), pin, irq);
-   dev = bridge;
-   }
-   dev = temp_dev;
-   if (irq >= 0) {
-   printk(KERN_INFO "PCI->APIC IRQ 
transform: (B%d,I%d,P%d) -> %d\n",
-   dev->bus->number, 
PCI_SLOT(dev->devfn), pin, irq);
-   dev->irq = irq;
-   return;
-   } else
-   msg = " Probably buggy MP table.";
+   pin = (pin + PCI_SLOT(dev->devfn)) % 4;
+   irq = 
IO_APIC_get_PCI_irq_vector(bridge->bus->number, 
+   PCI_SLOT(bridge->devfn), pin);
+   if (irq >= 0)
+   printk(KERN_WARNING "PCI: using 
PPB(B%d,I%d,P%d) to get irq %d\n", 
+   bridge->bus->number, 
PCI_SLOT(bridge->devfn), pin, irq);
+   dev = bridge;
}
+   dev = temp_dev;
+   if (irq >= 0) {
+   printk(KERN_INFO "PCI->APIC IRQ transform: 
(B%d,I%d,P%d) -> %d\n",
+   dev->bus->number, PCI_SLOT(dev->devfn), 
pin, irq);
+   dev->irq = irq;
+   return;
+   } else
+   msg = " Probably buggy MP table.";
} else if (pci_probe & PCI_BIOS_IRQ_SCAN)
msg = "";
else


[PATCH 2.4.29] sym53c8xx.c - Add ULL suffix to fix warning

2005-02-02 Thread Mark F. Haigh
Noticed that in drivers/scsi/sym53c8xx.c:
sym53c8xx.c:13185: warning: integer constant is too large for "long" type
Since we're not dealing with C99 (yet), this 64 bit integer constant
needs to be suffixed with ULL.  Patch included.
Mark F. Haigh
[EMAIL PROTECTED]
--- drivers/scsi/sym53c8xx.c.orig   2005-02-02 14:35:52.981929312 -0800
+++ drivers/scsi/sym53c8xx.c2005-02-02 14:38:38.496767232 -0800
@@ -13182,7 +13182,7 @@
** descriptors.
*/
if (chip && (chip->features & FE_DAC)) {
-   if (pci_set_dma_mask(pdev, (u64) 0xff))
+   if (pci_set_dma_mask(pdev, (u64) 0xffULL))
chip->features &= ~FE_DAC_IN_USE;
else
chip->features |= FE_DAC_IN_USE;



[PATCH 2.4.29] arch/i386/kernel/pci-irq.c - Remove redundant check

2005-02-02 Thread Mark F. Haigh
In arch/i386/kernel/pci-irq.c:pcibios_enable_irq(), there is a redundant 
check:

if (pin  !pcibios_lookup_irq(dev, 1)  !dev-irq) {
/* ... */
if (pin) {
We don't need the second 'if (pin)', as we already know it's nonzero 
from the first check.  Also note that this fixes the following warning 
(which happens because gcc's isn't always perfect with determining 
whether a variable is used uninitialized):

pci-irq.c: In function `pcibios_enable_irq':
pci-irq.c:1128: warning: 'msg' might be used uninitialized in this function
All the patch does is remove the duplicate check and shift everything 
else over.

Mark F. Haigh
[EMAIL PROTECTED]
--- arch/i386/kernel/pci-irq.c.orig 2005-02-02 18:33:56.694474944 -0800
+++ arch/i386/kernel/pci-irq.c  2005-02-02 18:58:18.828196832 -0800
@@ -1134,36 +1134,34 @@
if (io_apic_assign_pci_irqs) {
int irq;
 
-   if (pin) {
-   pin--;  /* interrupt pins are numbered 
starting from 1 */
-   irq = 
IO_APIC_get_PCI_irq_vector(dev-bus-number, PCI_SLOT(dev-devfn), pin);
-   /*
-* Busses behind bridges are typically not 
listed in the MP-table.
-* In this case we have to look up the IRQ 
based on the parent bus,
-* parent slot, and pin number. The SMP code 
detects such bridged
-* busses itself so we should get into this 
branch reliably.
-*/
-   temp_dev = dev;
-   while (irq  0  dev-bus-parent) { /* go 
back to the bridge */
-   struct pci_dev * bridge = 
dev-bus-self;
+   pin--;  /* interrupt pins are numbered starting 
from 1 */
+   irq = IO_APIC_get_PCI_irq_vector(dev-bus-number, 
PCI_SLOT(dev-devfn), pin);
+   /*
+* Busses behind bridges are typically not listed in 
the MP-table.
+* In this case we have to look up the IRQ based on the 
parent bus,
+* parent slot, and pin number. The SMP code detects 
such bridged
+* busses itself so we should get into this branch 
reliably.
+*/
+   temp_dev = dev;
+   while (irq  0  dev-bus-parent) { /* go back to the 
bridge */
+   struct pci_dev * bridge = dev-bus-self;
 
-   pin = (pin + PCI_SLOT(dev-devfn)) % 4;
-   irq = 
IO_APIC_get_PCI_irq_vector(bridge-bus-number, 
-   
PCI_SLOT(bridge-devfn), pin);
-   if (irq = 0)
-   printk(KERN_WARNING PCI: using 
PPB(B%d,I%d,P%d) to get irq %d\n, 
-   bridge-bus-number, 
PCI_SLOT(bridge-devfn), pin, irq);
-   dev = bridge;
-   }
-   dev = temp_dev;
-   if (irq = 0) {
-   printk(KERN_INFO PCI-APIC IRQ 
transform: (B%d,I%d,P%d) - %d\n,
-   dev-bus-number, 
PCI_SLOT(dev-devfn), pin, irq);
-   dev-irq = irq;
-   return;
-   } else
-   msg =  Probably buggy MP table.;
+   pin = (pin + PCI_SLOT(dev-devfn)) % 4;
+   irq = 
IO_APIC_get_PCI_irq_vector(bridge-bus-number, 
+   PCI_SLOT(bridge-devfn), pin);
+   if (irq = 0)
+   printk(KERN_WARNING PCI: using 
PPB(B%d,I%d,P%d) to get irq %d\n, 
+   bridge-bus-number, 
PCI_SLOT(bridge-devfn), pin, irq);
+   dev = bridge;
}
+   dev = temp_dev;
+   if (irq = 0) {
+   printk(KERN_INFO PCI-APIC IRQ transform: 
(B%d,I%d,P%d) - %d\n,
+   dev-bus-number, PCI_SLOT(dev-devfn), 
pin, irq);
+   dev-irq = irq;
+   return;
+   } else
+   msg =  Probably buggy MP table.;
} else if (pci_probe  PCI_BIOS_IRQ_SCAN)
msg = ;
else