Skip to content

Commit 12c0b20

Browse files
Bjorn Helgaasjbarnes993
authored andcommitted
x86/PCI: use dev_printk when possible
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. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
1 parent 756f7bc commit 12c0b20

File tree

4 files changed

+64
-76
lines changed

4 files changed

+64
-76
lines changed

arch/x86/pci/fixup.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ static void __devinit pci_fixup_i450nx(struct pci_dev *d)
2323
pci_read_config_byte(d, reg++, &busno);
2424
pci_read_config_byte(d, reg++, &suba);
2525
pci_read_config_byte(d, reg++, &subb);
26-
DBG("i450NX PXB %d: %02x/%02x/%02x\n", pxb, busno, suba, subb);
26+
dev_dbg(&d->dev, "i450NX PXB %d: %02x/%02x/%02x\n", pxb, busno,
27+
suba, subb);
2728
if (busno)
2829
pci_scan_bus_with_sysdata(busno); /* Bus A */
2930
if (suba < subb)

arch/x86/pci/i386.c

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,8 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list)
128128
pr = pci_find_parent_resource(dev, r);
129129
if (!r->start || !pr ||
130130
request_resource(pr, r) < 0) {
131-
printk(KERN_ERR "PCI: Cannot allocate "
132-
"resource region %d "
133-
"of bridge %s\n",
134-
idx, pci_name(dev));
131+
dev_err(&dev->dev, "BAR %d: can't "
132+
"allocate resource\n", idx);
135133
/*
136134
* Something is wrong with the region.
137135
* Invalidate the resource to prevent
@@ -166,15 +164,15 @@ static void __init pcibios_allocate_resources(int pass)
166164
else
167165
disabled = !(command & PCI_COMMAND_MEMORY);
168166
if (pass == disabled) {
169-
DBG("PCI: Resource %08lx-%08lx "
170-
"(f=%lx, d=%d, p=%d)\n",
171-
r->start, r->end, r->flags, disabled, pass);
167+
dev_dbg(&dev->dev, "resource %#08llx-%#08llx "
168+
"(f=%lx, d=%d, p=%d)\n",
169+
(unsigned long long) r->start,
170+
(unsigned long long) r->end,
171+
r->flags, disabled, pass);
172172
pr = pci_find_parent_resource(dev, r);
173173
if (!pr || request_resource(pr, r) < 0) {
174-
printk(KERN_ERR "PCI: Cannot allocate "
175-
"resource region %d "
176-
"of device %s\n",
177-
idx, pci_name(dev));
174+
dev_err(&dev->dev, "BAR %d: can't "
175+
"allocate resource\n", idx);
178176
/* We'll assign a new address later */
179177
r->end -= r->start;
180178
r->start = 0;
@@ -187,8 +185,7 @@ static void __init pcibios_allocate_resources(int pass)
187185
/* Turn the ROM off, leave the resource region,
188186
* but keep it unregistered. */
189187
u32 reg;
190-
DBG("PCI: Switching off ROM of %s\n",
191-
pci_name(dev));
188+
dev_dbg(&dev->dev, "disabling ROM\n");
192189
r->flags &= ~IORESOURCE_ROM_ENABLE;
193190
pci_read_config_dword(dev,
194191
dev->rom_base_reg, &reg);
@@ -257,8 +254,7 @@ void pcibios_set_master(struct pci_dev *dev)
257254
lat = pcibios_max_latency;
258255
else
259256
return;
260-
printk(KERN_DEBUG "PCI: Setting latency timer of device %s to %d\n",
261-
pci_name(dev), lat);
257+
dev_printk(KERN_DEBUG, &dev->dev, "setting latency timer to %d\n", lat);
262258
pci_write_config_byte(dev, PCI_LATENCY_TIMER, lat);
263259
}
264260

arch/x86/pci/irq.c

