Skip to content

Commit c7dabef

Browse files
Bjorn Helgaasjbarnes993
authored andcommitted
vsprintf: use %pR, %pr instead of %pRt, %pRf
Jesse accidentally applied v1 [1] of the patchset instead of v2 [2]. This is the diff between v1 and v2. The changes in this patch are: - tidied vsprintf stack buffer to shrink and compute size more accurately - use %pR for decoding and %pr for "raw" (with type and flags) instead of adding %pRt and %pRf [1] http://lkml.org/lkml/2009/10/6/491 [2] http://lkml.org/lkml/2009/10/13/441 Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
1 parent 4fd8bdc commit c7dabef

13 files changed

Lines changed: 114 additions & 107 deletions

File tree

‎arch/ia64/pci/pci.c‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,18 +298,19 @@ static __devinit acpi_status add_window(struct acpi_resource *res, void *data)
298298
window->offset = offset;
299299

300300
if (insert_resource(root, &window->resource)) {
301-
dev_err(&info->bridge->dev, "can't allocate %pRt\n",
301+
dev_err(&info->bridge->dev,
302+
"can't allocate host bridge window %pR\n",
302303
&window->resource);
303304
} else {
304305
if (offset)
305-
dev_info(&info->bridge->dev, "host bridge window: %pRt "
306+
dev_info(&info->bridge->dev, "host bridge window %pR "
306307
"(PCI address [%#llx-%#llx])\n",
307308
&window->resource,
308309
window->resource.start - offset,
309310
window->resource.end - offset);
310311
else
311312
dev_info(&info->bridge->dev,
312-
"host bridge window: %pRt\n",
313+
"host bridge window %pR\n",
313314
&window->resource);
314315
}
315316

@@ -330,7 +331,9 @@ pcibios_setup_root_windows(struct pci_bus *bus, struct pci_controller *ctrl)
330331
(res->end - res->start < 16))
331332
continue;
332333
if (j >= PCI_BUS_NUM_RESOURCES) {
333-
dev_warn(&bus->dev, "ignoring %pRf (no space)\n", res);
334+
dev_warn(&bus->dev,
335+
"ignoring host bridge window %pR (no space)\n",
336+
res);
334337
continue;
335338
}
336339
bus->resource[j++] = res;

‎arch/x86/pci/acpi.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,18 +108,19 @@ setup_resource(struct acpi_resource *acpi_res, void *data)
108108
res->child = NULL;
109109

110110
if (insert_resource(root, res)) {
111-
dev_err(&info->bridge->dev, "can't allocate %pRt\n", res);
111+
dev_err(&info->bridge->dev,
112+
"can't allocate host bridge window %pR\n", res);
112113
} else {
113114
info->bus->resource[info->res_num] = res;
114115
info->res_num++;
115116
if (addr.translation_offset)
116-
dev_info(&info->bridge->dev, "host bridge window: %pRt "
117+
dev_info(&info->bridge->dev, "host bridge window %pR "
117118
"(PCI address [%#llx-%#llx])\n",
118119
res, res->start - addr.translation_offset,
119120
res->end - addr.translation_offset);
120121
else
121122
dev_info(&info->bridge->dev,
122-
"host bridge window: %pRt\n", res);
123+
"host bridge window %pR\n", res);
123124
}
124125
return AE_OK;
125126
}

