public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 0/5] dev_printk() conversions
@ 2008-06-13 16:52 Bjorn Helgaas
  2008-06-13 16:52 ` [patch 1/5] ACPI: use dev_printk when possible Bjorn Helgaas
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: Bjorn Helgaas @ 2008-06-13 16:52 UTC (permalink / raw)
  To: Len Brown, Jesse Barnes, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin
  Cc: linux-acpi, linux-pci, linux-kernel, Andrew Morton

These convert some printks to dev_printks.  They are completely
independent of each other; I'm just posting them together because
it probably makes sense to review them together.

It'd be nice if a PCI person looked at pci_request_region().  To
me, it looks like it prints the wrong BAR number (it prints "bar + 1").

Bjorn
-- 

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

* [patch 1/5] ACPI: use dev_printk when possible
  2008-06-13 16:52 [patch 0/5] dev_printk() conversions Bjorn Helgaas
@ 2008-06-13 16:52 ` Bjorn Helgaas
  2008-06-26  3:42   ` Len Brown
  2008-06-13 16:52 ` [patch 2/5] PCI: " Bjorn Helgaas
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 12+ messages in thread
From: Bjorn Helgaas @ 2008-06-13 16:52 UTC (permalink / raw)
  To: Len Brown, Jesse Barnes, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin
  Cc: linux-acpi, linux-pci, linux-kernel, Andrew Morton