Lines changed: 48 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ static int pirq_vlsi_get(struct pci_dev *router, struct pci_dev *dev, int pirq)
436436
{
437437
WARN_ON_ONCE(pirq >= 9);
438438
if (pirq > 8) {
439-
printk(KERN_INFO "VLSI router pirq escape (%d)\n", pirq);
439+
dev_info(&dev->dev, "VLSI router PIRQ escape (%d)\n", pirq);
440440
return 0;
441441
}
442442
return read_config_nybble(router, 0x74, pirq-1);
@@ -446,7 +446,7 @@ static int pirq_vlsi_set(struct pci_dev *router, struct pci_dev *dev, int pirq,
446446
{
447447
WARN_ON_ONCE(pirq >= 9);
448448
if (pirq > 8) {
449-
printk(KERN_INFO "VLSI router pirq escape (%d)\n", pirq);
449+
dev_info(&dev->dev, "VLSI router PIRQ escape (%d)\n", pirq);
450450
return 0;
451451
}
452452
write_config_nybble(router, 0x74, pirq-1, irq);
@@ -492,15 +492,17 @@ static int pirq_amd756_get(struct pci_dev *router, struct pci_dev *dev, int pirq
492492
irq = 0;
493493
if (pirq <= 4)
494494
irq = read_config_nybble(router, 0x56, pirq - 1);
495-
printk(KERN_INFO "AMD756: dev %04x:%04x, router pirq : %d get irq : %2d\n",
496-
dev->vendor, dev->device, pirq, irq);
495+
dev_info(&dev->dev,
496+
"AMD756: dev [%04x/%04x], router PIRQ %d get IRQ %d\n",
497+
dev->vendor, dev->device, pirq, irq);
497498
return irq;
498499
}
499500

500501
static int pirq_amd756_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq)
501502
{
502-
printk(KERN_INFO "AMD756: dev %04x:%04x, router pirq : %d SET irq : %2d\n",
503-
dev->vendor, dev->device, pirq, irq);
503+
dev_info(&dev->dev,
504+
"AMD756: dev [%04x/%04x], router PIRQ %d set IRQ %d\n",
505+
dev->vendor, dev->device, pirq, irq);
504506
if (pirq <= 4)
505507
write_config_nybble(router, 0x56, pirq - 1, irq);
506508
return 1;
@@ -730,7 +732,6 @@ static __init int ali_router_probe(struct irq_router *r, struct pci_dev *router,
730732
switch (device) {
731733
case PCI_DEVICE_ID_AL_M1533:
732734
case PCI_DEVICE_ID_AL_M1563:
733-
printk(KERN_DEBUG "PCI: Using ALI IRQ Router\n");
734735
r->name = "ALI";
735736
r->get = pirq_ali_get;
736737
r->set = pirq_ali_set;
@@ -840,11 +841,9 @@ static void __init pirq_find_router(struct irq_router *r)
840841
h->probe(r, pirq_router_dev, pirq_router_dev->device))
841842
break;
842843
}
843-
printk(KERN_INFO "PCI: Using IRQ router %s [%04x/%04x] at %s\n",
844-
pirq_router.name,
845-
pirq_router_dev->vendor,
846-
pirq_router_dev->device,
847-
pci_name(pirq_router_dev));
844+
dev_info(&pirq_router_dev->dev, "%s IRQ router [%04x/%04x]\n",
845+
pirq_router.name,
846+
pirq_router_dev->vendor, pirq_router_dev->device);
848847

849848
/* The device remains referenced for the kernel lifetime */
850849
}
@@ -877,7 +876,7 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign)
877876
/* Find IRQ pin */
878877
pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
879878
if (!pin) {
880-
DBG(KERN_DEBUG " -> no interrupt pin\n");
879+
dev_dbg(&dev->dev, "no interrupt pin\n");
881880
return 0;
882881
}
883882
pin = pin - 1;
@@ -887,20 +886,20 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign)
887886
if (!pirq_table)
888887
return 0;
889888

890-
DBG(KERN_DEBUG "IRQ for %s[%c]", pci_name(dev), 'A' + pin);
891889
info = pirq_get_info(dev);
892890
if (!info) {
893-
DBG(" -> not found in routing table\n" KERN_DEBUG);
891+
dev_dbg(&dev->dev, "PCI INT %c not found in routing table\n",
892+
'A' + pin);
894893
return 0;
895894
}
896895
pirq = info->irq[pin].link;
897896
mask = info->irq[pin].bitmap;
898897
if (!pirq) {
899-
DBG(" -> not routed\n" KERN_DEBUG);
898+
dev_dbg(&dev->dev, "PCI INT %c not routed\n", 'A' + pin);
900899
return 0;
901900
}
902-
DBG(" -> PIRQ %02x, mask %04x, excl %04x", pirq, mask,
903-
pirq_table->exclusive_irqs);
901+
dev_dbg(&dev->dev, "PCI INT %c -> PIRQ %02x, mask %04x, excl %04x",
902+
'A' + pin, pirq, mask, pirq_table->exclusive_irqs);
904903
mask &= pcibios_irq_mask;
905904