‎arch/x86/pci/i386.c‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list)
129129
continue;
130130
if (!r->start ||
131131
pci_claim_resource(dev, idx) < 0) {
132-
dev_info(&dev->dev, "BAR %d: can't allocate %pRt\n", idx, r);
132+
dev_info(&dev->dev, "BAR %d: can't allocate %pR\n", idx, r);
133133
/*
134134
* Something is wrong with the region.
135135
* Invalidate the resource to prevent
@@ -164,10 +164,11 @@ static void __init pcibios_allocate_resources(int pass)
164164
else
165165
disabled = !(command & PCI_COMMAND_MEMORY);
166166
if (pass == disabled) {
167-
dev_dbg(&dev->dev, "%pRf (d=%d, p=%d)\n", r,
168-
disabled, pass);
167+
dev_dbg(&dev->dev,
168+
"BAR %d: claiming %pr (d=%d, p=%d)\n",
169+
idx, r, disabled, pass);
169170
if (pci_claim_resource(dev, idx) < 0) {
170-
dev_info(&dev->dev, "BAR %d: can't allocate %pRt\n", idx, r);
171+
dev_info(&dev->dev, "BAR %d: can't claim %pR\n", idx, r);
171172
/* We'll assign a new address later */
172173
r->end -= r->start;
173174
r->start = 0;
@@ -180,7 +181,7 @@ static void __init pcibios_allocate_resources(int pass)
180181
/* Turn the ROM off, leave the resource region,
181182
* but keep it unregistered. */
182183
u32 reg;
183-
dev_dbg(&dev->dev, "disabling ROM %pRt\n", r);
184+
dev_dbg(&dev->dev, "disabling ROM %pR\n", r);
184185
r->flags &= ~IORESOURCE_ROM_ENABLE;
185186
pci_read_config_dword(dev,
186187
dev->rom_base_reg, &reg);

‎drivers/pci/pci.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1713,7 +1713,7 @@ static int __pci_request_region(struct pci_dev *pdev, int bar, const char *res_n
17131713
return 0;
17141714

17151715
err_out:
1716-
dev_warn(&pdev->dev, "BAR %d: can't reserve %pRt\n", bar,
1716+
dev_warn(&pdev->dev, "BAR %d: can't reserve %pR\n", bar,
17171717
&pdev->resource[bar]);
17181718
return -EBUSY;
17191719
}

‎drivers/pci/probe.c‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -225,12 +225,13 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
225225
if (!sz64)
226226
goto fail;
227227

228-
res->flags |= IORESOURCE_MEM_64;
229-
230228
if ((sizeof(resource_size_t) < 8) && (sz64 > 0x100000000ULL)) {
231229
dev_err(&dev->dev, "can't handle 64-bit BAR\n");
232230
goto fail;
233-
} else if ((sizeof(resource_size_t) < 8) && l) {
231+
}
232+
233+
res->flags |= IORESOURCE_MEM_64;
234+
if ((sizeof(resource_size_t) < 8) && l) {
234235
/* Address above 32-bit boundary; disable the BAR */
235236
pci_write_config_dword(dev, pos, 0);
236237
pci_write_config_dword(dev, pos + 4, 0);
@@ -239,7 +240,7 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
239240
} else {
240241
res->start = l64;
241242
res->end = l64 + sz64;
242-
dev_printk(KERN_DEBUG, &dev->dev, "reg %x: %pRt\n",
243+
dev_printk(KERN_DEBUG, &dev->dev, "reg %x: %pR\n",
243244
pos, res);
244245
}
245246
} else {
@@ -251,7 +252,7 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
251252
res->start = l;
252253
res->end = l + sz;
253254

254-
dev_printk(KERN_DEBUG, &dev->dev, "reg %x: %pRt\n", pos, res);
255+
dev_printk(KERN_DEBUG, &dev->dev, "reg %x: %pR\n", pos, res);
255256
}
256257

257258
out:
@@ -319,7 +320,7 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child)
319320
res->start = base;
320321
if (!res->end)
321322
res->end = limit + 0xfff;
322-
dev_printk(KERN_DEBUG, &dev->dev, "bridge window: %pRt\n", res);
323+
dev_printk(KERN_DEBUG, &dev->dev, " bridge window %pR\n", res);
323324
}
324325

325326
res = child->resource[1];
@@ -331,7 +332,7 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child)
331332
res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM;
332333
res->start = base;
333334
res->end = limit + 0xfffff;
334-
dev_printk(KERN_DEBUG, &dev->dev, "bridge window: %pRt\n", res);
335+
dev_printk(KERN_DEBUG, &dev->dev, " bridge window %pR\n", res);
335336
}
336337

337338
res = child->resource[2];
@@ -370,7 +371,7 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child)
370371
res->flags |= IORESOURCE_MEM_64;
371372
res->start = base;
372373
res->end = limit + 0xfffff;
373-
dev_printk(KERN_DEBUG, &dev->dev, "bridge window: %pRt\n", res);
374+
dev_printk(KERN_DEBUG, &dev->dev, " bridge window %pR\n", res);
374375
}
375376
}
376377

‎drivers/pci/quirks.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ static void __devinit quirk_io_region(struct pci_dev *dev, unsigned region,
357357
pcibios_bus_to_resource(dev, res, &bus_region);
358358

359359
pci_claim_resource(dev, nr);
360-
dev_info(&dev->dev, "quirk: region %04x-%04x claimed by %s\n", region, region + size - 1, name);
360+
dev_info(&dev->dev, "quirk: %pR claimed by %s\n", res, name);
361361
}
362362
}
363363

‎drivers/pci/setup-bus.c‎