[-- Attachment #1: acpi-dev_printk --]
[-- Type: text/plain, Size: 3623 bytes --]

Convert printks to use dev_printk().  The most obvious change will
be messages like this:

   -ACPI: PCI Interrupt 0000:00:04.0[A] -> GSI 31 (level, low) -> IRQ 31
   +cciss 0000:00:04.0: PCI INTA# -> GSI 31 (level, low) -> IRQ 31

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>

Index: work11/drivers/acpi/pci_irq.c
===================================================================
--- work11.orig/drivers/acpi/pci_irq.c	2008-06-12 16:53:52.000000000 -0600
+++ work11/drivers/acpi/pci_irq.c	2008-06-13 09:32:19.000000000 -0600
@@ -162,7 +162,7 @@ do_prt_fixups(struct acpi_prt_entry *ent
 		    !strcmp(prt->source, quirk->source) &&
 		    strlen(prt->source) >= strlen(quirk->actual_source)) {
 			printk(KERN_WARNING PREFIX "firmware reports "
-				"%04x:%02x:%02x[%c] connected to %s; "
+				"%04x:%02x:%02x PCI INT%c# connected to %s; "
 				"changing to %s\n",
 				entry->id.segment, entry->id.bus,
 				entry->id.device, 'A' + entry->pin,
@@ -429,7 +429,7 @@ acpi_pci_irq_derive(struct pci_dev *dev,
 {
 	struct pci_dev *bridge = dev;
 	int irq = -1;
-	u8 bridge_pin = 0;
+	u8 bridge_pin = 0, orig_pin = pin;
 
 
 	if (!dev)
@@ -463,8 +463,8 @@ acpi_pci_irq_derive(struct pci_dev *dev,
 	}
 
 	if (irq < 0) {
-		printk(KERN_WARNING PREFIX "Unable to derive IRQ for device %s\n",
-			      pci_name(dev));
+		dev_warn(&dev->dev, "can't derive routing for PCI INT%c#\n",
+			 'A' + orig_pin);
 		return -1;
 	}
 
@@ -487,6 +487,7 @@ int acpi_pci_irq_enable(struct pci_dev *
 	int triggering = ACPI_LEVEL_SENSITIVE;
 	int polarity = ACPI_ACTIVE_LOW;
 	char *link = NULL;
+	char link_desc[16];
 	int rc;
 
 
@@ -503,7 +504,7 @@ int acpi_pci_irq_enable(struct pci_dev *
 	pin--;
 
 	if (!dev->bus) {
-		printk(KERN_ERR PREFIX "Invalid (NULL) 'bus' field\n");
+		dev_err(&dev->dev, "invalid (NULL) 'bus' field\n");
 		return -ENODEV;
 	}
 
@@ -538,8 +539,7 @@ int acpi_pci_irq_enable(struct pci_dev *
 	 * driver reported one, then use it. Exit in any case.
 	 */
 	if (irq < 0) {
-		printk(KERN_WARNING PREFIX "PCI Interrupt %s[%c]: no GSI",
-		       pci_name(dev), ('A' + pin));
+		dev_warn(&dev->dev, "PCI INT%c#: no GSI", 'A' + pin);
 		/* Interrupt Line values above 0xF are forbidden */
 		if (dev->irq > 0 && (dev->irq <= 0xF)) {
 			printk(" - using IRQ %d\n", dev->irq);
@@ -554,21 +554,21 @@ int acpi_pci_irq_enable(struct pci_dev *
 
 	rc = acpi_register_gsi(irq, triggering, polarity);
 	if (rc < 0) {
-		printk(KERN_WARNING PREFIX "PCI Interrupt %s[%c]: failed "
-		       "to register GSI\n", pci_name(dev), ('A' + pin));
+		dev_warn(&dev->dev, "PCI INT%c#: failed to register GSI\n",
+			 'A' + pin);
 		return rc;
 	}
 	dev->irq = rc;
 
-	printk(KERN_INFO PREFIX "PCI Interrupt %s[%c] -> ",
-	       pci_name(dev), 'A' + pin);
-
 	if (link)
-		printk("Link [%s] -> ", link);
+		snprintf(link_desc, sizeof(link_desc), " -> Link[%s]", link);
+	else
+		link_desc[0] = '\0';
 
-	printk("GSI %u (%s, %s) -> IRQ %d\n", irq,
-	       (triggering == ACPI_LEVEL_SENSITIVE) ? "level" : "edge",
-	       (polarity == ACPI_ACTIVE_LOW) ? "low" : "high", dev->irq);
+	dev_info(&dev->dev, "PCI INT%c#%s -> GSI %u (%s, %s) -> IRQ %d\n",
+		 'A' + pin, link_desc, irq,
+		 (triggering == ACPI_LEVEL_SENSITIVE) ? "level" : "edge",
+		 (polarity == ACPI_ACTIVE_LOW) ? "low" : "high", dev->irq);
 
 	return 0;
 }
@@ -616,10 +616,6 @@ void acpi_pci_irq_disable(struct pci_dev
 	 * (e.g. PCI_UNDEFINED_IRQ).
 	 */
 
-	printk(KERN_INFO PREFIX "PCI interrupt for device %s disabled\n",
-	       pci_name(dev));
-
+	dev_info(&dev->dev, "PCI INT%c# disabled\n", 'A' + pin);
 	acpi_unregister_gsi(gsi);
-
-	return;
 }

-- 

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

* [patch 2/5] PCI: use dev_printk when possible
  2008-06-13 16:52 [patch 0/5] dev_printk() conversions Bjorn Helgaas
  2008-06-13 16:52 ` [patch 1/5] ACPI: use dev_printk when possible Bjorn Helgaas
@ 2008-06-13 16:52 ` Bjorn Helgaas
  2008-06-13 16:52 ` [patch 3/5] PCIE: aer: " Bjorn Helgaas
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Bjorn Helgaas @ 2008-06-13 16:52 UTC (permalink / raw)
  To: Len Brown, Jesse Barnes, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin
  Cc: linux-acpi, linux-pci, linux-kernel, Andrew Morton

[-- Attachment #1: pci-dev_printk --]
[-- Type: text/plain, Size: 22326 bytes --]

Convert printks to use dev_printk().

I converted pr_debug() to dev_dbg().  Both use KERN_DEBUG and are enabled
only when DEBUG is defined.

I converted printk(KERN_DEBUG) to dev_printk(KERN_DEBUG), not to dev_dbg(),
because dev_dbg() is only enabled when DEBUG is defined.

I converted DBG(KERN_INFO) (only in setup-bus.c) to dev_info().  The DBG()
name makes it sound like debug, but it's been enabled forever, so dev_info()
preserves the previous behavior.

I tried to make the resource assignment formats more consistent, e.g.,
  "BAR %d: got res [%#llx-%#llx] bus [%#llx-%#llx] flags %#lx\n"
instead of sometimes using "start-end" and sometimes using "size@start".
I'm not attached to one or the other; I'd just like them consistent.

pci_request_region() prints "bar + 1".  I don't know why the "+ 1" is there.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>

---
 drivers/pci/msi.c       |   10 ++----
 drivers/pci/pci.c       |   40 ++++++++++++---------------
 drivers/pci/probe.c     |   28 +++++++++----------
 drivers/pci/setup-bus.c |   43 ++++++++++++-----------------
 drivers/pci/setup-irq.c |    3 --
 drivers/pci/setup-res.c |   69 ++++++++++++++++++++++--------------------------
 6 files changed, 87 insertions(+), 106 deletions(-)

Index: work11/drivers/pci/msi.c
===================================================================
--- work11.orig/drivers/pci/msi.c	2008-06-12 16:53:51.000000000 -0600
+++ work11/drivers/pci/msi.c	2008-06-12 17:08:27.000000000 -0600
@@ -561,9 +561,8 @@ int pci_enable_msi(struct pci_dev* dev)
 
 	/* Check whether driver already requested for MSI-X irqs */
 	if (dev->msix_enabled) {
-		printk(KERN_INFO "PCI: %s: Can't enable MSI.  "
-			"Device already has MSI-X enabled\n",
-			pci_name(dev));
+		dev_info(&dev->dev, "can't enable MSI "
+			 "(MSI-X already enabled)\n");
 		return -EINVAL;
 	}
 	status = msi_capability_init(dev);
@@ -686,9 +685,8 @@ int pci_enable_msix(struct pci_dev* dev,
 
 	/* Check whether driver already requested for MSI irq */
    	if (dev->msi_enabled) {
-		printk(KERN_INFO "PCI: %s: Can't enable MSI-X.  "
-		       "Device already has an MSI irq assigned\n",
-		       pci_name(dev));
+		dev_info(&dev->dev, "can't enable MSI-X "
+		       "(MSI IRQ already assigned)\n");
 		return -EINVAL;
 	}
 	status = msix_capability_init(dev, entries, nvec);
Index: work11/drivers/pci/pci.c
===================================================================
--- work11.orig/drivers/pci/pci.c	2008-06-12 16:53:51.000000000 -0600
+++ work11/drivers/pci/pci.c	2008-06-12 17:08:27.000000000 -0600
@@ -424,8 +424,8 @@ pci_set_power_state(struct pci_dev *dev,
 	 * to sleep if we're already in a low power state
 	 */
 	if (state != PCI_D0 && dev->current_state > state) {
-		printk(KERN_ERR "%s(): %s: state=%d, current state=%d\n",
-			__func__, pci_name(dev), state, dev->current_state);
+		dev_err(&dev->dev, "invalid power transition "
+			"(from state %d to %d)\n", dev->current_state, state);
 		return -EINVAL;
 	} else if (dev->current_state == state)
 		return 0;        /* we're already there */
@@ -433,9 +433,8 @@ pci_set_power_state(struct pci_dev *dev,
 
 	pci_read_config_word(dev,pm + PCI_PM_PMC,&pmc);
 	if ((pmc & PCI_PM_CAP_VER_MASK) > 3) {
-		printk(KERN_DEBUG
-		       "PCI: %s has unsupported PM cap regs version (%u)\n",
-		       pci_name(dev), pmc & PCI_PM_CAP_VER_MASK);
+		dev_printk(KERN_DEBUG, &dev->dev, "unsupported PM cap regs "
+			   "version (%u)\n", pmc & PCI_PM_CAP_VER_MASK);
 		return -EIO;
 	}
 
@@ -543,7 +542,8 @@ pci_power_t pci_choose_state(struct pci_
 	case PM_EVENT_HIBERNATE:
 		return PCI_D3hot;
 	default:
-		printk("Unrecognized suspend event %d\n", state.event);
+		dev_info(&dev->dev, "unrecognized suspend event %d\n",
+			 state.event);
 		BUG();
 	}
 	return PCI_D0;
@@ -568,7 +568,7 @@ static int pci_save_pcie_state(struct pc
 	else
 		found = 1;
 	if (!save_state) {
-		dev_err(&dev->dev, "Out of memory in pci_save_pcie_state\n");
+		dev_err(&dev->dev, "out of memory in pci_save_pcie_state\n");
 		return -ENOMEM;
 	}
 	cap = (u16 *)&save_state->data[0];
@@ -619,7 +619,7 @@ static int pci_save_pcix_state(struct pc
 	else
 		found = 1;
 	if (!save_state) {
-		dev_err(&dev->dev, "Out of memory in pci_save_pcie_state\n");
+		dev_err(&dev->dev, "out of memory in pci_save_pcie_state\n");
 		return -ENOMEM;
 	}
 	cap = (u16 *)&save_state->data[0];
@@ -685,10 +685,9 @@ pci_restore_state(struct pci_dev *dev)
 	for (i = 15; i >= 0; i--) {
 		pci_read_config_dword(dev, i * 4, &val);
 		if (val != dev->saved_config_space[i]) {
-			printk(KERN_DEBUG "PM: Writing back config space on "
-				"device %s at offset %x (was %x, writing %x)\n",
-				pci_name(dev), i,
-				val, (int)dev->saved_config_space[i]);
+			dev_printk(KERN_DEBUG, &dev->dev, "restoring config "
+				"space at offset %#x (was %#x, writing %#x)\n",
+				i, val, (int)dev->saved_config_space[i]);
 			pci_write_config_dword(dev,i * 4,
 				dev->saved_config_space[i]);
 		}
@@ -1116,13 +1115,11 @@ int pci_request_region(struct pci_dev *p
 	return 0;
 
 err_out:
-	printk (KERN_WARNING "PCI: Unable to reserve %s region #%d:%llx@%llx "
-		"for device %s\n",
-		pci_resource_flags(pdev, bar) & IORESOURCE_IO ? "I/O" : "mem",
+	dev_warn(&pdev->dev, "BAR %d: can't reserve %s region [%#llx-%#llx]\n",
 		bar + 1, /* PCI BAR # */
-		(unsigned long long)pci_resource_len(pdev, bar),
+		pci_resource_flags(pdev, bar) & IORESOURCE_IO ? "I/O" : "mem",
 		(unsigned long long)pci_resource_start(pdev, bar),
-		pci_name(pdev));
+		(unsigned long long)pci_resource_end(pdev, bar));
 	return -EBUSY;
 }
 
@@ -1214,7 +1211,7 @@ pci_set_master(struct pci_dev *dev)
 
 	pci_read_config_word(dev, PCI_COMMAND, &cmd);
 	if (! (cmd & PCI_COMMAND_MASTER)) {
-		pr_debug("PCI: Enabling bus mastering for device %s\n", pci_name(dev));
+		dev_dbg(&dev->dev, "enabling bus mastering\n");
 		cmd |= PCI_COMMAND_MASTER;
 		pci_write_config_word(dev, PCI_COMMAND, cmd);
 	}
@@ -1279,8 +1276,8 @@ pci_set_cacheline_size(struct pci_dev *d
 	if (cacheline_size == pci_cache_line_size)
 		return 0;
 
-	printk(KERN_DEBUG "PCI: cache line size of %d is not supported "
-	       "by device %s\n", pci_cache_line_size << 2, pci_name(dev));
+	dev_printk(KERN_DEBUG, &dev->dev, "cache line size of %d is not "
+		   "supported\n", pci_cache_line_size << 2);
 
 	return -EINVAL;
 }
@@ -1305,8 +1302,7 @@ pci_set_mwi(struct pci_dev *dev)
 
 	pci_read_config_word(dev, PCI_COMMAND, &cmd);
 	if (! (cmd & PCI_COMMAND_INVALIDATE)) {
-		pr_debug("PCI: Enabling Mem-Wr-Inval for device %s\n",
-			pci_name(dev));
+		dev_dbg(&dev->dev, "enabling Mem-Wr-Inval\n");
 		cmd |= PCI_COMMAND_INVALIDATE;
 		pci_write_config_word(dev, PCI_COMMAND, cmd);
 	}
Index: work11/drivers/pci/probe.c
===================================================================
--- work11.orig/drivers/pci/probe.c	2008-06-12 16:53:51.000000000 -0600
+++ work11/drivers/pci/probe.c	2008-06-12 17:23:42.000000000 -0600
@@ -277,8 +277,8 @@ static void pci_read_bases(struct pci_de
 			res->end = res->start + sz64;
 #else
 			if (sz64 > 0x100000000ULL) {
-				printk(KERN_ERR "PCI: Unable to handle 64-bit "
-					"BAR for device %s\n", pci_name(dev));
+				dev_err(&dev->dev, "BAR %d: can't handle 64-bit"
+					" BAR\n", pos);
 				res->start = 0;
 				res->flags = 0;
 			} else if (lhi) {
@@ -329,7 +329,7 @@ void __devinit pci_read_bridge_bases(str
 		return;
 
 	if (dev->transparent) {
-		printk(KERN_INFO "PCI: Transparent bridge - %s\n", pci_name(dev));
+		dev_info(&dev->dev, "transparent bridge\n");
 		for(i = 3; i < PCI_BUS_NUM_RESOURCES; i++)
 			child->resource[i] = child->parent->resource[i - 3];
 	}
@@ -392,7 +392,8 @@ void __devinit pci_read_bridge_bases(str
 			limit |= ((long) mem_limit_hi) << 32;
 #else
 			if (mem_base_hi || mem_limit_hi) {
-				printk(KERN_ERR "PCI: Unable to handle 64-bit address space for bridge %s\n", pci_name(dev));
+				dev_err(&dev->dev, "can't handle 64-bit "
+					"address space for bridge\n");
 				return;
 			}
 #endif
@@ -511,8 +512,8 @@ int __devinit pci_scan_bridge(struct pci
 
 	pci_read_config_dword(dev, PCI_PRIMARY_BUS, &buses);
 
-	pr_debug("PCI: Scanning behind PCI bridge %s, config %06x, pass %d\n",
-		 pci_name(dev), buses & 0xffffff, pass);
+	dev_dbg(&dev->dev, "scanning behind bridge, config %06x, pass %d\n",
+		buses & 0xffffff, pass);
 
 	/* Disable MasterAbortMode during probing to avoid reporting
 	   of bus errors (in some architectures) */ 
@@ -535,8 +536,8 @@ int __devinit pci_scan_bridge(struct pci
 		 * ignore it.  This can happen with the i450NX chipset.
 		 */
 		if (pci_find_bus(pci_domain_nr(bus), busnr)) {
-			printk(KERN_INFO "PCI: Bus %04x:%02x already known\n",
-					pci_domain_nr(bus), busnr);
+			dev_info(&dev->dev, "bus %04x:%02x already known\n",
+				 pci_domain_nr(bus), busnr);
 			goto out;
 		}
 
@@ -720,7 +721,7 @@ static int pci_setup_device(struct pci_d
 	dev->class = class;
 	class >>= 8;
 
-	pr_debug("PCI: Found %s [%04x/%04x] %06x %02x\n", pci_name(dev),
+	dev_dbg(&dev->dev, "found [%04x/%04x] class %06x header type %02x\n",
 		 dev->vendor, dev->device, class, dev->hdr_type);
 
 	/* "Unknown power state" */
@@ -788,13 +789,13 @@ static int pci_setup_device(struct pci_d
 		break;
 
 	default:				    /* unknown header */
-		printk(KERN_ERR "PCI: device %s has unknown header type %02x, ignoring.\n",
-			pci_name(dev), dev->hdr_type);
+		dev_err(&dev->dev, "unknown header type %02x, "
+			"ignoring device\n", dev->hdr_type);
 		return -1;
 
 	bad:
-		printk(KERN_ERR "PCI: %s: class %x doesn't match header type %02x. Ignoring class.\n",
-		       pci_name(dev), class, dev->hdr_type);
+		dev_err(&dev->dev, "ignoring class %02x (doesn't match header "
+			"type %02x)\n", class, dev->hdr_type);
 		dev->class = PCI_CLASS_NOT_DEFINED;
 	}
 
@@ -927,7 +928,7 @@ static struct pci_dev *pci_scan_device(s
 			return NULL;
 		/* Card hasn't responded in 60 seconds?  Must be stuck. */
 		if (delay > 60 * 1000) {
-			printk(KERN_WARNING "Device %04x:%02x:%02x.%d not "
+			printk(KERN_WARNING "pci %04x:%02x:%02x.%d: not "
 					"responding\n", pci_domain_nr(bus),
 					bus->number, PCI_SLOT(devfn),
 					PCI_FUNC(devfn));
Index: work11/drivers/pci/setup-bus.c
===================================================================
--- work11.orig/drivers/pci/setup-bus.c	2008-06-12 16:53:51.000000000 -0600
+++ work11/drivers/pci/setup-bus.c	2008-06-12 17:08:27.000000000 -0600
@@ -27,13 +27,6 @@
 #include <linux/slab.h>
 
 
-#define DEBUG_CONFIG 1
-#if DEBUG_CONFIG
-#define DBG(x...)     printk(x)
-#else
-#define DBG(x...)
-#endif
-
 static void pbus_assign_resources_sorted(struct pci_bus *bus)
 {
 	struct pci_dev *dev;
@@ -81,8 +74,8 @@ void pci_setup_cardbus(struct pci_bus *b
 	struct pci_dev *bridge = bus->self;
 	struct pci_bus_region region;
 
-	printk("PCI: Bus %d, cardbus bridge: %s\n",
-		bus->number, pci_name(bridge));
+	dev_info(&bridge->dev, "CardBus bridge, secondary bus %04x:%02x\n",
+		 pci_domain_nr(bus), bus->number);
 
 	pcibios_resource_to_bus(bridge, &region, bus->resource[0]);
 	if (bus->resource[0]->flags & IORESOURCE_IO) {
@@ -90,7 +83,7 @@ void pci_setup_cardbus(struct pci_bus *b
 		 * The IO resource is allocated a range twice as large as it
 		 * would normally need.  This allows us to set both IO regs.
 		 */
-		printk(KERN_INFO "  IO window: 0x%08lx-0x%08lx\n",
+		dev_info(&bridge->dev, "  IO window: %#08lx-%#08lx\n",
 		       (unsigned long)region.start,
 		       (unsigned long)region.end);
 		pci_write_config_dword(bridge, PCI_CB_IO_BASE_0,
@@ -101,7 +94,7 @@ void pci_setup_cardbus(struct pci_bus *b
 
 	pcibios_resource_to_bus(bridge, &region, bus->resource[1]);
 	if (bus->resource[1]->flags & IORESOURCE_IO) {
-		printk(KERN_INFO "  IO window: 0x%08lx-0x%08lx\n",
+		dev_info(&bridge->dev, "  IO window: %#08lx-%#08lx\n",
 		       (unsigned long)region.start,
 		       (unsigned long)region.end);
 		pci_write_config_dword(bridge, PCI_CB_IO_BASE_1,
@@ -112,7 +105,7 @@ void pci_setup_cardbus(struct pci_bus *b
 
 	pcibios_resource_to_bus(bridge, &region, bus->resource[2]);
 	if (bus->resource[2]->flags & IORESOURCE_MEM) {
-		printk(KERN_INFO "  PREFETCH window: 0x%08lx-0x%08lx\n",
+		dev_info(&bridge->dev, "  PREFETCH window: %#08lx-%#08lx\n",
 		       (unsigned long)region.start,
 		       (unsigned long)region.end);
 		pci_write_config_dword(bridge, PCI_CB_MEMORY_BASE_0,
@@ -123,7 +116,7 @@ void pci_setup_cardbus(struct pci_bus *b
 
 	pcibios_resource_to_bus(bridge, &region, bus->resource[3]);
 	if (bus->resource[3]->flags & IORESOURCE_MEM) {
-		printk(KERN_INFO "  MEM window: 0x%08lx-0x%08lx\n",
+		dev_info(&bridge->dev, "  MEM window: %#08lx-%#08lx\n",
 		       (unsigned long)region.start,
 		       (unsigned long)region.end);
 		pci_write_config_dword(bridge, PCI_CB_MEMORY_BASE_1,
@@ -151,7 +144,8 @@ static void pci_setup_bridge(struct pci_
 	struct pci_bus_region region;
 	u32 l, bu, lu, io_upper16;
 
-	DBG(KERN_INFO "PCI: Bridge: %s\n", pci_name(bridge));
+	dev_info(&bridge->dev, "PCI bridge, secondary bus %04x:%02x\n",
+		 pci_domain_nr(bus), bus->number);
 
 	/* Set up the top and bottom of the PCI I/O segment for this bus. */
 	pcibios_resource_to_bus(bridge, &region, bus->resource[0]);
@@ -162,7 +156,7 @@ static void pci_setup_bridge(struct pci_
 		l |= region.end & 0xf000;
 		/* Set up upper 16 bits of I/O base/limit. */
 		io_upper16 = (region.end & 0xffff0000) | (region.start >> 16);
-		DBG(KERN_INFO "  IO window: %04lx-%04lx\n",
+		dev_info(&bridge->dev, "  IO window: %#04lx-%#04lx\n",
 		    (unsigned long)region.start,
 		    (unsigned long)region.end);
 	}
@@ -170,7 +164,7 @@ static void pci_setup_bridge(struct pci_
 		/* Clear upper 16 bits of I/O base/limit. */
 		io_upper16 = 0;
 		l = 0x00f0;
-		DBG(KERN_INFO "  IO window: disabled.\n");
+		dev_info(&bridge->dev, "  IO window: disabled\n");
 	}
 	/* Temporarily disable the I/O range before updating PCI_IO_BASE. */
 	pci_write_config_dword(bridge, PCI_IO_BASE_UPPER16, 0x0000ffff);
@@ -185,13 +179,13 @@ static void pci_setup_bridge(struct pci_
 	if (bus->resource[1]->flags & IORESOURCE_MEM) {
 		l = (region.start >> 16) & 0xfff0;
 		l |= region.end & 0xfff00000;
-		DBG(KERN_INFO "  MEM window: 0x%08lx-0x%08lx\n",
+		dev_info(&bridge->dev, "  MEM window: %#08lx-%#08lx\n",
 		    (unsigned long)region.start,
 		    (unsigned long)region.end);
 	}
 	else {
 		l = 0x0000fff0;
-		DBG(KERN_INFO "  MEM window: disabled.\n");
+		dev_info(&bridge->dev, "  MEM window: disabled\n");
 	}
 	pci_write_config_dword(bridge, PCI_MEMORY_BASE, l);
 
@@ -208,13 +202,13 @@ static void pci_setup_bridge(struct pci_
 		l |= region.end & 0xfff00000;
 		bu = upper_32_bits(region.start);
 		lu = upper_32_bits(region.end);
-		DBG(KERN_INFO "  PREFETCH window: 0x%016llx-0x%016llx\n",
+		dev_info(&bridge->dev, "  PREFETCH window: %#016llx-%#016llx\n",
 		    (unsigned long long)region.start,
 		    (unsigned long long)region.end);
 	}
 	else {
 		l = 0x0000fff0;
-		DBG(KERN_INFO "  PREFETCH window: disabled.\n");
+		dev_info(&bridge->dev, "  PREFETCH window: disabled\n");
 	}
 	pci_write_config_dword(bridge, PCI_PREF_MEMORY_BASE, l);
 
@@ -361,9 +355,8 @@ static int pbus_size_mem(struct pci_bus 
 			align = (i < PCI_BRIDGE_RESOURCES) ? r_size : r->start;
 			order = __ffs(align) - 20;
 			if (order > 11) {
-				printk(KERN_WARNING "PCI: region %s/%d "
-				       "too large: 0x%016llx-0x%016llx\n",
-					pci_name(dev), i,
+				dev_warn(&dev->dev, "BAR %d too large: "
+				       "%#016llx-%#016llx\n", i,
 				       (unsigned long long)r->start,
 				       (unsigned long long)r->end);
 				r->flags = 0;
@@ -529,8 +522,8 @@ void __ref pci_bus_assign_resources(stru
 			break;
 
 		default:
-			printk(KERN_INFO "PCI: not setting up bridge %s "
-			       "for bus %d\n", pci_name(dev), b->number);
+			dev_info(&dev->dev, "not setting up bridge for bus "
+				 "%04x:%02x\n", pci_domain_nr(b), b->number);
 			break;
 		}
 	}
Index: work11/drivers/pci/setup-irq.c
===================================================================
--- work11.orig/drivers/pci/setup-irq.c	2008-06-12 16:53:51.000000000 -0600
+++ work11/drivers/pci/setup-irq.c	2008-06-12 17:08:27.000000000 -0600
@@ -47,8 +47,7 @@ pdev_fixup_irq(struct pci_dev *dev,
 	}
 	dev->irq = irq;
 
-	pr_debug("PCI: fixup irq: (%s) got %d\n",
-		kobject_name(&dev->dev.kobj), dev->irq);
+	dev_dbg(&dev->dev, "fixup irq: got %d\n", dev->irq);
 
 	/* Always tell the device, so the driver knows what is
 	   the real IRQ to use; the device does not use it. */
Index: work11/drivers/pci/setup-res.c
===================================================================
--- work11.orig/drivers/pci/setup-res.c	2008-06-12 16:53:51.000000000 -0600
+++ work11/drivers/pci/setup-res.c	2008-06-12 17:33:11.000000000 -0600
@@ -26,8 +26,7 @@
 #include "pci.h"
 
 
-void
-pci_update_resource(struct pci_dev *dev, struct resource *res, int resno)
+void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno)
 {
 	struct pci_bus_region region;
 	u32 new, check, mask;
@@ -43,20 +42,20 @@ pci_update_resource(struct pci_dev *dev,
 	/*
 	 * Ignore non-moveable resources.  This might be legacy resources for
 	 * which no functional BAR register exists or another important
-	 * system resource we should better not move around in system address
-	 * space.
+	 * system resource we shouldn't move around.
 	 */
 	if (res->flags & IORESOURCE_PCI_FIXED)
 		return;
 
 	pcibios_resource_to_bus(dev, &region, res);
 
-	pr_debug("  got res [%llx:%llx] bus [%llx:%llx] flags %lx for "
-		 "BAR %d of %s\n", (unsigned long long)res->start,
+	dev_dbg(&dev->dev, "BAR %d: got res [%#llx-%#llx] bus [%#llx-%#llx] "
+		"flags %#lx\n", resno,
+		 (unsigned long long)res->start,
 		 (unsigned long long)res->end,
 		 (unsigned long long)region.start,
 		 (unsigned long long)region.end,
-		 (unsigned long)res->flags, resno, pci_name(dev));
+		 (unsigned long)res->flags);
 
 	new = region.start | (res->flags & PCI_REGION_FLAG_MASK);
 	if (res->flags & IORESOURCE_IO)
@@ -81,9 +80,8 @@ pci_update_resource(struct pci_dev *dev,
 	pci_read_config_dword(dev, reg, &check);
 
 	if ((new ^ check) & mask) {
-		printk(KERN_ERR "PCI: Error while updating region "
-		       "%s/%d (%08x != %08x)\n", pci_name(dev), resno,
-		       new, check);
+		dev_err(&dev->dev, "BAR %d: error updating (%#08x != %#08x)\n",
+			resno, new, check);
 	}
 
 	if ((new & (PCI_BASE_ADDRESS_SPACE|PCI_BASE_ADDRESS_MEM_TYPE_MASK)) ==
@@ -92,15 +90,14 @@ pci_update_resource(struct pci_dev *dev,
 		pci_write_config_dword(dev, reg + 4, new);
 		pci_read_config_dword(dev, reg + 4, &check);
 		if (check != new) {
-			printk(KERN_ERR "PCI: Error updating region "
-			       "%s/%d (high %08x != %08x)\n",
-			       pci_name(dev), resno, new, check);
+			dev_err(&dev->dev, "BAR %d: error updating "
+			       "(high %#08x != %#08x)\n", resno, new, check);
 		}
 	}
 	res->flags &= ~IORESOURCE_UNSET;
-	pr_debug("PCI: moved device %s resource %d (%lx) to %x\n",
-		pci_name(dev), resno, res->flags,
-		new & ~PCI_REGION_FLAG_MASK);
+	dev_dbg(&dev->dev, "BAR %d: moved to bus [%#llx-%#llx] flags %#lx\n",
+		resno, (unsigned long long)region.start,
+		(unsigned long long)region.end, res->flags);
 }
 
 int pci_claim_resource(struct pci_dev *dev, int resource)
@@ -117,10 +114,11 @@ int pci_claim_resource(struct pci_dev *d
 		err = insert_resource(root, res);
 
 	if (err) {
-		printk(KERN_ERR "PCI: %s region %d of %s %s [%llx:%llx]\n",
-			root ? "Address space collision on" :
-				"No parent found for",
-			resource, dtype, pci_name(dev),
+		dev_err(&dev->dev, "BAR %d: %s of %s [%#llx-%#llx]\n",
+			resource,
+			root ? "address space collision on" :
+				"no parent found for",
+			dtype,
 			(unsigned long long)res->start,
 			(unsigned long long)res->end);
 	}
@@ -140,11 +138,10 @@ int pci_assign_resource(struct pci_dev *
 
 	align = resource_alignment(res);
 	if (!align) {
-		printk(KERN_ERR "PCI: Cannot allocate resource (bogus "
-			"alignment) %d [%llx:%llx] (flags %lx) of %s\n",
+		dev_err(&dev->dev, "BAR %d: can't allocate resource (bogus "
+			"alignment) [%#llx-%#llx] flags %#lx\n",
 			resno, (unsigned long long)res->start,
-			(unsigned long long)res->end, res->flags,
-			pci_name(dev));
+			(unsigned long long)res->end, res->flags);
 		return -EINVAL;
 	}
 
@@ -165,11 +162,11 @@ int pci_assign_resource(struct pci_dev *
 	}
 
 	if (ret) {
-		printk(KERN_ERR "PCI: Failed to allocate %s resource "
-			"#%d:%llx@%llx for %s\n",
+		dev_err(&dev->dev, "BAR %d: can't allocate %s resource "
+			"[%#llx-%#llx]\n", resno,
 			res->flags & IORESOURCE_IO ? "I/O" : "mem",
-			resno, (unsigned long long)size,
-			(unsigned long long)res->start, pci_name(dev));
+			(unsigned long long)res->start,
+			(unsigned long long)res->end);
 	} else {
 		res->flags &= ~IORESOURCE_STARTALIGN;
 		if (resno < PCI_BRIDGE_RESOURCES)
@@ -205,11 +202,11 @@ int pci_assign_resource_fixed(struct pci
 	}
 
 	if (ret) {
-		printk(KERN_ERR "PCI: Failed to allocate %s resource "
-				"#%d:%llx@%llx for %s\n",
+		dev_err(&dev->dev, "BAR %d: can't allocate %s resource "
+			"[%#llx-%#llx\n]", resno,
 			res->flags & IORESOURCE_IO ? "I/O" : "mem",
-			resno, (unsigned long long)(res->end - res->start + 1),
-			(unsigned long long)res->start, pci_name(dev));
+			(unsigned long long)res->start,
+			(unsigned long long)res->end);
 	} else if (resno < PCI_BRIDGE_RESOURCES) {
 		pci_update_resource(dev, res, resno);
 	}
@@ -239,11 +236,10 @@ void pdev_sort_resources(struct pci_dev 
 
 		r_align = resource_alignment(r);
 		if (!r_align) {
-			printk(KERN_WARNING "PCI: bogus alignment of resource "
-				"%d [%llx:%llx] (flags %lx) of %s\n",
+			dev_warn(&dev->dev, "BAR %d: bogus alignment "
+				"[%#llx-%#llx] flags %#lx\n",
 				i, (unsigned long long)r->start,
-				(unsigned long long)r->end, r->flags,
-				pci_name(dev));
+				(unsigned long long)r->end, r->flags);
 			continue;
 		}
 		for (list = head; ; list = list->next) {
@@ -291,7 +287,7 @@ int pci_enable_resources(struct pci_dev 
 
 		if (!r->parent) {
 			dev_err(&dev->dev, "device not available because of "
-				"BAR %d [%llx:%llx] collisions\n", i,
+				"BAR %d [%#llx-%#llx] collisions\n", i,
 				(unsigned long long) r->start,
 				(unsigned long long) r->end);
 			return -EINVAL;

-- 

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

* [patch 3/5] PCIE: aer: use dev_printk when possible
  2008-06-13 16:52 [patch 0/5] dev_printk() conversions Bjorn Helgaas
  2008-06-13 16:52 ` [patch 1/5] ACPI: use dev_printk when possible Bjorn Helgaas
  2008-06-13 16:52 ` [patch 2/5] PCI: " Bjorn Helgaas
@ 2008-06-13 16:52 ` Bjorn Helgaas
  2008-06-13 16:52 ` [patch 4/5] PCIE: port driver: " Bjorn Helgaas
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Bjorn Helgaas @ 2008-06-13 16:52 UTC (permalink / raw)
  To: Len Brown, Jesse Barnes, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin
  Cc: linux-acpi, linux-pci, linux-kernel, Andrew Morton

[-- Attachment #1: pci-aer-dev_printk --]
[-- Type: text/plain, Size: 4810 bytes --]

Convert printks to use dev_printk().

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>

---
 drivers/pci/pcie/aer/aerdrv.c      |    8 +++-----
 drivers/pci/pcie/aer/aerdrv_acpi.c |    8 ++++----
 drivers/pci/pcie/aer/aerdrv_core.c |   24 ++++++++++++------------
 3 files changed, 19 insertions(+), 21 deletions(-)

Index: work11/drivers/pci/pcie/aer/aerdrv.c
===================================================================
--- work11.orig/drivers/pci/pcie/aer/aerdrv.c	2008-06-13 09:28:29.000000000 -0600
+++ work11/drivers/pci/pcie/aer/aerdrv.c	2008-06-13 09:45:25.000000000 -0600
@@ -219,8 +219,7 @@ static int __devinit aer_probe (struct p
 
 	/* Alloc rpc data structure */
 	if (!(rpc = aer_alloc_rpc(dev))) {
-		printk(KERN_DEBUG "%s: Alloc rpc fails on PCIE device[%s]\n",
-			__func__, device->bus_id);
+		dev_printk(KERN_DEBUG, device, "alloc rpc failed\n");
 		aer_remove(dev);
 		return -ENOMEM;
 	}
@@ -228,8 +227,7 @@ static int __devinit aer_probe (struct p
 	/* Request IRQ ISR */
 	if ((status = request_irq(dev->irq, aer_irq, IRQF_SHARED, "aerdrv",
 				dev))) {
-		printk(KERN_DEBUG "%s: Request ISR fails on PCIE device[%s]\n",
-			__func__, device->bus_id);
+		dev_printk(KERN_DEBUG, device, "request IRQ failed\n");
 		aer_remove(dev);
 		return status;
 	}
@@ -273,7 +271,7 @@ static pci_ers_result_t aer_root_reset(s
 	 * to issue Configuration Requests to those devices.
 	 */
 	msleep(200);
-	printk(KERN_DEBUG "Complete link reset at Root[%s]\n", dev->dev.bus_id);
+	dev_printk(KERN_DEBUG, &dev->dev, "Root Port link has been reset\n");
 
 	/* Enable Root Port's interrupt in response to error messages */
 	pci_read_config_dword(dev, pos + PCI_ERR_ROOT_STATUS, &status);
Index: work11/drivers/pci/pcie/aer/aerdrv_acpi.c
===================================================================
--- work11.orig/drivers/pci/pcie/aer/aerdrv_acpi.c	2008-06-13 09:28:29.000000000 -0600
+++ work11/drivers/pci/pcie/aer/aerdrv_acpi.c	2008-06-13 09:44:26.000000000 -0600
@@ -50,10 +50,10 @@ int aer_osc_setup(struct pcie_device *pc
 	}
 
 	if (ACPI_FAILURE(status)) {
-		printk(KERN_DEBUG "AER service couldn't init device %s - %s\n",
-		    pciedev->device.bus_id,
-		    (status == AE_SUPPORT || status == AE_NOT_FOUND) ?
-		    "no _OSC support" : "Run ACPI _OSC fails");
+		dev_printk(KERN_DEBUG, &pciedev->device, "AER service couldn't "
+			   "init device: %s\n",
+			   (status == AE_SUPPORT || status == AE_NOT_FOUND) ?
+			   "no _OSC support" : "_OSC failed");
 		return -1;
 	}
 
Index: work11/drivers/pci/pcie/aer/aerdrv_core.c
===================================================================
--- work11.orig/drivers/pci/pcie/aer/aerdrv_core.c	2008-06-13 09:28:29.000000000 -0600
+++ work11/drivers/pci/pcie/aer/aerdrv_core.c	2008-06-13 09:44:26.000000000 -0600
@@ -221,9 +221,9 @@ static void report_error_detected(struct
 			 * of a driver for this device is unaware of
 			 * its hw state.
 			 */
-			printk(KERN_DEBUG "Device ID[%s] has %s\n",
-					dev->dev.bus_id, (dev->driver) ?
-					"no AER-aware driver" : "no driver");
+			dev_printk(KERN_DEBUG, &dev->dev, "device has %s\n",
+				   dev->driver ?
+				   "no AER-aware driver" : "no driver");
 		}
 		return;
 	}
@@ -304,7 +304,7 @@ static pci_ers_result_t broadcast_error_
 {
 	struct aer_broadcast_data result_data;
 
-	printk(KERN_DEBUG "Broadcast %s message\n", error_mesg);
+	dev_printk(KERN_DEBUG, &dev->dev, "broadcast %s message\n", error_mesg);
 	result_data.state = state;
 	if (cb == report_error_detected)
 		result_data.result = PCI_ERS_RESULT_CAN_RECOVER;
@@ -404,18 +404,16 @@ static pci_ers_result_t reset_link(struc
 			data.aer_driver =
 				to_service_driver(aerdev->device.driver);
 		} else {
-			printk(KERN_DEBUG "No link-reset support to Device ID"
-				"[%s]\n",
-				dev->dev.bus_id);
+			dev_printk(KERN_DEBUG, &dev->dev, "no link-reset "
+				   "support\n");
 			return PCI_ERS_RESULT_DISCONNECT;
 		}
 	}
 
 	status = data.aer_driver->reset_link(udev);
 	if (status != PCI_ERS_RESULT_RECOVERED) {
-		printk(KERN_DEBUG "Link reset at upstream Device ID"
-			"[%s] failed\n",
-			udev->dev.bus_id);
+		dev_printk(KERN_DEBUG, &dev->dev, "link reset at upstream "
+			   "device %s failed\n", pci_name(udev));
 		return PCI_ERS_RESULT_DISCONNECT;
 	}
 
@@ -511,10 +509,12 @@ static void handle_error_source(struct p
 	} else {
 		status = do_recovery(aerdev, dev, info.severity);
 		if (status == PCI_ERS_RESULT_RECOVERED) {
-			printk(KERN_DEBUG "AER driver successfully recovered\n");
+			dev_printk(KERN_DEBUG, &dev->dev, "AER driver "
+				   "successfully recovered\n");
 		} else {
 			/* TODO: Should kernel panic here? */
-			printk(KERN_DEBUG "AER driver didn't recover\n");
+			dev_printk(KERN_DEBUG, &dev->dev, "AER driver didn't "
+				   "recover\n");
 		}
 	}
 }

-- 

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

* [patch 4/5] PCIE: port driver: use dev_printk when possible
  2008-06-13 16:52 [patch 0/5] dev_printk() conversions Bjorn Helgaas
                   ` (2 preceding siblings ...)
  2008-06-13 16:52 ` [patch 3/5] PCIE: aer: " Bjorn Helgaas
@ 2008-06-13 16:52 ` Bjorn Helgaas
  2008-06-13 16:52 ` [patch 5/5] x86 PCI: " Bjorn Helgaas
  2008-06-25 23:07 ` [patch 0/5] dev_printk() conversions Jesse Barnes
  5 siblings, 0 replies; 12+ messages in thread
From: Bjorn Helgaas @ 2008-06-13 16:52 UTC (permalink / raw)
  To: Len Brown, Jesse Barnes, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin
  Cc: linux-acpi, linux-pci, linux-kernel, Andrew Morton

[-- Attachment #1: pci-portdrv-dev_printk --]
[-- Type: text/plain, Size: 3647 bytes --]

Convert printks to use dev_printk().

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>

---
 drivers/pci/pcie/portdrv_core.c |   22 +++++++++++-----------
 drivers/pci/pcie/portdrv_pci.c  |    5 ++---
 2 files changed, 13 insertions(+), 14 deletions(-)

Index: work11/drivers/pci/pcie/portdrv_core.c
===================================================================
--- work11.orig/drivers/pci/pcie/portdrv_core.c	2008-06-12 16:53:49.000000000 -0600
+++ work11/drivers/pci/pcie/portdrv_core.c	2008-06-13 09:47:33.000000000 -0600
@@ -23,20 +23,20 @@ static int pcie_port_probe_service(struc
 {
 	struct pcie_device *pciedev;
 	struct pcie_port_service_driver *driver;
-	int status = -ENODEV;
+	int status;
 
 	if (!dev || !dev->driver)
-		return status;
+		return -ENODEV;
 
  	driver = to_service_driver(dev->driver);
 	if (!driver || !driver->probe)
-		return status;
+		return -ENODEV;
 
 	pciedev = to_pcie_device(dev);
 	status = driver->probe(pciedev, driver->id_table);
 	if (!status) {
-		printk(KERN_DEBUG "Load service driver %s on pcie device %s\n",
-			driver->name, dev->bus_id);
+		dev_printk(KERN_DEBUG, dev, "service driver %s loaded\n",
+			driver->name);
 		get_device(dev);
 	}
 	return status;
@@ -53,8 +53,8 @@ static int pcie_port_remove_service(stru
 	pciedev = to_pcie_device(dev);
  	driver = to_service_driver(dev->driver);
 	if (driver && driver->remove) { 
-		printk(KERN_DEBUG "Unload service driver %s on pcie device %s\n",
-			driver->name, dev->bus_id);
+		dev_printk(KERN_DEBUG, dev, "unloading service driver %s\n",
+			driver->name);
 		driver->remove(pciedev);
 		put_device(dev);
 	}
@@ -103,7 +103,7 @@ static int pcie_port_resume_service(stru
  */
 static void release_pcie_device(struct device *dev)
 {
-	printk(KERN_DEBUG "Free Port Service[%s]\n", dev->bus_id);
+	dev_printk(KERN_DEBUG, dev, "free port service\n");
 	kfree(to_pcie_device(dev));			
 }
 
@@ -150,7 +150,7 @@ static int assign_interrupt_mode(struct 
 	if (pos) {
 		struct msix_entry msix_entries[PCIE_PORT_DEVICE_MAXSERVICES] = 
 			{{0, 0}, {0, 1}, {0, 2}, {0, 3}};
-		printk("%s Found MSIX capability\n", __func__);
+		dev_info(&dev->dev, "found MSI-X capability\n");
 		status = pci_enable_msix(dev, msix_entries, nvec);
 		if (!status) {
 			int j = 0;
@@ -165,7 +165,7 @@ static int assign_interrupt_mode(struct 
 	if (status) {
 		pos = pci_find_capability(dev, PCI_CAP_ID_MSI);
 		if (pos) {
-			printk("%s Found MSI capability\n", __func__);
+			dev_info(&dev->dev, "found MSI capability\n");
 			status = pci_enable_msi(dev);
 			if (!status) {
 				interrupt_mode = PCIE_PORT_MSI_MODE;
@@ -252,7 +252,7 @@ static struct pcie_device* alloc_pcie_de
 		return NULL;
 
 	pcie_device_init(parent, device, port_type, service_type, irq,irq_mode);
-	printk(KERN_DEBUG "Allocate Port Service[%s]\n", device->device.bus_id);
+	dev_printk(KERN_DEBUG, &device->device, "allocate port service\n");
 	return device;
 }
 
Index: work11/drivers/pci/pcie/portdrv_pci.c
===================================================================
--- work11.orig/drivers/pci/pcie/portdrv_pci.c	2008-06-12 16:53:49.000000000 -0600
+++ work11/drivers/pci/pcie/portdrv_pci.c	2008-06-13 09:52:04.000000000 -0600
@@ -91,9 +91,8 @@ static int __devinit pcie_portdrv_probe 
 	
 	pci_set_master(dev);
         if (!dev->irq && dev->pin) {
-		printk(KERN_WARNING 
-		"%s->Dev[%04x:%04x] has invalid IRQ. Check vendor BIOS\n", 
-		__func__, dev->vendor, dev->device);
+		dev_warn(&dev->dev, "device [%04x/%04x] has invalid IRQ; "
+			 "check vendor BIOS\n", dev->vendor, dev->device);
 	}
 	if (pcie_port_device_register(dev)) {
 		pci_disable_device(dev);

-- 

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

* [patch 5/5] x86 PCI: use dev_printk when possible
  2008-06-13 16:52 [patch 0/5] dev_printk() conversions Bjorn Helgaas
                   ` (3 preceding siblings ...)
  2008-06-13 16:52 ` [patch 4/5] PCIE: port driver: " Bjorn Helgaas
@ 2008-06-13 16:52 ` Bjorn Helgaas
  2008-06-26  3:48   ` Len Brown
  2008-06-30 23:57   ` Andrew Morton
  2008-06-25 23:07 ` [patch 0/5] dev_printk() conversions Jesse Barnes
  5 siblings, 2 replies; 12+ messages in thread
From: Bjorn Helgaas @ 2008-06-13 16:52 UTC (permalink / raw)
  To: Len Brown, Jesse Barnes, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin
  Cc: linux-acpi, linux-pci, linux-kernel, Andrew Morton

[-- Attachment #1: x86-pci-dev_printk --]
[-- Type: text/plain, Size: 12874 bytes --]

Convert printks to use dev_printk().

I converted DBG() to dev_dbg().  This DBG() is from arch/x86/pci/pci.h
and requires source-code modification to enable, so dev_dbg() seems
roughly equivalent.

The printks in arch/x86/pci/irq.c were a little hairy, with lines
printed in several pieces.  I straightened it out a little, but
another set of eyes would be good.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>

---
 arch/x86/pci/fixup.c |    3 +
 arch/x86/pci/i386.c  |   26 ++++++--------
 arch/x86/pci/irq.c   |   91 ++++++++++++++++++++++-----------------------------
 arch/x86/pci/numa.c  |    5 +-
 4 files changed, 57 insertions(+), 68 deletions(-)

Index: work11/arch/x86/pci/fixup.c
===================================================================
--- work11.orig/arch/x86/pci/fixup.c	2008-06-12 16:53:49.000000000 -0600
+++ work11/arch/x86/pci/fixup.c	2008-06-13 09:52:12.000000000 -0600
@@ -23,7 +23,8 @@ static void __devinit pci_fixup_i450nx(s
 		pci_read_config_byte(d, reg++, &busno);
 		pci_read_config_byte(d, reg++, &suba);
 		pci_read_config_byte(d, reg++, &subb);
-		DBG("i450NX PXB %d: %02x/%02x/%02x\n", pxb, busno, suba, subb);
+		dev_dbg(&d->dev, "i450NX PXB %d: %02x/%02x/%02x\n", pxb, busno,
+			suba, subb);
 		if (busno)
 			pci_scan_bus_with_sysdata(busno);	/* Bus A */
 		if (suba < subb)
Index: work11/arch/x86/pci/i386.c
===================================================================
--- work11.orig/arch/x86/pci/i386.c	2008-06-12 16:53:49.000000000 -0600
+++ work11/arch/x86/pci/i386.c	2008-06-13 09:52:12.000000000 -0600
@@ -128,10 +128,8 @@ static void __init pcibios_allocate_bus_
 				pr = pci_find_parent_resource(dev, r);
 				if (!r->start || !pr ||
 				    request_resource(pr, r) < 0) {
-					printk(KERN_ERR "PCI: Cannot allocate "
-						"resource region %d "
-						"of bridge %s\n",
-						idx, pci_name(dev));
+					dev_err(&dev->dev, "BAR %d: can't "
+						"allocate resource\n", idx);
 					/*
 					 * Something is wrong with the region.
 					 * Invalidate the resource to prevent
@@ -166,15 +164,15 @@ static void __init pcibios_allocate_reso
 			else
 				disabled = !(command & PCI_COMMAND_MEMORY);
 			if (pass == disabled) {
-				DBG("PCI: Resource %08lx-%08lx "
-				    "(f=%lx, d=%d, p=%d)\n",
-				    r->start, r->end, r->flags, disabled, pass);
+				dev_dbg(&dev->dev, "resource %#08llx-%#08llx "
+					"(f=%lx, d=%d, p=%d)\n",
+					(unsigned long long) r->start,
+					(unsigned long long) r->end,
+					r->flags, disabled, pass);
 				pr = pci_find_parent_resource(dev, r);
 				if (!pr || request_resource(pr, r) < 0) {
-					printk(KERN_ERR "PCI: Cannot allocate "
-						"resource region %d "
-						"of device %s\n",
-						idx, pci_name(dev));
+					dev_err(&dev->dev, "BAR %d: can't "
+						"allocate resource\n", idx);
 					/* We'll assign a new address later */
 					r->end -= r->start;
 					r->start = 0;
@@ -187,8 +185,7 @@ static void __init pcibios_allocate_reso
 				/* Turn the ROM off, leave the resource region,
 				 * but keep it unregistered. */
 				u32 reg;
-				DBG("PCI: Switching off ROM of %s\n",
-					pci_name(dev));
+				dev_dbg(&dev->dev, "disabling ROM\n");
 				r->flags &= ~IORESOURCE_ROM_ENABLE;
 				pci_read_config_dword(dev,
 						dev->rom_base_reg, &reg);
@@ -257,8 +254,7 @@ void pcibios_set_master(struct pci_dev *
 		lat = pcibios_max_latency;
 	else
 		return;
-	printk(KERN_DEBUG "PCI: Setting latency timer of device %s to %d\n",
-		pci_name(dev), lat);
+	dev_printk(KERN_DEBUG, &dev->dev, "setting latency timer to %d\n", lat);
 	pci_write_config_byte(dev, PCI_LATENCY_TIMER, lat);
 }
 
Index: work11/arch/x86/pci/irq.c
===================================================================
--- work11.orig/arch/x86/pci/irq.c	2008-06-12 16:53:49.000000000 -0600
+++ work11/arch/x86/pci/irq.c	2008-06-13 09:52:12.000000000 -0600
@@ -433,7 +433,7 @@ static int pirq_vlsi_get(struct pci_dev 
 {
 	WARN_ON_ONCE(pirq >= 9);
 	if (pirq > 8) {
-		printk(KERN_INFO "VLSI router pirq escape (%d)\n", pirq);
+		dev_info(&dev->dev, "VLSI router PIRQ escape (%d)\n", pirq);
 		return 0;
 	}
 	return read_config_nybble(router, 0x74, pirq-1);
@@ -443,7 +443,7 @@ static int pirq_vlsi_set(struct pci_dev 
 {
 	WARN_ON_ONCE(pirq >= 9);
 	if (pirq > 8) {
-		printk(KERN_INFO "VLSI router pirq escape (%d)\n", pirq);
+		dev_info(&dev->dev, "VLSI router PIRQ escape (%d)\n", pirq);
 		return 0;
 	}
 	write_config_nybble(router, 0x74, pirq-1, irq);
@@ -487,22 +487,18 @@ static int pirq_amd756_get(struct pci_de
 	u8 irq;
 	irq = 0;
 	if (pirq <= 4)
-	{
 		irq = read_config_nybble(router, 0x56, pirq - 1);
-	}
-	printk(KERN_INFO "AMD756: dev %04x:%04x, router pirq : %d get irq : %2d\n",
+	dev_info(&dev->dev, "AMD756: dev [%04x/%04x], router PIRQ %d get IRQ %d\n",
 		dev->vendor, dev->device, pirq, irq);
 	return irq;
 }
 
 static int pirq_amd756_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq)
 {
-	printk(KERN_INFO "AMD756: dev %04x:%04x, router pirq : %d SET irq : %2d\n", 
+	dev_info(&dev->dev, "AMD756: dev [%04x/%04x], router PIRQ %d set IRQ %d\n",
 		dev->vendor, dev->device, pirq, irq);
 	if (pirq <= 4)
-	{
 		write_config_nybble(router, 0x56, pirq - 1, irq);
-	}
 	return 1;
 }
 
@@ -736,7 +732,6 @@ static __init int ali_router_probe(struc
 	{
 	case PCI_DEVICE_ID_AL_M1533:
 	case PCI_DEVICE_ID_AL_M1563:
-		printk(KERN_DEBUG "PCI: Using ALI IRQ Router\n");
 		r->name = "ALI";
 		r->get = pirq_ali_get;
 		r->set = pirq_ali_set;
@@ -845,11 +840,9 @@ static void __init pirq_find_router(stru
 		if (pirq_router_dev->vendor == h->vendor && h->probe(r, pirq_router_dev, pirq_router_dev->device))
 			break;
 	}
-	printk(KERN_INFO "PCI: Using IRQ router %s [%04x/%04x] at %s\n",
-		pirq_router.name,
-		pirq_router_dev->vendor,
-		pirq_router_dev->device,
-		pci_name(pirq_router_dev));
+	dev_info(&pirq_router_dev->dev, "%s IRQ router [%04x/%04x]\n",
+		 pirq_router.name,
+		 pirq_router_dev->vendor, pirq_router_dev->device);
 
 	/* The device remains referenced for the kernel lifetime */
 }
@@ -880,7 +873,7 @@ static int pcibios_lookup_irq(struct pci
 	/* Find IRQ pin */
 	pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
 	if (!pin) {
-		DBG(KERN_DEBUG " -> no interrupt pin\n");
+		dev_dbg(&dev->dev, "no interrupt pin\n");
 		return 0;
 	}
 	pin = pin - 1;
@@ -889,20 +882,21 @@ static int pcibios_lookup_irq(struct pci
 
 	if (!pirq_table)
 		return 0;
-	
-	DBG(KERN_DEBUG "IRQ for %s[%c]", pci_name(dev), 'A' + pin);
+
 	info = pirq_get_info(dev);
 	if (!info) {
-		DBG(" -> not found in routing table\n" KERN_DEBUG);
+		dev_dbg(&dev->dev, "PCI INT%c# not found in routing table\n",
+			'A' + pin);
 		return 0;
 	}
 	pirq = info->irq[pin].link;
 	mask = info->irq[pin].bitmap;
 	if (!pirq) {
-		DBG(" -> not routed\n" KERN_DEBUG);
+		dev_dbg(&dev->dev, "PCI INT%c# not routed\n", 'A' + pin);
 		return 0;
 	}
-	DBG(" -> PIRQ %02x, mask %04x, excl %04x", pirq, mask, pirq_table->exclusive_irqs);
+	dev_dbg(&dev->dev, "PCI INT%c# -> PIRQ %02x, mask %04x, excl %04x",
+		'A' + pin, pirq, mask, pirq_table->exclusive_irqs);
 	mask &= pcibios_irq_mask;
 
 	/* Work around broken HP Pavilion Notebooks which assign USB to
@@ -928,11 +922,11 @@ static int pcibios_lookup_irq(struct pci
 	 */
 	newirq = dev->irq;
 	if (newirq && !((1 << newirq) & mask)) {
-		if ( pci_probe & PCI_USE_PIRQ_MASK) newirq = 0;
-		else printk("\n" KERN_WARNING
-			"PCI: IRQ %i for device %s doesn't match PIRQ mask "
-			"- try pci=usepirqmask\n" KERN_DEBUG, newirq,
-			pci_name(dev));
+		if (pci_probe & PCI_USE_PIRQ_MASK)
+			newirq = 0;
+		else
+			dev_warn(&dev->dev, "IRQ %d doesn't match PIRQ mask "
+				 "%#x; try pci=usepirqmask\n", newirq, mask);
 	}
 	if (!newirq && assign) {
 		for (i = 0; i < 16; i++) {
@@ -942,37 +936,32 @@ static int pcibios_lookup_irq(struct pci
 				newirq = i;
 		}
 	}
-	DBG(" -> newirq=%d", newirq);
+	dev_dbg(&dev->dev, "PCI INT%c# -> newirq %d", 'A' + pin, newirq);
 
 	/* Check if it is hardcoded */
 	if ((pirq & 0xf0) == 0xf0) {
 		irq = pirq & 0xf;
-		DBG(" -> hardcoded IRQ %d\n", irq);
-		msg = "Hardcoded";
+		msg = "hardcoded";
 	} else if ( r->get && (irq = r->get(pirq_router_dev, dev, pirq)) && \
 	((!(pci_probe & PCI_USE_PIRQ_MASK)) || ((1 << irq) & mask)) ) {
-		DBG(" -> got IRQ %d\n", irq);
-		msg = "Found";
+		msg = "found";
 		eisa_set_level_irq(irq);
 	} else if (newirq && r->set && (dev->class >> 8) != PCI_CLASS_DISPLAY_VGA) {
-		DBG(" -> assigning IRQ %d", newirq);
 		if (r->set(pirq_router_dev, dev, pirq, newirq)) {
 			eisa_set_level_irq(newirq);
-			DBG(" ... OK\n");
-			msg = "Assigned";
+			msg = "assigned";
 			irq = newirq;
 		}
 	}
 
 	if (!irq) {
-		DBG(" ... failed\n");
 		if (newirq && mask == (1 << newirq)) {
-			msg = "Guessed";
+			msg = "guessed";
 			irq = newirq;
 		} else
 			return 0;
 	}
-	printk(KERN_INFO "PCI: %s IRQ %d for device %s\n", msg, irq, pci_name(dev));
+	dev_info(&dev->dev, "%s PCI INT%c# -> IRQ %d\n", msg, 'A' + pin, irq);
 
 	/* Update IRQ for all devices with the same pirq value */
 	while ((dev2 = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev2)) != NULL) {
@@ -989,15 +978,17 @@ static int pcibios_lookup_irq(struct pci
 			(!(pci_probe & PCI_USE_PIRQ_MASK) || \
 			((1 << dev2->irq) & mask)) ) {
 #ifndef CONFIG_PCI_MSI
-		    		printk(KERN_INFO "IRQ routing conflict for %s, have irq %d, want irq %d\n",
-				       pci_name(dev2), dev2->irq, irq);
+				dev_info(&dev2->dev, "IRQ routing conflict: "
+					 "have IRQ %d, want IRQ %d\n",
+					 dev2->irq, irq);
 #endif
 		    		continue;
 		    	}
 			dev2->irq = irq;
 			pirq_penalty[irq]++;
 			if (dev != dev2)
-				printk(KERN_INFO "PCI: Sharing IRQ %d with %s\n", irq, pci_name(dev2));
+				dev_info(&dev->dev, "sharing IRQ %d with %s\n",
+					 irq, pci_name(dev2));
 		}
 	}
 	return 1;
@@ -1015,7 +1006,7 @@ static void __init pcibios_fixup_irqs(vo
 		 * Also keep track of which IRQ's are already in use.
 		 */
 		if (dev->irq >= 16) {
-			DBG(KERN_DEBUG "%s: ignoring bogus IRQ %d\n", pci_name(dev), dev->irq);
+			dev_dbg(&dev->dev, "ignoring bogus IRQ %d\n", dev->irq);
 			dev->irq = 0;
 		}
 		/* If the IRQ is already assigned to a PCI device, ignore its ISA use penalty */
@@ -1051,12 +1042,12 @@ static void __init pcibios_fixup_irqs(vo
 					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_warn(&dev->dev, "using bridge %s INT%c# to get IRQ %d\n",
+							 pci_name(bridge), 'A' + pin, irq);
 				}
 				if (irq >= 0) {
-					printk(KERN_INFO "PCI->APIC IRQ transform: %s[%c] -> IRQ %d\n",
-						pci_name(dev), 'A' + pin, irq);
+					dev_info(&dev->dev, "PCI->APIC IRQ transform: INT%c# -> IRQ %d\n",
+						'A' + pin, irq);
 					dev->irq = irq;
 				}
 			}
@@ -1209,14 +1200,14 @@ static int pirq_enable_irq(struct pci_de
 				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_warn(&dev->dev, "using bridge %s INT%c# to get IRQ %d\n",
+						 pci_name(bridge), 'A' + pin, irq);
 				dev = bridge;
 			}
 			dev = temp_dev;
 			if (irq >= 0) {
-				printk(KERN_INFO "PCI->APIC IRQ transform: %s[%c] -> IRQ %d\n",
-					pci_name(dev), 'A' + pin, irq);
+				dev_info(&dev->dev, "PCI->APIC IRQ transform: INT%c# -> IRQ %d\n",
+					 'A' + pin, irq);
 				dev->irq = irq;
 				return 0;
 			} else
@@ -1230,8 +1221,8 @@ static int pirq_enable_irq(struct pci_de
 		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, pci_name(dev), msg);
+		dev_warn(&dev->dev, "no IRQ known for INT%c#. %s\n",
+			 'A' + pin, msg);
 	}
 	return 0;
 }
Index: work11/arch/x86/pci/numa.c
===================================================================
--- work11.orig/arch/x86/pci/numa.c	2008-06-12 16:53:49.000000000 -0600
+++ work11/arch/x86/pci/numa.c	2008-06-13 09:52:12.000000000 -0600
@@ -155,13 +155,14 @@ static void __devinit pci_fixup_i450nx(s
 	u8 busno, suba, subb;
 	int quad = BUS2QUAD(d->bus->number);
 
-	printk("PCI: Searching for i450NX host bridges on %s\n", pci_name(d));
+	dev_info(&d->dev, "searching for i450NX host bridges\n");
 	reg = 0xd0;
 	for(pxb=0; pxb<2; pxb++) {
 		pci_read_config_byte(d, reg++, &busno);
 		pci_read_config_byte(d, reg++, &suba);
 		pci_read_config_byte(d, reg++, &subb);
-		DBG("i450NX PXB %d: %02x/%02x/%02x\n", pxb, busno, suba, subb);
+		dev_dbg(&d->dev, "i450NX PXB %d: %02x/%02x/%02x\n",
+			pxb, busno, suba, subb);
 		if (busno) {
 			/* Bus A */
 			pci_scan_bus_with_sysdata(QUADLOCAL2BUS(quad, busno));

-- 

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

* Re: [patch 0/5] dev_printk() conversions
  2008-06-13 16:52 [patch 0/5] dev_printk() conversions Bjorn Helgaas
                   ` (4 preceding siblings ...)
  2008-06-13 16:52 ` [patch 5/5] x86 PCI: " Bjorn Helgaas
@ 2008-06-25 23:07 ` Jesse Barnes
  5 siblings, 0 replies; 12+ messages in thread
From: Jesse Barnes @ 2008-06-25 23:07 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Len Brown, Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
	linux-acpi, linux-pci, linux-kernel, Andrew Morton

On Friday, June 13, 2008 9:52 am Bjorn Helgaas wrote:
> These convert some printks to dev_printks.  They are completely
> independent of each other; I'm just posting them together because
> it probably makes sense to review them together.
>
> It'd be nice if a PCI person looked at pci_request_region().  To
> me, it looks like it prints the wrong BAR number (it prints "bar + 1").

Thanks Bjorn, I applied 2-4 to my linux-next tree.  The x86 bits didn't apply 
for me, probably because my tree is slightly out of date, but those changes 
can come through Ingo & co.

Jesse

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

* Re: [patch 1/5] ACPI: use dev_printk when possible
  2008-06-13 16:52 ` [patch 1/5] ACPI: use dev_printk when possible Bjorn Helgaas
@ 2008-06-26  3:42   ` Len Brown
  0 siblings, 0 replies; 12+ messages in thread
From: Len Brown @ 2008-06-26  3:42 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jesse Barnes, Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
	linux-acpi, linux-pci, linux-kernel, Andrew Morton



On Fri, 13 Jun 2008, Bjorn Helgaas wrote:

> Convert printks to use dev_printk().  The most obvious change will
> be messages like this:
> 
>    -ACPI: PCI Interrupt 0000:00:04.0[A] -> GSI 31 (level, low) -> IRQ 31
>    +cciss 0000:00:04.0: PCI INTA# -> GSI 31 (level, low) -> IRQ 31

I like the part identifying the driver.
I'm also okay with having fewer messages tagged with ACPI:

> Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
> 
> Index: work11/drivers/acpi/pci_irq.c
> ===================================================================
> --- work11.orig/drivers/acpi/pci_irq.c	2008-06-12 16:53:52.000000000 -0600
> +++ work11/drivers/acpi/pci_irq.c	2008-06-13 09:32:19.000000000 -0600
> @@ -162,7 +162,7 @@ do_prt_fixups(struct acpi_prt_entry *ent
>  		    !strcmp(prt->source, quirk->source) &&
>  		    strlen(prt->source) >= strlen(quirk->actual_source)) {
>  			printk(KERN_WARNING PREFIX "firmware reports "
> -				"%04x:%02x:%02x[%c] connected to %s; "
> +				"%04x:%02x:%02x PCI INT%c# connected to %s; "

Can we delete the '#' from INTA# in this patch?
I don't think that using hardware polarity notation in kernel messages
clarifies anything, particularly since it is hard-coded and thus possibly
conflicting with the subsequent '(level, low)'...

otherwise,
Acked-by: Len Brown <len.brown@intel.com>

thanks,
-Len

>  				"changing to %s\n",
>  				entry->id.segment, entry->id.bus,
>  				entry->id.device, 'A' + entry->pin,
> @@ -429,7 +429,7 @@ acpi_pci_irq_derive(struct pci_dev *dev,
>  {
>  	struct pci_dev *bridge = dev;
>  	int irq = -1;
> -	u8 bridge_pin = 0;
> +	u8 bridge_pin = 0, orig_pin = pin;
>  
>  
>  	if (!dev)
> @@ -463,8 +463,8 @@ acpi_pci_irq_derive(struct pci_dev *dev,
>  	}
>  
>  	if (irq < 0) {
> -		printk(KERN_WARNING PREFIX "Unable to derive IRQ for device %s\n",
> -			      pci_name(dev));
> +		dev_warn(&dev->dev, "can't derive routing for PCI INT%c#\n",
> +			 'A' + orig_pin);
>  		return -1;
>  	}
>  
> @@ -487,6 +487,7 @@ int acpi_pci_irq_enable(struct pci_dev *
>  	int triggering = ACPI_LEVEL_SENSITIVE;
>  	int polarity = ACPI_ACTIVE_LOW;
>  	char *link = NULL;
> +	char link_desc[16];
>  	int rc;
>  
>  
> @@ -503,7 +504,7 @@ int acpi_pci_irq_enable(struct pci_dev *
>  	pin--;
>  
>  	if (!dev->bus) {
> -		printk(KERN_ERR PREFIX "Invalid (NULL) 'bus' field\n");
> +		dev_err(&dev->dev, "invalid (NULL) 'bus' field\n");
>  		return -ENODEV;
>  	}
>  
> @@ -538,8 +539,7 @@ int acpi_pci_irq_enable(struct pci_dev *
>  	 * driver reported one, then use it. Exit in any case.
>  	 */
>  	if (irq < 0) {
> -		printk(KERN_WARNING PREFIX "PCI Interrupt %s[%c]: no GSI",
> -		       pci_name(dev), ('A' + pin));
> +		dev_warn(&dev->dev, "PCI INT%c#: no GSI", 'A' + pin);
>  		/* Interrupt Line values above 0xF are forbidden */
>  		if (dev->irq > 0 && (dev->irq <= 0xF)) {
>  			printk(" - using IRQ %d\n", dev->irq);
> @@ -554,21 +554,21 @@ int acpi_pci_irq_enable(struct pci_dev *
>  
>  	rc = acpi_register_gsi(irq, triggering, polarity);
>  	if (rc < 0) {
> -		printk(KERN_WARNING PREFIX "PCI Interrupt %s[%c]: failed "
> -		       "to register GSI\n", pci_name(dev), ('A' + pin));
> +		dev_warn(&dev->dev, "PCI INT%c#: failed to register GSI\n",
> +			 'A' + pin);
>  		return rc;
>  	}
>  	dev->irq = rc;
>  
> -	printk(KERN_INFO PREFIX "PCI Interrupt %s[%c] -> ",
> -	       pci_name(dev), 'A' + pin);
> -
>  	if (link)
> -		printk("Link [%s] -> ", link);
> +		snprintf(link_desc, sizeof(link_desc), " -> Link[%s]", link);
> +	else
> +		link_desc[0] = '\0';
>  
> -	printk("GSI %u (%s, %s) -> IRQ %d\n", irq,
> -	       (triggering == ACPI_LEVEL_SENSITIVE) ? "level" : "edge",
> -	       (polarity == ACPI_ACTIVE_LOW) ? "low" : "high", dev->irq);
> +	dev_info(&dev->dev, "PCI INT%c#%s -> GSI %u (%s, %s) -> IRQ %d\n",
> +		 'A' + pin, link_desc, irq,
> +		 (triggering == ACPI_LEVEL_SENSITIVE) ? "level" : "edge",
> +		 (polarity == ACPI_ACTIVE_LOW) ? "low" : "high", dev->irq);
>  
>  	return 0;
>  }
> @@ -616,10 +616,6 @@ void acpi_pci_irq_disable(struct pci_dev
>  	 * (e.g. PCI_UNDEFINED_IRQ).
>  	 */
>  
> -	printk(KERN_INFO PREFIX "PCI interrupt for device %s disabled\n",
> -	       pci_name(dev));
> -
> +	dev_info(&dev->dev, "PCI INT%c# disabled\n", 'A' + pin);
>  	acpi_unregister_gsi(gsi);
> -
> -	return;
>  }
> 
> -- 
> 

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

* Re: [patch 5/5] x86 PCI: use dev_printk when possible
  2008-06-13 16:52 ` [patch 5/5] x86 PCI: " Bjorn Helgaas
@ 2008-06-26  3:48   ` Len Brown
  2008-06-30 23:57   ` Andrew Morton
  1 sibling, 0 replies; 12+ messages in thread
From: Len Brown @ 2008-06-26  3:48 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jesse Barnes, Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
	linux-acpi, linux-pci, linux-kernel, Andrew Morton

I guess the 'INTA#; rather than 'INTA' syntax I'm not fond of appears in 
this x86 patch too.  I think if we don't really have anything useful 
to say about polarity, then we should not add an active low symbol.

thanks,
-Len

-       printk(KERN_INFO "PCI: %s IRQ %d for device %s\n", msg, irq, 
pci_name(dev));
+       dev_info(&dev->dev, "%s PCI INT%c# -> IRQ %d\n", msg, 'A' + pin, 
irq);



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

* Re: [patch 5/5] x86 PCI: use dev_printk when possible
  2008-06-13 16:52 ` [patch 5/5] x86 PCI: " Bjorn Helgaas
  2008-06-26  3:48   ` Len Brown
@ 2008-06-30 23:57   ` Andrew Morton
  2008-07-02  1:57     ` Jesse Barnes
  1 sibling, 1 reply; 12+ messages in thread
From: Andrew Morton @ 2008-06-30 23:57 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: lenb, jbarnes, tglx, mingo, hpa, linux-acpi, linux-pci,
	linux-kernel

On Fri, 13 Jun 2008 10:52:14 -0600
Bjorn Helgaas <bjorn.helgaas@hp.com> wrote:

> I converted DBG() to dev_dbg().  This DBG() is from arch/x86/pci/pci.h
> and requires source-code modification to enable, so dev_dbg() seems
> roughly equivalent.
> 
> The printks in arch/x86/pci/irq.c were a little hairy, with lines
> printed in several pieces.  I straightened it out a little, but
> another set of eyes would be good.
> 
> Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
> 
> ---
>  arch/x86/pci/fixup.c |    3 +
>  arch/x86/pci/i386.c  |   26 ++++++--------
>  arch/x86/pci/irq.c   |   91 ++++++++++++++++++++++-----------------------------
>  arch/x86/pci/numa.c  |    5 +-

Got a bunch of rejects in arch/x86/pci/irq.c due to pending whitespace
fixes.  I fixed a couple of them but then I got bored, so the
conversion in there is only partial.

Please prefer to raise patches against linux-next if poss, especially
during late -rc's.


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

* Re: [patch 5/5] x86 PCI: use dev_printk when possible
  2008-06-30 23:57   ` Andrew Morton
@ 2008-07-02  1:57     ` Jesse Barnes
  2008-07-07 22:10       ` Bjorn Helgaas
  0 siblings, 1 reply; 12+ messages in thread
From: Jesse Barnes @ 2008-07-02  1:57 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Bjorn Helgaas, lenb, tglx, mingo, hpa, linux-acpi, linux-pci,
	linux-kernel

On Monday, June 30, 2008 4:57 pm Andrew Morton wrote:
> On Fri, 13 Jun 2008 10:52:14 -0600
>
> Bjorn Helgaas <bjorn.helgaas@hp.com> wrote:
> > I converted DBG() to dev_dbg().  This DBG() is from arch/x86/pci/pci.h
> > and requires source-code modification to enable, so dev_dbg() seems
> > roughly equivalent.
> >
> > The printks in arch/x86/pci/irq.c were a little hairy, with lines
> > printed in several pieces.  I straightened it out a little, but
> > another set of eyes would be good.
> >
> > Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
> >
> > ---
> >  arch/x86/pci/fixup.c |    3 +
> >  arch/x86/pci/i386.c  |   26 ++++++--------
> >  arch/x86/pci/irq.c   |   91
> > ++++++++++++++++++++++----------------------------- arch/x86/pci/numa.c 
> > |    5 +-
>
> Got a bunch of rejects in arch/x86/pci/irq.c due to pending whitespace
> fixes.  I fixed a couple of them but then I got bored, so the
> conversion in there is only partial.
>
> Please prefer to raise patches against linux-next if poss, especially
> during late -rc's.

Yeah, the x86 tree(s) move too fast for me to keep up with.  The change seems 
worthwhile though, maybe Ingo or one of the x86 team could just search & 
replace?

Jesse

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

* Re: [patch 5/5] x86 PCI: use dev_printk when possible
  2008-07-02  1:57     ` Jesse Barnes
@ 2008-07-07 22:10       ` Bjorn Helgaas
  0 siblings, 0 replies; 12+ messages in thread
From: Bjorn Helgaas @ 2008-07-07 22:10 UTC (permalink / raw)
  To: Jesse Barnes
  Cc: Andrew Morton, lenb, tglx, mingo, hpa, linux-acpi, linux-pci,
	linux-kernel

On Tuesday 01 July 2008 07:57:41 pm Jesse Barnes wrote:
> On Monday, June 30, 2008 4:57 pm Andrew Morton wrote:
> > On Fri, 13 Jun 2008 10:52:14 -0600
> >
> > Bjorn Helgaas <bjorn.helgaas@hp.com> wrote:
> > > I converted DBG() to dev_dbg().  This DBG() is from arch/x86/pci/pci.h
> > > and requires source-code modification to enable, so dev_dbg() seems
> > > roughly equivalent.
> > >
> > > The printks in arch/x86/pci/irq.c were a little hairy, with lines
> > > printed in several pieces.  I straightened it out a little, but
> > > another set of eyes would be good.
> > >
> > > Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
> > >
> > > ---
> > >  arch/x86/pci/fixup.c |    3 +
> > >  arch/x86/pci/i386.c  |   26 ++++++--------
> > >  arch/x86/pci/irq.c   |   91
> > > ++++++++++++++++++++++----------------------------- arch/x86/pci/numa.c 
> > > |    5 +-
> >
> > Got a bunch of rejects in arch/x86/pci/irq.c due to pending whitespace
> > fixes.  I fixed a couple of them but then I got bored, so the
> > conversion in there is only partial.
> >
> > Please prefer to raise patches against linux-next if poss, especially
> > during late -rc's.
> 
> Yeah, the x86 tree(s) move too fast for me to keep up with.  The change seems 
> worthwhile though, maybe Ingo or one of the x86 team could just search & 
> replace?

I'll fix it up.

Bjorn

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

end of thread, other threads:[~2008-07-07 22:12 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-13 16:52 [patch 0/5] dev_printk() conversions Bjorn Helgaas
2008-06-13 16:52 ` [patch 1/5] ACPI: use dev_printk when possible Bjorn Helgaas
2008-06-26  3:42   ` Len Brown
2008-06-13 16:52 ` [patch 2/5] PCI: " Bjorn Helgaas
2008-06-13 16:52 ` [patch 3/5] PCIE: aer: " Bjorn Helgaas
2008-06-13 16:52 ` [patch 4/5] PCIE: port driver: " Bjorn Helgaas
2008-06-13 16:52 ` [patch 5/5] x86 PCI: " Bjorn Helgaas
2008-06-26  3:48   ` Len Brown
2008-06-30 23:57   ` Andrew Morton
2008-07-02  1:57     ` Jesse Barnes
2008-07-07 22:10       ` Bjorn Helgaas
2008-06-25 23:07 ` [patch 0/5] dev_printk() conversions Jesse Barnes

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