906905
/* Work around broken HP Pavilion Notebooks which assign USB to
@@ -930,10 +929,8 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign)
930929
if (pci_probe & PCI_USE_PIRQ_MASK)
931930
newirq = 0;
932931
else
933-
printk("\n" KERN_WARNING
934-
"PCI: IRQ %i for device %s doesn't match PIRQ mask - try pci=usepirqmask\n"
935-
KERN_DEBUG, newirq,
936-
pci_name(dev));
932+
dev_warn(&dev->dev, "IRQ %d doesn't match PIRQ mask "
933+
"%#x; try pci=usepirqmask\n", newirq, mask);
937934
}
938935
if (!newirq && assign) {
939936
for (i = 0; i < 16; i++) {
@@ -944,39 +941,35 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign)
944941
newirq = i;
945942
}
946943
}
947-
DBG(" -> newirq=%d", newirq);
944+
dev_dbg(&dev->dev, "PCI INT %c -> newirq %d", 'A' + pin, newirq);
948945

949946
/* Check if it is hardcoded */
950947
if ((pirq & 0xf0) == 0xf0) {
951948
irq = pirq & 0xf;
952-
DBG(" -> hardcoded IRQ %d\n", irq);
953-
msg = "Hardcoded";
949+
msg = "hardcoded";
954950
} else if (r->get && (irq = r->get(pirq_router_dev, dev, pirq)) && \
955951
((!(pci_probe & PCI_USE_PIRQ_MASK)) || ((1 << irq) & mask))) {
956-
DBG(" -> got IRQ %d\n", irq);
957-
msg = "Found";
952+
msg = "found";
958953
eisa_set_level_irq(irq);
959954
} else if (newirq && r->set &&
960955
(dev->class >> 8) != PCI_CLASS_DISPLAY_VGA) {
961-
DBG(" -> assigning IRQ %d", newirq);
962956
if (r->set(pirq_router_dev, dev, pirq, newirq)) {
963957
eisa_set_level_irq(newirq);
964-
DBG(" ... OK\n");
965-
msg = "Assigned";
958+
msg = "assigned";
966959
irq = newirq;
967960
}
968961
}
969962

970963
if (!irq) {
971-
DBG(" ... failed\n");
972964
if (newirq && mask == (1 << newirq)) {
973-
msg = "Guessed";
965+
msg = "guessed";
974966
irq = newirq;
975-
} else
967+
} else {
968+
dev_dbg(&dev->dev, "can't route interrupt\n");
976969
return 0;
970+
}
977971
}
978-
printk(KERN_INFO "PCI: %s IRQ %d for device %s\n", msg, irq,
979-
pci_name(dev));
972+
dev_info(&dev->dev, "%s PCI INT %c -> IRQ %d\n", msg, 'A' + pin, irq);
980973

