aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2009-10-27 15:26:47 -0400
committerJesse Barnes <jbarnes@virtuousgeek.org>2009-11-04 16:06:41 -0500
commitc7dabef8a2c59e6a3de9d66fc35fb6a43ef7172d (patch)
tree0f8b0021e693a0e380ef9026083b59d0909dffc6
parent4fd8bdc567e70c02fab7eeaaa7d2a64232add789 (diff)
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>
-rw-r--r--arch/ia64/pci/pci.c11
-rw-r--r--arch/x86/pci/acpi.c7
-rw-r--r--arch/x86/pci/i386.c11
-rw-r--r--drivers/pci/pci.c2
-rw-r--r--drivers/pci/probe.c17
-rw-r--r--drivers/pci/quirks.c2
-rw-r--r--drivers/pci/setup-bus.c79
-rw-r--r--drivers/pci/setup-res.c20
-rw-r--r--drivers/pnp/quirks.c5
-rw-r--r--drivers/pnp/resource.c8
-rw-r--r--drivers/pnp/support.c2
-rw-r--r--drivers/pnp/system.c2
-rw-r--r--lib/vsprintf.c55
13 files changed, 114 insertions, 107 deletions
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index 06413b827e97..df639db779f9 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -298,18 +298,19 @@ static __devinit acpi_status add_window(struct acpi_resource *res, void *data)
298 window->offset = offset; 298 window->offset = offset;
299 299
300 if (insert_resource(root, &window->resource)) { 300 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",
302 &window->resource); 303 &window->resource);
303 } else { 304 } else {
304 if (offset) 305 if (offset)
305 dev_info(&info->bridge->dev, "host bridge window: %pRt " 306 dev_info(&info->bridge->dev, "host bridge window %pR "
306 "(PCI address [%#llx-%#llx])\n", 307 "(PCI address [%#llx-%#llx])\n",
307 &window->resource, 308 &window->resource,
308 window->resource.start - offset, 309 window->resource.start - offset,
309 window->resource.end - offset); 310 window->resource.end - offset);
310 else 311 else
311 dev_info(&info->bridge->dev, 312 dev_info(&info->bridge->dev,
312 "host bridge window: %pRt\n", 313 "host bridge window %pR\n",
313 &window->resource); 314 &window->resource);
314 } 315 }
315 316
@@ -330,7 +331,9 @@ pcibios_setup_root_windows(struct pci_bus *bus, struct pci_controller *ctrl)
330 (res->end - res->start < 16)) 331 (res->end - res->start < 16))
331 continue; 332 continue;
332 if (j >= PCI_BUS_NUM_RESOURCES) { 333 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);
334 continue; 337 continue;
335 } 338 }
336 bus->resource[j++] = res; 339 bus->resource[j++] = res;
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index 9b3daf976732..6bf8091d2fd5 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -108,18 +108,19 @@ setup_resource(struct acpi_resource *acpi_res, void *data)
108 res->child = NULL; 108 res->child = NULL;
109 109
110 if (insert_resource(root, res)) { 110 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);
112 } else { 113 } else {
113 info->bus->resource[info->res_num] = res; 114 info->bus->resource[info->res_num] = res;
114 info->res_num++; 115 info->res_num++;
115 if (addr.translation_offset) 116 if (addr.translation_offset)
116 dev_info(&info->bridge->dev, "host bridge window: %pRt " 117 dev_info(&info->bridge->dev, "host bridge window %pR "
117 "(PCI address [%#llx-%#llx])\n", 118 "(PCI address [%#llx-%#llx])\n",
118 res, res->start - addr.translation_offset, 119 res, res->start - addr.translation_offset,
119 res->end - addr.translation_offset); 120 res->end - addr.translation_offset);
120 else 121 else
121 dev_info(&info->bridge->dev, 122 dev_info(&info->bridge->dev,
122 "host bridge window: %pRt\n", res); 123 "host bridge window %pR\n", res);
123 } 124 }
124 return AE_OK; 125 return AE_OK;
125} 126}
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
index 52e656f17781..d49d17de7b3f 100644
--- a/arch/x86/pci/i386.c
+++ b/arch/x86/pci/i386.c
@@ -129,7 +129,7 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list)
129 continue; 129 continue;
130 if (!r->start || 130 if (!r->start ||
131 pci_claim_resource(dev, idx) < 0) { 131 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);
133 /* 133 /*
134 * Something is wrong with the region. 134 * Something is wrong with the region.
135 * Invalidate the resource to prevent 135 * Invalidate the resource to prevent
@@ -164,10 +164,11 @@ static void __init pcibios_allocate_resources(int pass)
164 else 164 else
165 disabled = !(command & PCI_COMMAND_MEMORY); 165 disabled = !(command & PCI_COMMAND_MEMORY);
166 if (pass == disabled) { 166 if (pass == disabled) {
167 dev_dbg(&dev->dev, "%pRf (d=%d, p=%d)\n", r, 167 dev_dbg(&dev->dev,
168 disabled, pass); 168 "BAR %d: claiming %pr (d=%d, p=%d)\n",
169 idx, r, disabled, pass);
169 if (pci_claim_resource(dev, idx) < 0) { 170 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);
171 /* We'll assign a new address later */ 172 /* We'll assign a new address later */
172 r->end -= r->start; 173 r->end -= r->start;
173 r->start = 0; 174 r->start = 0;
@@ -180,7 +181,7 @@ static void __init pcibios_allocate_resources(int pass)
180 /* Turn the ROM off, leave the resource region, 181 /* Turn the ROM off, leave the resource region,
181 * but keep it unregistered. */ 182 * but keep it unregistered. */
182 u32 reg; 183 u32 reg;
183 dev_dbg(&dev->dev, "disabling ROM %pRt\n", r); 184 dev_dbg(&dev->dev, "disabling ROM %pR\n", r);
184 r->flags &= ~IORESOURCE_ROM_ENABLE; 185 r->flags &= ~IORESOURCE_ROM_ENABLE;
185 pci_read_config_dword(dev, 186 pci_read_config_dword(dev,
186 dev->rom_base_reg, &reg); 187 dev->rom_base_reg, &reg);
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 557218222826..f0da1676d2be 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -1713,7 +1713,7 @@ static int __pci_request_region(struct pci_dev *pdev, int bar, const char *res_n
1713 return 0; 1713 return 0;
1714 1714
1715err_out: 1715err_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,
1717 &pdev->resource[bar]); 1717 &pdev->resource[bar]);
1718 return -EBUSY; 1718 return -EBUSY;
1719} 1719}
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 4842b09b7f3c..4c4aca53ae09 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -225,12 +225,13 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
225 if (!sz64) 225 if (!sz64)
226 goto fail; 226 goto fail;
227 227
228 res->flags |= IORESOURCE_MEM_64;
229
230 if ((sizeof(resource_size_t) < 8) && (sz64 > 0x100000000ULL)) { 228 if ((sizeof(resource_size_t) < 8) && (sz64 > 0x100000000ULL)) {
231 dev_err(&dev->dev, "can't handle 64-bit BAR\n"); 229 dev_err(&dev->dev, "can't handle 64-bit BAR\n");
232 goto fail; 230 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) {
234 /* Address above 32-bit boundary; disable the BAR */ 235 /* Address above 32-bit boundary; disable the BAR */
235 pci_write_config_dword(dev, pos, 0); 236 pci_write_config_dword(dev, pos, 0);
236 pci_write_config_dword(dev, pos + 4, 0); 237 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,
239 } else { 240 } else {
240 res->start = l64; 241 res->start = l64;
241 res->end = l64 + sz64; 242 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",
243 pos, res); 244 pos, res);
244 } 245 }
245 } else { 246 } else {
@@ -251,7 +252,7 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
251 res->start = l; 252 res->start = l;
252 res->end = l + sz; 253 res->end = l + sz;
253 254
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);
255 } 256 }
256 257
257 out: 258 out:
@@ -319,7 +320,7 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child)
319 res->start = base; 320 res->start = base;
320 if (!res->end) 321 if (!res->end)
321 res->end = limit + 0xfff; 322 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);
323 } 324 }
324 325
325 res = child->resource[1]; 326 res = child->resource[1];
@@ -331,7 +332,7 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child)
331 res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM; 332 res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM;
332 res->start = base; 333 res->start = base;
333 res->end = limit + 0xfffff; 334 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);
335 } 336 }
336 337
337 res = child->resource[2]; 338 res = child->resource[2];
@@ -370,7 +371,7 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child)
370 res->flags |= IORESOURCE_MEM_64; 371 res->flags |= IORESOURCE_MEM_64;
371 res->start = base; 372 res->start = base;
372 res->end = limit + 0xfffff; 373 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);
374 } 375 }
375} 376}
376 377
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index c0c4537d66da..7cfa7c38d318 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -357,7 +357,7 @@ static void __devinit quirk_io_region(struct pci_dev *dev, unsigned region,
357 pcibios_bus_to_resource(dev, res, &bus_region); 357 pcibios_bus_to_resource(dev, res, &bus_region);
358 358
359 pci_claim_resource(dev, nr); 359 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);
361 } 361 }
362} 362}
363 363
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index ceb75333862b..ed6916bac675 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -71,53 +71,50 @@ static void pbus_assign_resources_sorted(const struct pci_bus *bus)
71void pci_setup_cardbus(struct pci_bus *bus) 71void pci_setup_cardbus(struct pci_bus *bus)
72{ 72{
73 struct pci_dev *bridge = bus->self; 73 struct pci_dev *bridge = bus->self;
74 struct resource *res;
74 struct pci_bus_region region; 75 struct pci_bus_region region;
75 76
76 dev_info(&bridge->dev, "CardBus bridge, secondary bus %04x:%02x\n", 77 dev_info(&bridge->dev, "CardBus bridge, secondary bus %04x:%02x\n",
77 pci_domain_nr(bus), bus->number); 78 pci_domain_nr(bus), bus->number);
78 79
79 pcibios_resource_to_bus(bridge, &region, bus->resource[0]); 80 res = bus->resource[0];
80 if (bus->resource[0]->flags & IORESOURCE_IO) { 81 pcibios_resource_to_bus(bridge, &region, res);
82 if (res->flags & IORESOURCE_IO) {
81 /* 83 /*
82 * The IO resource is allocated a range twice as large as it 84 * The IO resource is allocated a range twice as large as it
83 * would normally need. This allows us to set both IO regs. 85 * would normally need. This allows us to set both IO regs.
84 */ 86 */
85 dev_info(&bridge->dev, " IO window: %#08lx-%#08lx\n", 87 dev_info(&bridge->dev, " bridge window %pR\n", res);
86 (unsigned long)region.start,
87 (unsigned long)region.end);
88 pci_write_config_dword(bridge, PCI_CB_IO_BASE_0, 88 pci_write_config_dword(bridge, PCI_CB_IO_BASE_0,
89 region.start); 89 region.start);
90 pci_write_config_dword(bridge, PCI_CB_IO_LIMIT_0, 90 pci_write_config_dword(bridge, PCI_CB_IO_LIMIT_0,
91 region.end); 91 region.end);
92 } 92 }
93 93
94 pcibios_resource_to_bus(bridge, &region, bus->resource[1]); 94 res = bus->resource[1];
95 if (bus->resource[1]->flags & IORESOURCE_IO) { 95 pcibios_resource_to_bus(bridge, &region, res);
96 dev_info(&bridge->dev, " IO window: %#08lx-%#08lx\n", 96 if (res->flags & IORESOURCE_IO) {
97 (unsigned long)region.start, 97 dev_info(&bridge->dev, " bridge window %pR\n", res);
98 (unsigned long)region.end);
99 pci_write_config_dword(bridge, PCI_CB_IO_BASE_1, 98 pci_write_config_dword(bridge, PCI_CB_IO_BASE_1,
100 region.start); 99 region.start);
101 pci_write_config_dword(bridge, PCI_CB_IO_LIMIT_1, 100 pci_write_config_dword(bridge, PCI_CB_IO_LIMIT_1,
102 region.end); 101 region.end);
103 } 102 }
104 103
105 pcibios_resource_to_bus(bridge, &region, bus->resource[2]); 104 res = bus->resource[2];
106 if (bus->resource[2]->flags & IORESOURCE_MEM) { 105 pcibios_resource_to_bus(bridge, &region, res);
107 dev_info(&bridge->dev, " PREFETCH window: %#08lx-%#08lx\n", 106 if (res->flags & IORESOURCE_MEM) {
108 (unsigned long)region.start, 107 dev_info(&bridge->dev, " bridge window %pR\n", res);
109 (unsigned long)region.end);
110 pci_write_config_dword(bridge, PCI_CB_MEMORY_BASE_0, 108 pci_write_config_dword(bridge, PCI_CB_MEMORY_BASE_0,
111 region.start); 109 region.start);
112 pci_write_config_dword(bridge, PCI_CB_MEMORY_LIMIT_0, 110 pci_write_config_dword(bridge, PCI_CB_MEMORY_LIMIT_0,
113 region.end); 111 region.end);
114 } 112 }
115 113
116 pcibios_resource_to_bus(bridge, &region, bus->resource[3]); 114 res = bus->resource[3];
117 if (bus->resource[3]->flags & IORESOURCE_MEM) { 115 pcibios_resource_to_bus(bridge, &region, res);
118 dev_info(&bridge->dev, " MEM window: %#08lx-%#08lx\n", 116 if (res->flags & IORESOURCE_MEM) {
119 (unsigned long)region.start, 117 dev_info(&bridge->dev, " bridge window %pR\n", res);
120 (unsigned long)region.end);
121 pci_write_config_dword(bridge, PCI_CB_MEMORY_BASE_1, 118 pci_write_config_dword(bridge, PCI_CB_MEMORY_BASE_1,
122 region.start); 119 region.start);
123 pci_write_config_dword(bridge, PCI_CB_MEMORY_LIMIT_1, 120 pci_write_config_dword(bridge, PCI_CB_MEMORY_LIMIT_1,
@@ -140,6 +137,7 @@ EXPORT_SYMBOL(pci_setup_cardbus);
140static void pci_setup_bridge(struct pci_bus *bus) 137static void pci_setup_bridge(struct pci_bus *bus)
141{ 138{
142 struct pci_dev *bridge = bus->self; 139 struct pci_dev *bridge = bus->self;
140 struct resource *res;
143 struct pci_bus_region region; 141 struct pci_bus_region region;
144 u32 l, bu, lu, io_upper16; 142 u32 l, bu, lu, io_upper16;
145 int pref_mem64; 143 int pref_mem64;
@@ -151,23 +149,22 @@ static void pci_setup_bridge(struct pci_bus *bus)
151 pci_domain_nr(bus), bus->number); 149 pci_domain_nr(bus), bus->number);
152 150
153 /* Set up the top and bottom of the PCI I/O segment for this bus. */ 151 /* 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]); 152 res = bus->resource[0];
155 if (bus->resource[0]->flags & IORESOURCE_IO) { 153 pcibios_resource_to_bus(bridge, &region, res);
154 if (res->flags & IORESOURCE_IO) {
156 pci_read_config_dword(bridge, PCI_IO_BASE, &l); 155 pci_read_config_dword(bridge, PCI_IO_BASE, &l);
157 l &= 0xffff0000; 156 l &= 0xffff0000;
158 l |= (region.start >> 8) & 0x00f0; 157 l |= (region.start >> 8) & 0x00f0;
159 l |= region.end & 0xf000; 158 l |= region.end & 0xf000;
160 /* Set up upper 16 bits of I/O base/limit. */ 159 /* Set up upper 16 bits of I/O base/limit. */
161 io_upper16 = (region.end & 0xffff0000) | (region.start >> 16); 160 io_upper16 = (region.end & 0xffff0000) | (region.start >> 16);
162 dev_info(&bridge->dev, " IO window: %#04lx-%#04lx\n", 161 dev_info(&bridge->dev, " bridge window %pR\n", res);
163 (unsigned long)region.start,
164 (unsigned long)region.end);
165 } 162 }
166 else { 163 else {
167 /* Clear upper 16 bits of I/O base/limit. */ 164 /* Clear upper 16 bits of I/O base/limit. */
168 io_upper16 = 0; 165 io_upper16 = 0;
169 l = 0x00f0; 166 l = 0x00f0;
170 dev_info(&bridge->dev, " IO window: disabled\n"); 167 dev_info(&bridge->dev, " bridge window [io disabled]\n");
171 } 168 }
172 /* Temporarily disable the I/O range before updating PCI_IO_BASE. */ 169 /* Temporarily disable the I/O range before updating PCI_IO_BASE. */
173 pci_write_config_dword(bridge, PCI_IO_BASE_UPPER16, 0x0000ffff); 170 pci_write_config_dword(bridge, PCI_IO_BASE_UPPER16, 0x0000ffff);
@@ -178,17 +175,16 @@ static void pci_setup_bridge(struct pci_bus *bus)
178 175
179 /* Set up the top and bottom of the PCI Memory segment 176 /* Set up the top and bottom of the PCI Memory segment
180 for this bus. */ 177 for this bus. */
181 pcibios_resource_to_bus(bridge, &region, bus->resource[1]); 178 res = bus->resource[1];
182 if (bus->resource[1]->flags & IORESOURCE_MEM) { 179 pcibios_resource_to_bus(bridge, &region, res);
180 if (res->flags & IORESOURCE_MEM) {
183 l = (region.start >> 16) & 0xfff0; 181 l = (region.start >> 16) & 0xfff0;
184 l |= region.end & 0xfff00000; 182 l |= region.end & 0xfff00000;
185 dev_info(&bridge->dev, " MEM window: %#08lx-%#08lx\n", 183 dev_info(&bridge->dev, " bridge window %pR\n", res);
186 (unsigned long)region.start,
187 (unsigned long)region.end);
188 } 184 }
189 else { 185 else {
190 l = 0x0000fff0; 186 l = 0x0000fff0;
191 dev_info(&bridge->dev, " MEM window: disabled\n"); 187 dev_info(&bridge->dev, " bridge window [mem disabled]\n");
192 } 188 }
193 pci_write_config_dword(bridge, PCI_MEMORY_BASE, l); 189 pci_write_config_dword(bridge, PCI_MEMORY_BASE, l);
194 190
@@ -200,24 +196,21 @@ static void pci_setup_bridge(struct pci_bus *bus)
200 /* Set up PREF base/limit. */ 196 /* Set up PREF base/limit. */
201 pref_mem64 = 0; 197 pref_mem64 = 0;
202 bu = lu = 0; 198 bu = lu = 0;
203 pcibios_resource_to_bus(bridge, &region, bus->resource[2]); 199 res = bus->resource[2];
204 if (bus->resource[2]->flags & IORESOURCE_PREFETCH) { 200 pcibios_resource_to_bus(bridge, &region, res);
205 int width = 8; 201 if (res->flags & IORESOURCE_PREFETCH) {
206 l = (region.start >> 16) & 0xfff0; 202 l = (region.start >> 16) & 0xfff0;
207 l |= region.end & 0xfff00000; 203 l |= region.end & 0xfff00000;
208 if (bus->resource[2]->flags & IORESOURCE_MEM_64) { 204 if (res->flags & IORESOURCE_MEM_64) {
209 pref_mem64 = 1; 205 pref_mem64 = 1;
210 bu = upper_32_bits(region.start); 206 bu = upper_32_bits(region.start);
211 lu = upper_32_bits(region.end); 207 lu = upper_32_bits(region.end);
212 width = 16;
213 } 208 }
214 dev_info(&bridge->dev, " PREFETCH window: %#0*llx-%#0*llx\n", 209 dev_info(&bridge->dev, " bridge window %pR\n", res);
215 width, (unsigned long long)region.start,
216 width, (unsigned long long)region.end);
217 } 210 }
218 else { 211 else {
219 l = 0x0000fff0; 212 l = 0x0000fff0;
220 dev_info(&bridge->dev, " PREFETCH window: disabled\n"); 213 dev_info(&bridge->dev, " bridge window [mem pref disabled]\n");
221 } 214 }
222 pci_write_config_dword(bridge, PCI_PREF_MEMORY_BASE, l); 215 pci_write_config_dword(bridge, PCI_PREF_MEMORY_BASE, l);
223 216
@@ -391,7 +384,7 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,
391 order = __ffs(align) - 20; 384 order = __ffs(align) - 20;
392 if (order > 11) { 385 if (order > 11) {
393 dev_warn(&dev->dev, "BAR %d: bad alignment %llx: " 386 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);
395 r->flags = 0; 388 r->flags = 0;
396 continue; 389 continue;
397 } 390 }
@@ -582,7 +575,7 @@ static void pci_bus_dump_res(struct pci_bus *bus)
582 if (!res || !res->end) 575 if (!res || !res->end)
583 continue; 576 continue;
584 577
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);
586 } 579 }
587} 580}
588 581
diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c
index 5e78f2096ce8..357ca5c54607 100644
--- a/drivers/pci/setup-res.c
+++ b/drivers/pci/setup-res.c
@@ -51,9 +51,11 @@ void pci_update_resource(struct pci_dev *dev, int resno)
51 51
52 pcibios_resource_to_bus(dev, &region, res); 52 pcibios_resource_to_bus(dev, &region, res);
53 53
54 dev_dbg(&dev->dev, "BAR %d: got %pRf (bus addr [%#llx-%#llx])\n", 54 dev_dbg(&dev->dev, "BAR %d: got res %pR bus [%#llx-%#llx] "
55 resno, res, (unsigned long long)region.start, 55 "flags %#lx\n", resno, res,
56 (unsigned long long)region.end); 56 (unsigned long long)region.start,
57 (unsigned long long)region.end,
58 (unsigned long)res->flags);
57 59
58 new = region.start | (res->flags & PCI_REGION_FLAG_MASK); 60 new = region.start | (res->flags & PCI_REGION_FLAG_MASK);
59 if (res->flags & IORESOURCE_IO) 61 if (res->flags & IORESOURCE_IO)
@@ -89,8 +91,8 @@ void pci_update_resource(struct pci_dev *dev, int resno)
89 } 91 }
90 } 92 }
91 res->flags &= ~IORESOURCE_UNSET; 93 res->flags &= ~IORESOURCE_UNSET;
92 dev_dbg(&dev->dev, "BAR %d: moved to bus addr [%#llx-%#llx]\n", 94 dev_dbg(&dev->dev, "BAR %d: moved to %pR (bus addr [%#llx-%#llx])\n",
93 resno, (unsigned long long)region.start, 95 resno, res, (unsigned long long)region.start,
94 (unsigned long long)region.end); 96 (unsigned long long)region.end);
95} 97}
96 98
@@ -108,7 +110,7 @@ int pci_claim_resource(struct pci_dev *dev, int resource)
108 110
109 if (err) { 111 if (err) {
110 const char *dtype = resource < PCI_BRIDGE_RESOURCES ? "device" : "bridge"; 112 const char *dtype = resource < PCI_BRIDGE_RESOURCES ? "device" : "bridge";
111 dev_err(&dev->dev, "BAR %d: %s %s %pRt\n", 113 dev_err(&dev->dev, "BAR %d: %s of %s %pR\n",
112 resource, 114 resource,
113 root ? "address space collision on" : 115 root ? "address space collision on" :
114 "no parent found for", 116 "no parent found for",
@@ -179,7 +181,7 @@ int pci_assign_resource(struct pci_dev *dev, int resno)
179 181
180 align = pci_resource_alignment(dev, res); 182 align = pci_resource_alignment(dev, res);
181 if (!align) { 183 if (!align) {
182 dev_info(&dev->dev, "BAR %d: can't allocate %pRf " 184 dev_info(&dev->dev, "BAR %d: can't allocate %pR "
183 "(bogus alignment)\n", resno, res); 185 "(bogus alignment)\n", resno, res);
184 return -EINVAL; 186 return -EINVAL;
185 } 187 }
@@ -196,7 +198,7 @@ int pci_assign_resource(struct pci_dev *dev, int resno)
196 } 198 }
197 199
198 if (ret) 200 if (ret)
199 dev_info(&dev->dev, "BAR %d: can't allocate %pRt\n", 201 dev_info(&dev->dev, "BAR %d: can't allocate %pR\n",
200 resno, res); 202 resno, res);
201 203
202 return ret; 204 return ret;
@@ -222,7 +224,7 @@ void pdev_sort_resources(struct pci_dev *dev, struct resource_list *head)
222 224
223 r_align = pci_resource_alignment(dev, r); 225 r_align = pci_resource_alignment(dev, r);
224 if (!r_align) { 226 if (!r_align) {
225 dev_warn(&dev->dev, "BAR %d: bogus alignment %pRf\n", 227 dev_warn(&dev->dev, "BAR %d: %pR has bogus alignment\n",
226 i, r); 228 i, r);
227 continue; 229 continue;
228 } 230 }
diff --git a/drivers/pnp/quirks.c b/drivers/pnp/quirks.c
index 3a2031b25c3c..dfbd5a6cc58b 100644
--- a/drivers/pnp/quirks.c
+++ b/drivers/pnp/quirks.c
@@ -285,8 +285,9 @@ static void quirk_system_pci_resources(struct pnp_dev *dev)
285 * the PCI region, and that might prevent a PCI 285 * the PCI region, and that might prevent a PCI
286 * driver from requesting its resources. 286 * driver from requesting its resources.
287 */ 287 */
288 dev_warn(&dev->dev, "resource %pRt overlaps %s " 288 dev_warn(&dev->dev,
289 "BAR %d %pRt, disabling\n", res, 289 "disabling %pR because it overlaps "
290 "%s BAR %d %pR\n", res,
290 pci_name(pdev), i, &pdev->resource[i]); 291 pci_name(pdev), i, &pdev->resource[i]);
291 res->flags |= IORESOURCE_DISABLED; 292 res->flags |= IORESOURCE_DISABLED;
292 } 293 }
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c
index 18557d7bb0b9..64d0596bafb5 100644
--- a/drivers/pnp/resource.c
+++ b/drivers/pnp/resource.c
@@ -517,7 +517,7 @@ struct pnp_resource *pnp_add_irq_resource(struct pnp_dev *dev, int irq,
517 res->start = irq; 517 res->start = irq;
518 res->end = irq; 518 res->end = irq;
519 519
520 pnp_dbg(&dev->dev, " add %pRf\n", res); 520 pnp_dbg(&dev->dev, " add %pr\n", res);
521 return pnp_res; 521 return pnp_res;
522} 522}
523 523
@@ -538,7 +538,7 @@ struct pnp_resource *pnp_add_dma_resource(struct pnp_dev *dev, int dma,
538 res->start = dma; 538 res->start = dma;
539 res->end = dma; 539 res->end = dma;
540 540
541 pnp_dbg(&dev->dev, " add %pRf\n", res); 541 pnp_dbg(&dev->dev, " add %pr\n", res);
542 return pnp_res; 542 return pnp_res;
543} 543}
544 544
@@ -562,7 +562,7 @@ struct pnp_resource *pnp_add_io_resource(struct pnp_dev *dev,
562 res->start = start; 562 res->start = start;
563 res->end = end; 563 res->end = end;
564 564
565 pnp_dbg(&dev->dev, " add %pRf\n", res); 565 pnp_dbg(&dev->dev, " add %pr\n", res);
566 return pnp_res; 566 return pnp_res;
567} 567}
568 568
@@ -586,7 +586,7 @@ struct pnp_resource *pnp_add_mem_resource(struct pnp_dev *dev,
586 res->start = start; 586 res->start = start;
587 res->end = end; 587 res->end = end;
588 588
589 pnp_dbg(&dev->dev, " add %pRf\n", res); 589 pnp_dbg(&dev->dev, " add %pr\n", res);
590 return pnp_res; 590 return pnp_res;
591} 591}
592 592
diff --git a/drivers/pnp/support.c b/drivers/pnp/support.c
index 1f8a33b0abac..9585c1c1cc36 100644
--- a/drivers/pnp/support.c
+++ b/drivers/pnp/support.c
@@ -82,7 +82,7 @@ void dbg_pnp_show_resources(struct pnp_dev *dev, char *desc)
82 else { 82 else {
83 pnp_dbg(&dev->dev, "%s: current resources:\n", desc); 83 pnp_dbg(&dev->dev, "%s: current resources:\n", desc);
84 list_for_each_entry(pnp_res, &dev->resources, list) 84 list_for_each_entry(pnp_res, &dev->resources, list)
85 pnp_dbg(&dev->dev, "%pRf\n", &pnp_res->res); 85 pnp_dbg(&dev->dev, "%pr\n", &pnp_res->res);
86 } 86 }
87} 87}
88 88
diff --git a/drivers/pnp/system.c b/drivers/pnp/system.c
index 242d3a872011..49c1720df59a 100644
--- a/drivers/pnp/system.c
+++ b/drivers/pnp/system.c
@@ -48,7 +48,7 @@ static void reserve_range(struct pnp_dev *dev, struct resource *r, int port)
48 * example do reserve stuff they know about too, so we may well 48 * example do reserve stuff they know about too, so we may well
49 * have double reservations. 49 * have double reservations.
50 */ 50 */
51 dev_info(&dev->dev, "%pRt %s reserved\n", r, 51 dev_info(&dev->dev, "%pR %s reserved\n", r,
52 res ? "has been" : "could not be"); 52 res ? "has been" : "could not be");
53} 53}
54 54
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index a6e195163eb3..6438cd5599ee 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -624,13 +624,19 @@ static char *resource_string(char *buf, char *end, struct resource *res,
624 .precision = -1, 624 .precision = -1,
625 .flags = SPECIAL | SMALL, 625 .flags = SPECIAL | SMALL,
626 }; 626 };
627 /* 627
628 * room for three actual numbers (decimal or hex), plus 628 /* 32-bit res (sizeof==4): 10 chars in dec, 10 in hex ("0x" + 8)
629 * "[mem 0x-0x 64bit pref disabled flags 0x]\0" 629 * 64-bit res (sizeof==8): 20 chars in dec, 18 in hex ("0x" + 16) */
630 */ 630#define RSRC_BUF_SIZE ((2 * sizeof(resource_size_t)) + 4)
631 char sym[3*3*sizeof(resource_size_t) + 41]; 631#define FLAG_BUF_SIZE (2 * sizeof(res->flags))
632#define DECODED_BUF_SIZE sizeof("[mem - 64bit pref disabled]")
633#define RAW_BUF_SIZE sizeof("[mem - flags 0x]")
634 char sym[max(2*RSRC_BUF_SIZE + DECODED_BUF_SIZE,
635 2*RSRC_BUF_SIZE + FLAG_BUF_SIZE + RAW_BUF_SIZE)];
636
632 char *p = sym, *pend = sym + sizeof(sym); 637 char *p = sym, *pend = sym + sizeof(sym);
633 int size = -1, addr = 0; 638 int size = -1, addr = 0;
639 int decode = (fmt[0] == 'R') ? 1 : 0;
634 640
635 if (res->flags & IORESOURCE_IO) { 641 if (res->flags & IORESOURCE_IO) {
636 size = IO_RSRC_PRINTK_SIZE; 642 size = IO_RSRC_PRINTK_SIZE;
@@ -641,15 +647,17 @@ static char *resource_string(char *buf, char *end, struct resource *res,
641 } 647 }
642 648
643 *p++ = '['; 649 *p++ = '[';
644 if (fmt[1] == 't' || fmt[1] == 'f') { 650 if (res->flags & IORESOURCE_IO)
645 if (res->flags & IORESOURCE_IO) 651 p = string(p, pend, "io ", str_spec);
646 p = string(p, pend, "io ", str_spec); 652 else if (res->flags & IORESOURCE_MEM)
647 else if (res->flags & IORESOURCE_MEM) 653 p = string(p, pend, "mem ", str_spec);
648 p = string(p, pend, "mem ", str_spec); 654 else if (res->flags & IORESOURCE_IRQ)
649 else if (res->flags & IORESOURCE_IRQ) 655 p = string(p, pend, "irq ", str_spec);
650 p = string(p, pend, "irq ", str_spec); 656 else if (res->flags & IORESOURCE_DMA)
651 else if (res->flags & IORESOURCE_DMA) 657 p = string(p, pend, "dma ", str_spec);
652 p = string(p, pend, "dma ", str_spec); 658 else {
659 p = string(p, pend, "??? ", str_spec);
660 decode = 0;
653 } 661 }
654 hex_spec.field_width = size; 662 hex_spec.field_width = size;
655 p = number(p, pend, res->start, addr ? hex_spec : dec_spec); 663 p = number(p, pend, res->start, addr ? hex_spec : dec_spec);
@@ -657,21 +665,19 @@ static char *resource_string(char *buf, char *end, struct resource *res,
657 *p++ = '-'; 665 *p++ = '-';
658 p = number(p, pend, res->end, addr ? hex_spec : dec_spec); 666 p = number(p, pend, res->end, addr ? hex_spec : dec_spec);
659 } 667 }
660 if (fmt[1] == 't' || fmt[1] == 'f') { 668 if (decode) {
661 if (res->flags & IORESOURCE_MEM_64) 669 if (res->flags & IORESOURCE_MEM_64)
662 p = string(p, pend, " 64bit", str_spec); 670 p = string(p, pend, " 64bit", str_spec);
663 if (res->flags & IORESOURCE_PREFETCH) 671 if (res->flags & IORESOURCE_PREFETCH)
664 p = string(p, pend, " pref", str_spec); 672 p = string(p, pend, " pref", str_spec);
665 if (res->flags & IORESOURCE_DISABLED) 673 if (res->flags & IORESOURCE_DISABLED)
666 p = string(p, pend, " disabled", str_spec); 674 p = string(p, pend, " disabled", str_spec);
667 if (fmt[1] == 'f') { 675 } else {
668 p = string(p, pend, " flags ", str_spec); 676 p = string(p, pend, " flags ", str_spec);
669 p = number(p, pend, res->flags & ~IORESOURCE_TYPE_BITS, 677 p = number(p, pend, res->flags, flag_spec);
670 flag_spec);
671 }
672 } 678 }
673 *p++ = ']'; 679 *p++ = ']';
674 *p = 0; 680 *p = '\0';
675 681
676 return string(buf, end, sym, spec); 682 return string(buf, end, sym, spec);
677} 683}
@@ -847,10 +853,8 @@ static char *ip4_addr_string(char *buf, char *end, const u8 *addr,
847 * - 'f' For simple symbolic function names without offset 853 * - 'f' For simple symbolic function names without offset
848 * - 'S' For symbolic direct pointers with offset 854 * - 'S' For symbolic direct pointers with offset
849 * - 's' For symbolic direct pointers without offset 855 * - 's' For symbolic direct pointers without offset
850 * - 'R' For a struct resource pointer, print: 856 * - 'R' For decoded struct resource, e.g., [mem 0x0-0x1f 64bit pref]
851 * R address range only ([0x0-0x1f]) 857 * - 'r' For raw struct resource, e.g., [mem 0x0-0x1f flags 0x201]
852 * Rt type and range ([mem 0x0-0x1f 64bit pref])
853 * Rf type, range, and flags ([mem 0x0-0x1f 64bit pref flags 0x1])
854 * - 'M' For a 6-byte MAC address, it prints the address in the 858 * - 'M' For a 6-byte MAC address, it prints the address in the
855 * usual colon-separated hex notation 859 * usual colon-separated hex notation
856 * - 'm' For a 6-byte MAC address, it prints the hex address without colons 860 * - 'm' For a 6-byte MAC address, it prints the hex address without colons
@@ -881,6 +885,7 @@ static char *pointer(const char *fmt, char *buf, char *end, void *ptr,
881 case 'S': 885 case 'S':
882 return symbol_string(buf, end, ptr, spec, *fmt); 886 return symbol_string(buf, end, ptr, spec, *fmt);
883 case 'R': 887 case 'R':
888 case 'r':
884 return resource_string(buf, end, ptr, spec, fmt); 889 return resource_string(buf, end, ptr, spec, fmt);
885 case 'M': /* Colon separated: 00:01:02:03:04:05 */ 890 case 'M': /* Colon separated: 00:01:02:03:04:05 */
886 case 'm': /* Contiguous: 000102030405 */ 891 case 'm': /* Contiguous: 000102030405 */