Lines changed: 36 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -71,53 +71,50 @@ static void pbus_assign_resources_sorted(const struct pci_bus *bus)
7171
void pci_setup_cardbus(struct pci_bus *bus)
7272
{
7373
struct pci_dev *bridge = bus->self;
74+
struct resource *res;
7475
struct pci_bus_region region;
7576

7677
dev_info(&bridge->dev, "CardBus bridge, secondary bus %04x:%02x\n",
7778
pci_domain_nr(bus), bus->number);
7879

79-
pcibios_resource_to_bus(bridge, &region, bus->resource[0]);
80-
if (bus->resource[0]->flags & IORESOURCE_IO) {
80+
res = bus->resource[0];
81+
pcibios_resource_to_bus(bridge, &region, res);
82+
if (res->flags & IORESOURCE_IO) {
8183
/*
8284
* The IO resource is allocated a range twice as large as it
8385
* would normally need. This allows us to set both IO regs.
8486
*/
85-
dev_info(&bridge->dev, " IO window: %#08lx-%#08lx\n",
86-
(unsigned long)region.start,
87-
(unsigned long)region.end);
87+
dev_info(&bridge->dev, " bridge window %pR\n", res);
8888
pci_write_config_dword(bridge, PCI_CB_IO_BASE_0,
8989
region.start);
9090
pci_write_config_dword(bridge, PCI_CB_IO_LIMIT_0,
9191
region.end);
9292
}
9393

94-
pcibios_resource_to_bus(bridge, &region, bus->resource[1]);
95-
if (bus->resource[1]->flags & IORESOURCE_IO) {
96-
dev_info(&bridge->dev, " IO window: %#08lx-%#08lx\n",
97-
(unsigned long)region.start,
98-
(unsigned long)region.end);
94+
res = bus->resource[1];
95+
pcibios_resource_to_bus(bridge, &region, res);
96+
if (res->flags & IORESOURCE_IO) {
97+
dev_info(&bridge->dev, " bridge window %pR\n", res);
9998
pci_write_config_dword(bridge, PCI_CB_IO_BASE_1,
10099
region.start);
101100
pci_write_config_dword(bridge, PCI_CB_IO_LIMIT_1,
102101
region.end);
103102
}
104103

105-
pcibios_resource_to_bus(bridge, &region, bus->resource[2]);
106-
if (bus->resource[2]->flags & IORESOURCE_MEM) {
107-
dev_info(&bridge->dev, " PREFETCH window: %#08lx-%#08lx\n",
108-
(unsigned long)region.start,
109-
(unsigned long)region.end);
104+
res = bus->resource[2];
105+
pcibios_resource_to_bus(bridge, &region, res);
106+
if (res->flags & IORESOURCE_MEM) {
107+
dev_info(&bridge->dev, " bridge window %pR\n", res);
110108
pci_write_config_dword(bridge, PCI_CB_MEMORY_BASE_0,
111109
region.start);
112110
pci_write_config_dword(bridge, PCI_CB_MEMORY_LIMIT_0,
113111
region.end);
114112
}
115113

116-
pcibios_resource_to_bus(bridge, &region, bus->resource[3]);
117-
if (bus->resource[3]->flags & IORESOURCE_MEM) {
118-
dev_info(&bridge->dev, " MEM window: %#08lx-%#08lx\n",
119-
(unsigned long)region.start,
120-
(unsigned long)region.end);
114+
res = bus->resource[3];
115+
pcibios_resource_to_bus(bridge, &region, res);
116+
if (res->flags & IORESOURCE_MEM) {
117+
dev_info(&bridge->dev, " bridge window %pR\n", res);
121118
pci_write_config_dword(bridge, PCI_CB_MEMORY_BASE_1,
122119
region.start);
123120
pci_write_config_dword(bridge, PCI_CB_MEMORY_LIMIT_1,
@@ -140,6 +137,7 @@ EXPORT_SYMBOL(pci_setup_cardbus);
140137
static void pci_setup_bridge(struct pci_bus *bus)
141138
{
142139
struct pci_dev *bridge = bus->self;
140+
struct resource *res;
143141
struct pci_bus_region region;
144142
u32 l, bu, lu, io_upper16;
145143
int pref_mem64;
@@ -151,23 +149,22 @@ static void pci_setup_bridge(struct pci_bus *bus)
151149
pci_domain_nr(bus), bus->number);
152150

153151
/* Set up the top and bottom of the PCI I/O segment for this bus. */
154-
pcibios_resource_to_bus(bridge, &region, bus->resource[0]);
155-
if (bus->resource[0]->flags & IORESOURCE_IO) {
152+
res = bus->resource[0];
153+
pcibios_resource_to_bus(bridge, &region, res);
154+
if (res->flags & IORESOURCE_IO) {
156155
pci_read_config_dword(bridge, PCI_IO_BASE, &l);
157156
l &= 0xffff0000;
158157
l |= (region.start >> 8) & 0x00f0;
159158
l |= region.end & 0xf000;
160159
/* Set up upper 16 bits of I/O base/limit. */
161160
io_upper16 = (region.end & 0xffff0000) | (region.start >> 16);
162-
dev_info(&bridge->dev, " IO window: %#04lx-%#04lx\n",
163-
(unsigned long)region.start,
164-
(unsigned long)region.end);
161+
dev_info(&bridge->dev, " bridge window %pR\n", res);
165162
}
166163
else {
167164
/* Clear upper 16 bits of I/O base/limit. */
168165
io_upper16 = 0;
169166
l = 0x00f0;
170-
dev_info(&bridge->dev, " IO window: disabled\n");
167+
dev_info(&bridge->dev, " bridge window [io disabled]\n");
171168
}
172169
/* Temporarily disable the I/O range before updating PCI_IO_BASE. */
173170
pci_write_config_dword(bridge, PCI_IO_BASE_UPPER16, 0x0000ffff);
@@ -178,17 +175,16 @@ static void pci_setup_bridge(struct pci_bus *bus)
178175

179176
/* Set up the top and bottom of the PCI Memory segment
180177
for this bus. */
181-
pcibios_resource_to_bus(bridge, &region, bus->resource[1]);
182-
if (bus->resource[1]->flags & IORESOURCE_MEM) {
178+
res = bus->resource[1];
179+
pcibios_resource_to_bus(bridge, &region, res);
180+
if (res->flags & IORESOURCE_MEM) {
183181
l = (region.start >> 16) & 0xfff0;
184182
l |= region.end & 0xfff00000;
185-
dev_info(&bridge->dev, " MEM window: %#08lx-%#08lx\n",
186-
(unsigned long)region.start,
187-
(unsigned long)region.end);
183+
dev_info(&bridge->dev, " bridge window %pR\n", res);
188184
}
189185
else {
190186
l = 0x0000fff0;
191-
dev_info(&bridge->dev, " MEM window: disabled\n");
187+
dev_info(&bridge->dev, " bridge window [mem disabled]\n");
192188
}
193189
pci_write_config_dword(bridge, PCI_MEMORY_BASE, l);
194190

@@ -200,24 +196,21 @@ static void pci_setup_bridge(struct pci_bus *bus)
200196
/* Set up PREF base/limit. */
201197
pref_mem64 = 0;
202198
bu = lu = 0;
203-
pcibios_resource_to_bus(bridge, &region, bus->resource[2]);
204-
if (bus->resource[2]->flags & IORESOURCE_PREFETCH) {
205-
int width = 8;
199+
res = bus->resource[2];
200+
pcibios_resource_to_bus(bridge, &region, res);
201+
if (res->flags & IORESOURCE_PREFETCH) {
206202
l = (region.start >> 16) & 0xfff0;
207203
l |= region.end & 0xfff00000;
208-
if (bus->resource[2]->flags & IORESOURCE_MEM_64) {
204+
if (res->flags & IORESOURCE_MEM_64) {
209205
pref_mem64 = 1;
210206
bu = upper_32_bits(region.start);
211207
lu = upper_32_bits(region.end);
212-
width = 16;
213208
}
214-
dev_info(&bridge->dev, " PREFETCH window: %#0*llx-%#0*llx\n",
215-
width, (unsigned long long)region.start,
216-
width, (unsigned long long)region.end);
209+
dev_info(&bridge->dev, " bridge window %pR\n", res);
217210
}
218211
else {
219212
l = 0x0000fff0;
220-
dev_info(&bridge->dev, " PREFETCH window: disabled\n");
213+
dev_info(&bridge->dev, " bridge window [mem pref disabled]\n");
221214
}
222215
pci_write_config_dword(bridge, PCI_PREF_MEMORY_BASE, l);
223216

@@ -391,7 +384,7 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,
391384
order = __ffs(align) - 20;
392385
if (order > 11) {
393386
dev_warn(&dev->dev, "BAR %d: bad alignment %llx: "
394-
"%pRt\n", i, (unsigned long long)align, r);
387+
"%pR\n", i, (unsigned long long)align, r);
395388
r->flags = 0;
396389
continue;
397390
}
@@ -582,7 +575,7 @@ static void pci_bus_dump_res(struct pci_bus *bus)
582575
if (!res || !res->end)
583576
continue;
584577

585-
dev_printk(KERN_DEBUG, &bus->dev, "resource %d %pRt\n", i, res);
578+
dev_printk(KERN_DEBUG, &bus->dev, "resource %d %pR\n", i, res);
586579
}
587580
}
588581

0 commit comments

Comments
 (0)