981974
/* Update IRQ for all devices with the same pirq value */
982975
while ((dev2 = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev2)) != NULL) {
@@ -996,17 +989,17 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign)
996989
(!(pci_probe & PCI_USE_PIRQ_MASK) || \
997990
((1 << dev2->irq) & mask))) {
998991
#ifndef CONFIG_PCI_MSI
999-
printk(KERN_INFO "IRQ routing conflict for %s, have irq %d, want irq %d\n",
1000-
pci_name(dev2), dev2->irq, irq);
992+
dev_info(&dev2->dev, "IRQ routing conflict: "
993+
"have IRQ %d, want IRQ %d\n",
994+
dev2->irq, irq);
1001995
#endif
1002996
continue;
1003997
}
1004998
dev2->irq = irq;
1005999
pirq_penalty[irq]++;
10061000
if (dev != dev2)
1007-
printk(KERN_INFO
1008-
"PCI: Sharing IRQ %d with %s\n",
1009-
irq, pci_name(dev2));
1001+
dev_info(&dev->dev, "sharing IRQ %d with %s\n",
1002+
irq, pci_name(dev2));
10101003
}
10111004
}
10121005
return 1;
@@ -1025,8 +1018,7 @@ static void __init pcibios_fixup_irqs(void)
10251018
* already in use.
10261019
*/
10271020
if (dev->irq >= 16) {
1028-
DBG(KERN_DEBUG "%s: ignoring bogus IRQ %d\n",
1029-
pci_name(dev), dev->irq);
1021+
dev_dbg(&dev->dev, "ignoring bogus IRQ %d\n", dev->irq);
10301022
dev->irq = 0;
10311023
}
10321024
/*
@@ -1070,12 +1062,12 @@ static void __init pcibios_fixup_irqs(void)
10701062
irq = IO_APIC_get_PCI_irq_vector(bridge->bus->number,
10711063
PCI_SLOT(bridge->devfn), pin);
10721064
if (irq >= 0)
1073-
printk(KERN_WARNING "PCI: using PPB %s[%c] to get irq %d\n",
1074-
pci_name(bridge), 'A' + pin, irq);
1065+
dev_warn(&dev->dev, "using bridge %s INT %c to get IRQ %d\n",
1066+
pci_name(bridge),
1067+
'A' + pin, irq);
10751068
}
10761069
if (irq >= 0) {
1077-
printk(KERN_INFO "PCI->APIC IRQ transform: %s[%c] -> IRQ %d\n",
1078-
pci_name(dev), 'A' + pin, irq);
1070+
dev_info(&dev->dev, "PCI->APIC IRQ transform: INT %c -> IRQ %d\n", 'A' + pin, irq);
10791071
dev->irq = irq;
10801072
}
10811073
}
@@ -1231,25 +1223,24 @@ static int pirq_enable_irq(struct pci_dev *dev)
12311223
irq = IO_APIC_get_PCI_irq_vector(bridge->bus->number,
12321224
PCI_SLOT(bridge->devfn), pin);
12331225
if (irq >= 0)
1234-
printk(KERN_WARNING
1235-
"PCI: using PPB %s[%c] to get irq %d\n",
1236-
pci_name(bridge),
1237-
'A' + pin, irq);
1226+
dev_warn(&dev->dev, "using bridge %s "
1227+
"INT %c to get IRQ %d\n",
1228+
pci_name(bridge), 'A' + pin,
1229+
irq);
12381230
dev = bridge;
12391231
}
12401232
dev = temp_dev;
12411233
if (irq >= 0) {
1242-
printk(KERN_INFO
1243-
"PCI->APIC IRQ transform: %s[%c] -> IRQ %d\n",
1244-
pci_name(dev), 'A' + pin, irq);
1234+
dev_info(&dev->dev, "PCI->APIC IRQ transform: "
1235+
"INT %c -> IRQ %d\n", 'A' + pin, irq);
12451236
dev->irq = irq;
12461237
return 0;
12471238
} else
1248-
msg = " Probably buggy MP table.";
1239+
msg = "; probably buggy MP table";
12491240
} else if (pci_probe & PCI_BIOS_IRQ_SCAN)
12501241
msg = "";
12511242
else
1252-
msg = " Please try using pci=biosirq.";
1243+
msg = "; please try using pci=biosirq";
12531244

12541245
/*
12551246
* With IDE legacy devices the IRQ lookup failure is not
@@ -1259,9 +1250,8 @@ static int pirq_enable_irq(struct pci_dev *dev)
12591250
!(dev->class & 0x5))
12601251
return 0;
12611252

1262-
printk(KERN_WARNING
1263-
"PCI: No IRQ known for interrupt pin %c of device %s.%s\n",
1264-
'A' + pin, pci_name(dev), msg);
1253+
dev_warn(&dev->dev, "can't find IRQ for PCI INT %c%s\n",
1254+
'A' + pin, msg);
12651255
}
12661256
return 0;
12671257
}

arch/x86/pci/numaq_32.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,14 @@ static void __devinit pci_fixup_i450nx(struct pci_dev *d)
131131
u8 busno, suba, subb;
132132
int quad = BUS2QUAD(d->bus->number);
133133

134-
printk("PCI: Searching for i450NX host bridges on %s\n", pci_name(d));
134+
dev_info(&d->dev, "searching for i450NX host bridges\n");
135135
reg = 0xd0;
136136
for(pxb=0; pxb<2; pxb++) {
137137
pci_read_config_byte(d, reg++, &busno);
138138
pci_read_config_byte(d, reg++, &suba);
139139
pci_read_config_byte(d, reg++, &subb);
140-
DBG("i450NX PXB %d: %02x/%02x/%02x\n", pxb, busno, suba, subb);
140+
dev_dbg(&d->dev, "i450NX PXB %d: %02x/%02x/%02x\n",
141+
pxb, busno, suba, subb);
141142
if (busno) {
142143
/* Bus A */
143144
pci_scan_bus_with_sysdata(QUADLOCAL2BUS(quad, busno));

0 commit comments

Comments
 (0)