public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org, linux-pci@atrey.karlin.mff.cuni.cz
Cc: Mark.Haigh@spirentcom.com
Subject: [PATCH] arch/i386/kernel/pci/irq.c:  Wrong message output
Date: Fri, 4 Mar 2005 12:53:57 -0800	[thread overview]
Message-ID: <11099696371419@kroah.com> (raw)
In-Reply-To: <11099696373815@kroah.com>

ChangeSet 1.1998.11.14, 2005/02/08 12:22:53-08:00, Mark.Haigh@spirentcom.com

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

The following has been reported in the wild for kernel 2.6.8-24:

PCI: Enabling device 0000:00:05.0 (0000 -> 0002)
PCI: No IRQ known for interrupt pin @ of device 0000: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.

Signed-off-by: Mark F. Haigh  <Mark.Haigh@spirentcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


 arch/i386/pci/irq.c |   73 +++++++++++++++++++++++++---------------------------
 1 files changed, 36 insertions(+), 37 deletions(-)


diff -Nru a/arch/i386/pci/irq.c b/arch/i386/pci/irq.c
--- a/arch/i386/pci/irq.c	2005-03-04 12:42:38 -08:00
+++ b/arch/i386/pci/irq.c	2005-03-04 12:42:38 -08:00
@@ -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 buggy MP table.";
 		} else if (pci_probe & PCI_BIOS_IRQ_SCAN)
 			msg = "";
 		else
 			msg = " Please try using pci=biosirq.";
-			
+
 		/* With IDE legacy devices the IRQ lookup failure is not a problem.. */
 		if (dev->class >> 8 == PCI_CLASS_STORAGE_IDE && !(dev->class & 0x5))
 			return 0;
-			
+
 		printk(KERN_WARNING "PCI: No IRQ known for interrupt pin %c of device %s.%s\n",
-		       'A' + pin - 1, pci_name(dev), msg);
+		       'A' + pin, pci_name(dev), msg);
 	}
 	/* VIA bridges use interrupt line for apic/pci steering across
 	   the V-Link */


  reply	other threads:[~2005-03-04 22:17 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-04 20:53 [BK PATCH] PCI update for 2.6.11 Greg KH
2005-03-04 20:53 ` [PATCH] convert pci_dev->slot_name usage to pci_name() Greg KH
2005-03-04 20:53   ` [PATCH] Remove pci_dev->slot_name Greg KH
2005-03-04 20:53     ` [PATCH] PCI Hotplug: Remove unneeded instructions from ibmphp_pci.c Greg KH
2005-03-04 20:53       ` [PATCH] PCI: pci_proc_domain Greg KH
2005-03-04 20:53         ` [PATCH] PCI: Make pci_claim_resource __devinit Greg KH
2005-03-04 20:53           ` [PATCH] PCI: fix pci_remove_legacy_files() crash Greg KH
2005-03-04 20:53             ` [PATCH] PCI: NUMA-Q PCI config access arg validation Greg KH
2005-03-04 20:53               ` [PATCH] PCI: pci_raw_ops should use unsigned args Greg KH
2005-03-04 20:53                 ` Greg KH [this message]
2005-03-04 20:53                   ` [PATCH] PCI: Dynids - passing driver data Greg KH
2005-03-04 20:53                     ` [PATCH] drivers/pci/*: convert to pci_register_driver Greg KH
2005-03-04 20:53                       ` [PATCH] PCI Hotplug: Fix OSHP calls in shpchp and pciehp drivers Greg KH
2005-03-04 20:53                         ` [PATCH] PCI: Add PCI quirk for SMBus on the Toshiba Satellite A40 Greg KH
2005-03-04 20:53                           ` [PATCH] PCI: allow x86_64 to do pci express Greg KH
2005-03-04 20:53                             ` [PATCH] pci/quirks.c: unhide SMBus device on Samsung P35 laptop Greg KH
2005-03-04 20:53                               ` [PATCH] PCI: clean up the msi api Greg KH
2005-03-04 21:00   ` [PATCH] convert pci_dev->slot_name usage to pci_name() Jeff Garzik
2005-03-04 21:07     ` Greg KH
2005-03-04 23:00       ` Jeff Garzik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11099696371419@kroah.com \
    --to=greg@kroah.com \
    --cc=Mark.Haigh@spirentcom.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@atrey.karlin.mff.cuni.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox