Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

PCI: Use resource names in PCI log messages

Use the pci_resource_name() to get the name of the resource and use it
while printing log messages.

[bhelgaas: rename to match struct resource * names, also use names in other
BAR messages]
Link: https://lore.kernel.org/r/20211106112606.192563-3-puranjay12@gmail.com
Signed-off-by: Puranjay Mohan <puranjay12@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

authored by

Puranjay Mohan and committed by
Bjorn Helgaas
dc4e6f21 65f8e0be

+103 -72
+5 -2
drivers/pci/iov.c
··· 745 745 u16 ctrl, total; 746 746 struct pci_sriov *iov; 747 747 struct resource *res; 748 + const char *res_name; 748 749 struct pci_dev *pdev; 749 750 750 751 pci_read_config_word(dev, pos + PCI_SRIOV_CTRL, &ctrl); ··· 786 785 nres = 0; 787 786 for (i = 0; i < PCI_SRIOV_NUM_BARS; i++) { 788 787 res = &dev->resource[i + PCI_IOV_RESOURCES]; 788 + res_name = pci_resource_name(dev, i + PCI_IOV_RESOURCES); 789 + 789 790 /* 790 791 * If it is already FIXED, don't change it, something 791 792 * (perhaps EA or header fixups) wants it this way. ··· 805 802 } 806 803 iov->barsz[i] = resource_size(res); 807 804 res->end = res->start + resource_size(res) * total - 1; 808 - pci_info(dev, "VF(n) BAR%d space: %pR (contains BAR%d for %d VFs)\n", 809 - i, res, i, total); 805 + pci_info(dev, "%s %pR: contains BAR %d for %d VFs\n", 806 + res_name, res, i, total); 810 807 i += bar64; 811 808 nres++; 812 809 }
+14 -11
drivers/pci/pci.c
··· 3350 3350 static int pci_ea_read(struct pci_dev *dev, int offset) 3351 3351 { 3352 3352 struct resource *res; 3353 + const char *res_name; 3353 3354 int ent_size, ent_offset = offset; 3354 3355 resource_size_t start, end; 3355 3356 unsigned long flags; ··· 3380 3379 goto out; 3381 3380 3382 3381 res = pci_ea_get_resource(dev, bei, prop); 3382 + res_name = pci_resource_name(dev, bei); 3383 3383 if (!res) { 3384 3384 pci_err(dev, "Unsupported EA entry BEI: %u\n", bei); 3385 3385 goto out; ··· 3454 3452 res->flags = flags; 3455 3453 3456 3454 if (bei <= PCI_EA_BEI_BAR5) 3457 - pci_info(dev, "BAR %d: %pR (from Enhanced Allocation, properties %#02x)\n", 3458 - bei, res, prop); 3455 + pci_info(dev, "%s %pR: from Enhanced Allocation, properties %#02x\n", 3456 + res_name, res, prop); 3459 3457 else if (bei == PCI_EA_BEI_ROM) 3460 - pci_info(dev, "ROM: %pR (from Enhanced Allocation, properties %#02x)\n", 3461 - res, prop); 3458 + pci_info(dev, "%s %pR: from Enhanced Allocation, properties %#02x\n", 3459 + res_name, res, prop); 3462 3460 else if (bei >= PCI_EA_BEI_VF_BAR0 && bei <= PCI_EA_BEI_VF_BAR5) 3463 - pci_info(dev, "VF BAR %d: %pR (from Enhanced Allocation, properties %#02x)\n", 3464 - bei - PCI_EA_BEI_VF_BAR0, res, prop); 3461 + pci_info(dev, "%s %pR: from Enhanced Allocation, properties %#02x\n", 3462 + res_name, res, prop); 3465 3463 else 3466 - pci_info(dev, "BEI %d res: %pR (from Enhanced Allocation, properties %#02x)\n", 3464 + pci_info(dev, "BEI %d %pR: from Enhanced Allocation, properties %#02x\n", 3467 3465 bei, res, prop); 3468 3466 3469 3467 out: ··· 6751 6749 resource_size_t align, bool resize) 6752 6750 { 6753 6751 struct resource *r = &dev->resource[bar]; 6752 + const char *r_name = pci_resource_name(dev, bar); 6754 6753 resource_size_t size; 6755 6754 6756 6755 if (!(r->flags & IORESOURCE_MEM)) 6757 6756 return; 6758 6757 6759 6758 if (r->flags & IORESOURCE_PCI_FIXED) { 6760 - pci_info(dev, "BAR%d %pR: ignoring requested alignment %#llx\n", 6761 - bar, r, (unsigned long long)align); 6759 + pci_info(dev, "%s %pR: ignoring requested alignment %#llx\n", 6760 + r_name, r, (unsigned long long)align); 6762 6761 return; 6763 6762 } 6764 6763 ··· 6795 6792 * devices and we use the second. 6796 6793 */ 6797 6794 6798 - pci_info(dev, "BAR%d %pR: requesting alignment to %#llx\n", 6799 - bar, r, (unsigned long long)align); 6795 + pci_info(dev, "%s %pR: requesting alignment to %#llx\n", 6796 + r_name, r, (unsigned long long)align); 6800 6797 6801 6798 if (resize) { 6802 6799 r->start = 0;
+13 -13
drivers/pci/probe.c
··· 180 180 u64 l64, sz64, mask64; 181 181 u16 orig_cmd; 182 182 struct pci_bus_region region, inverted_region; 183 + const char *res_name = pci_resource_name(dev, res - dev->resource); 183 184 184 185 mask = type ? PCI_ROM_ADDRESS_MASK : ~0; 185 186 ··· 255 254 256 255 sz64 = pci_size(l64, sz64, mask64); 257 256 if (!sz64) { 258 - pci_info(dev, FW_BUG "reg 0x%x: invalid BAR (can't size)\n", 259 - pos); 257 + pci_info(dev, FW_BUG "%s: invalid; can't size\n", res_name); 260 258 goto fail; 261 259 } 262 260 ··· 265 265 res->flags |= IORESOURCE_UNSET | IORESOURCE_DISABLED; 266 266 res->start = 0; 267 267 res->end = 0; 268 - pci_err(dev, "reg 0x%x: can't handle BAR larger than 4GB (size %#010llx)\n", 269 - pos, (unsigned long long)sz64); 268 + pci_err(dev, "%s: can't handle BAR larger than 4GB (size %#010llx)\n", 269 + res_name, (unsigned long long)sz64); 270 270 goto out; 271 271 } 272 272 ··· 275 275 res->flags |= IORESOURCE_UNSET; 276 276 res->start = 0; 277 277 res->end = sz64 - 1; 278 - pci_info(dev, "reg 0x%x: can't handle BAR above 4GB (bus address %#010llx)\n", 279 - pos, (unsigned long long)l64); 278 + pci_info(dev, "%s: can't handle BAR above 4GB (bus address %#010llx)\n", 279 + res_name, (unsigned long long)l64); 280 280 goto out; 281 281 } 282 282 } ··· 302 302 res->flags |= IORESOURCE_UNSET; 303 303 res->start = 0; 304 304 res->end = region.end - region.start; 305 - pci_info(dev, "reg 0x%x: initial BAR value %#010llx invalid\n", 306 - pos, (unsigned long long)region.start); 305 + pci_info(dev, "%s: initial BAR value %#010llx invalid\n", 306 + res_name, (unsigned long long)region.start); 307 307 } 308 308 309 309 goto out; ··· 313 313 res->flags = 0; 314 314 out: 315 315 if (res->flags) 316 - pci_info(dev, "reg 0x%x: %pR\n", pos, res); 316 + pci_info(dev, "%s %pR\n", res_name, res); 317 317 318 318 return (res->flags & IORESOURCE_MEM_64) ? 1 : 0; 319 319 } ··· 1967 1967 res = &dev->resource[0]; 1968 1968 res->flags = LEGACY_IO_RESOURCE; 1969 1969 pcibios_bus_to_resource(dev->bus, res, &region); 1970 - pci_info(dev, "legacy IDE quirk: reg 0x10: %pR\n", 1970 + pci_info(dev, "BAR 0 %pR: legacy IDE quirk\n", 1971 1971 res); 1972 1972 region.start = 0x3F6; 1973 1973 region.end = 0x3F6; 1974 1974 res = &dev->resource[1]; 1975 1975 res->flags = LEGACY_IO_RESOURCE; 1976 1976 pcibios_bus_to_resource(dev->bus, res, &region); 1977 - pci_info(dev, "legacy IDE quirk: reg 0x14: %pR\n", 1977 + pci_info(dev, "BAR 1 %pR: legacy IDE quirk\n", 1978 1978 res); 1979 1979 } 1980 1980 if ((progif & 4) == 0) { ··· 1983 1983 res = &dev->resource[2]; 1984 1984 res->flags = LEGACY_IO_RESOURCE; 1985 1985 pcibios_bus_to_resource(dev->bus, res, &region); 1986 - pci_info(dev, "legacy IDE quirk: reg 0x18: %pR\n", 1986 + pci_info(dev, "BAR 2 %pR: legacy IDE quirk\n", 1987 1987 res); 1988 1988 region.start = 0x376; 1989 1989 region.end = 0x376; 1990 1990 res = &dev->resource[3]; 1991 1991 res->flags = LEGACY_IO_RESOURCE; 1992 1992 pcibios_bus_to_resource(dev->bus, res, &region); 1993 - pci_info(dev, "legacy IDE quirk: reg 0x1c: %pR\n", 1993 + pci_info(dev, "BAR 3 %pR: legacy IDE quirk\n", 1994 1994 res); 1995 1995 } 1996 1996 }
+11 -4
drivers/pci/quirks.c
··· 570 570 571 571 for (i = 0; i < PCI_STD_NUM_BARS; i++) { 572 572 struct resource *r = &dev->resource[i]; 573 + const char *r_name = pci_resource_name(dev, i); 573 574 574 575 if (r->flags & IORESOURCE_MEM && resource_size(r) < PAGE_SIZE) { 575 576 r->end = PAGE_SIZE - 1; 576 577 r->start = 0; 577 578 r->flags |= IORESOURCE_UNSET; 578 - pci_info(dev, "expanded BAR %d to page size: %pR\n", 579 - i, r); 579 + pci_info(dev, "%s %pR: expanded to page size\n", 580 + r_name, r); 580 581 } 581 582 } 582 583 } ··· 606 605 u32 region; 607 606 struct pci_bus_region bus_region; 608 607 struct resource *res = dev->resource + pos; 608 + const char *res_name = pci_resource_name(dev, pos); 609 609 610 610 pci_read_config_dword(dev, PCI_BASE_ADDRESS_0 + (pos << 2), &region); 611 611 ··· 624 622 bus_region.end = region + size - 1; 625 623 pcibios_bus_to_resource(dev->bus, res, &bus_region); 626 624 627 - pci_info(dev, FW_BUG "%s quirk: reg 0x%x: %pR\n", 628 - name, PCI_BASE_ADDRESS_0 + (pos << 2), res); 625 + pci_info(dev, FW_BUG "%s %pR: %s quirk\n", res_name, res, name); 629 626 } 630 627 631 628 /* ··· 671 670 bus_region.end = region + size - 1; 672 671 pcibios_bus_to_resource(dev->bus, res, &bus_region); 673 672 673 + /* 674 + * "res" is typically a bridge window resource that's not being 675 + * used for a bridge window, so it's just a place to stash this 676 + * non-standard resource. Printing "nr" or pci_resource_name() of 677 + * it doesn't really make sense. 678 + */ 674 679 if (!pci_claim_resource(dev, nr)) 675 680 pci_info(dev, "quirk: %pR claimed by %s\n", res, name); 676 681 }
+20 -10
drivers/pci/setup-bus.c
··· 213 213 struct list_head *head) 214 214 { 215 215 struct resource *res; 216 + const char *res_name; 216 217 struct pci_dev_resource *add_res, *tmp; 217 218 struct pci_dev_resource *dev_res; 218 219 resource_size_t add_size, align; ··· 223 222 bool found_match = false; 224 223 225 224 res = add_res->res; 225 + 226 226 /* Skip resource that has been reset */ 227 227 if (!res->flags) 228 228 goto out; ··· 239 237 continue; 240 238 241 239 idx = res - &add_res->dev->resource[0]; 240 + res_name = pci_resource_name(add_res->dev, idx); 242 241 add_size = add_res->add_size; 243 242 align = add_res->min_align; 244 243 if (!resource_size(res)) { ··· 252 249 (IORESOURCE_STARTALIGN|IORESOURCE_SIZEALIGN); 253 250 if (pci_reassign_resource(add_res->dev, idx, 254 251 add_size, align)) 255 - pci_info(add_res->dev, "failed to add %llx res[%d]=%pR\n", 256 - (unsigned long long) add_size, idx, 257 - res); 252 + pci_info(add_res->dev, "%s %pR: failed to add %llx\n", 253 + res_name, res, 254 + (unsigned long long) add_size); 258 255 } 259 256 out: 260 257 list_del(&add_res->list); ··· 574 571 static void pci_setup_bridge_io(struct pci_dev *bridge) 575 572 { 576 573 struct resource *res; 574 + const char *res_name; 577 575 struct pci_bus_region region; 578 576 unsigned long io_mask; 579 577 u8 io_base_lo, io_limit_lo; ··· 587 583 588 584 /* Set up the top and bottom of the PCI I/O segment for this bus */ 589 585 res = &bridge->resource[PCI_BRIDGE_IO_WINDOW]; 586 + res_name = pci_resource_name(bridge, PCI_BRIDGE_IO_WINDOW); 590 587 pcibios_resource_to_bus(bridge->bus, &region, res); 591 588 if (res->flags & IORESOURCE_IO) { 592 589 pci_read_config_word(bridge, PCI_IO_BASE, &l); ··· 596 591 l = ((u16) io_limit_lo << 8) | io_base_lo; 597 592 /* Set up upper 16 bits of I/O base/limit */ 598 593 io_upper16 = (region.end & 0xffff0000) | (region.start >> 16); 599 - pci_info(bridge, " bridge window %pR\n", res); 594 + pci_info(bridge, " %s %pR\n", res_name, res); 600 595 } else { 601 596 /* Clear upper 16 bits of I/O base/limit */ 602 597 io_upper16 = 0; ··· 613 608 static void pci_setup_bridge_mmio(struct pci_dev *bridge) 614 609 { 615 610 struct resource *res; 611 + const char *res_name; 616 612 struct pci_bus_region region; 617 613 u32 l; 618 614 619 615 /* Set up the top and bottom of the PCI Memory segment for this bus */ 620 616 res = &bridge->resource[PCI_BRIDGE_MEM_WINDOW]; 617 + res_name = pci_resource_name(bridge, PCI_BRIDGE_MEM_WINDOW); 621 618 pcibios_resource_to_bus(bridge->bus, &region, res); 622 619 if (res->flags & IORESOURCE_MEM) { 623 620 l = (region.start >> 16) & 0xfff0; 624 621 l |= region.end & 0xfff00000; 625 - pci_info(bridge, " bridge window %pR\n", res); 622 + pci_info(bridge, " %s %pR\n", res_name, res); 626 623 } else { 627 624 l = 0x0000fff0; 628 625 } ··· 634 627 static void pci_setup_bridge_mmio_pref(struct pci_dev *bridge) 635 628 { 636 629 struct resource *res; 630 + const char *res_name; 637 631 struct pci_bus_region region; 638 632 u32 l, bu, lu; 639 633 ··· 648 640 /* Set up PREF base/limit */ 649 641 bu = lu = 0; 650 642 res = &bridge->resource[PCI_BRIDGE_PREF_MEM_WINDOW]; 643 + res_name = pci_resource_name(bridge, PCI_BRIDGE_PREF_MEM_WINDOW); 651 644 pcibios_resource_to_bus(bridge->bus, &region, res); 652 645 if (res->flags & IORESOURCE_PREFETCH) { 653 646 l = (region.start >> 16) & 0xfff0; ··· 657 648 bu = upper_32_bits(region.start); 658 649 lu = upper_32_bits(region.end); 659 650 } 660 - pci_info(bridge, " bridge window %pR\n", res); 651 + pci_info(bridge, " %s %pR\n", res_name, res); 661 652 } else { 662 653 l = 0x0000fff0; 663 654 } ··· 1022 1013 int i; 1023 1014 1024 1015 pci_dev_for_each_resource(dev, r, i) { 1016 + const char *r_name = pci_resource_name(dev, i); 1025 1017 resource_size_t r_size; 1026 1018 1027 1019 if (r->parent || (r->flags & IORESOURCE_PCI_FIXED) || ··· 1053 1043 if (order < 0) 1054 1044 order = 0; 1055 1045 if (order >= ARRAY_SIZE(aligns)) { 1056 - pci_warn(dev, "disabling BAR %d: %pR (bad alignment %#llx)\n", 1057 - i, r, (unsigned long long) align); 1046 + pci_warn(dev, "%s %pR: disabling; bad alignment %#llx\n", 1047 + r_name, r, (unsigned long long) align); 1058 1048 r->flags = 0; 1059 1049 continue; 1060 1050 } ··· 2245 2235 for (i = PCI_BRIDGE_RESOURCES; i < PCI_BRIDGE_RESOURCE_END; 2246 2236 i++) { 2247 2237 struct resource *res = &bridge->resource[i]; 2238 + const char *res_name = pci_resource_name(bridge, i); 2248 2239 2249 2240 if ((res->flags ^ type) & PCI_RES_TYPE_MASK) 2250 2241 continue; ··· 2258 2247 if (ret) 2259 2248 goto cleanup; 2260 2249 2261 - pci_info(bridge, "BAR %d: releasing %pR\n", 2262 - i, res); 2250 + pci_info(bridge, "%s %pR: releasing\n", res_name, res); 2263 2251 2264 2252 if (res->parent) 2265 2253 release_resource(res);
+40 -32
drivers/pci/setup-res.c
··· 30 30 u32 new, check, mask; 31 31 int reg; 32 32 struct resource *res = dev->resource + resno; 33 + const char *res_name = pci_resource_name(dev, resno); 33 34 34 35 /* Per SR-IOV spec 3.4.1.11, VF BARs are RO zero */ 35 36 if (dev->is_virtfn) ··· 105 104 pci_read_config_dword(dev, reg, &check); 106 105 107 106 if ((new ^ check) & mask) { 108 - pci_err(dev, "BAR %d: error updating (%#010x != %#010x)\n", 109 - resno, new, check); 107 + pci_err(dev, "%s: error updating (%#010x != %#010x)\n", 108 + res_name, new, check); 110 109 } 111 110 112 111 if (res->flags & IORESOURCE_MEM_64) { ··· 114 113 pci_write_config_dword(dev, reg + 4, new); 115 114 pci_read_config_dword(dev, reg + 4, &check); 116 115 if (check != new) { 117 - pci_err(dev, "BAR %d: error updating (high %#010x != %#010x)\n", 118 - resno, new, check); 116 + pci_err(dev, "%s: error updating (high %#010x != %#010x)\n", 117 + res_name, new, check); 119 118 } 120 119 } 121 120 ··· 136 135 int pci_claim_resource(struct pci_dev *dev, int resource) 137 136 { 138 137 struct resource *res = &dev->resource[resource]; 138 + const char *res_name = pci_resource_name(dev, resource); 139 139 struct resource *root, *conflict; 140 140 141 141 if (res->flags & IORESOURCE_UNSET) { 142 - pci_info(dev, "can't claim BAR %d %pR: no address assigned\n", 143 - resource, res); 142 + pci_info(dev, "%s %pR: can't claim; no address assigned\n", 143 + res_name, res); 144 144 return -EINVAL; 145 145 } 146 146 ··· 155 153 156 154 root = pci_find_parent_resource(dev, res); 157 155 if (!root) { 158 - pci_info(dev, "can't claim BAR %d %pR: no compatible bridge window\n", 159 - resource, res); 156 + pci_info(dev, "%s %pR: can't claim; no compatible bridge window\n", 157 + res_name, res); 160 158 res->flags |= IORESOURCE_UNSET; 161 159 return -EINVAL; 162 160 } 163 161 164 162 conflict = request_resource_conflict(root, res); 165 163 if (conflict) { 166 - pci_info(dev, "can't claim BAR %d %pR: address conflict with %s %pR\n", 167 - resource, res, conflict->name, conflict); 164 + pci_info(dev, "%s %pR: can't claim; address conflict with %s %pR\n", 165 + res_name, res, conflict->name, conflict); 168 166 res->flags |= IORESOURCE_UNSET; 169 167 return -EBUSY; 170 168 } ··· 203 201 { 204 202 struct resource *root, *conflict; 205 203 resource_size_t fw_addr, start, end; 204 + const char *res_name = pci_resource_name(dev, resno); 206 205 207 206 fw_addr = pcibios_retrieve_fw_addr(dev, resno); 208 207 if (!fw_addr) ··· 234 231 root = &iomem_resource; 235 232 } 236 233 237 - pci_info(dev, "BAR %d: trying firmware assignment %pR\n", 238 - resno, res); 234 + pci_info(dev, "%s: trying firmware assignment %pR\n", res_name, res); 239 235 conflict = request_resource_conflict(root, res); 240 236 if (conflict) { 241 - pci_info(dev, "BAR %d: %pR conflicts with %s %pR\n", 242 - resno, res, conflict->name, conflict); 237 + pci_info(dev, "%s %pR: conflicts with %s %pR\n", res_name, res, 238 + conflict->name, conflict); 243 239 res->start = start; 244 240 res->end = end; 245 241 res->flags |= IORESOURCE_UNSET; ··· 327 325 int pci_assign_resource(struct pci_dev *dev, int resno) 328 326 { 329 327 struct resource *res = dev->resource + resno; 328 + const char *res_name = pci_resource_name(dev, resno); 330 329 resource_size_t align, size; 331 330 int ret; 332 331 ··· 337 334 res->flags |= IORESOURCE_UNSET; 338 335 align = pci_resource_alignment(dev, res); 339 336 if (!align) { 340 - pci_info(dev, "BAR %d: can't assign %pR (bogus alignment)\n", 341 - resno, res); 337 + pci_info(dev, "%s %pR: can't assign; bogus alignment\n", 338 + res_name, res); 342 339 return -EINVAL; 343 340 } 344 341 ··· 351 348 * working, which is better than just leaving it disabled. 352 349 */ 353 350 if (ret < 0) { 354 - pci_info(dev, "BAR %d: no space for %pR\n", resno, res); 351 + pci_info(dev, "%s %pR: can't assign; no space\n", res_name, res); 355 352 ret = pci_revert_fw_address(res, dev, resno, size); 356 353 } 357 354 358 355 if (ret < 0) { 359 - pci_info(dev, "BAR %d: failed to assign %pR\n", resno, res); 356 + pci_info(dev, "%s %pR: failed to assign\n", res_name, res); 360 357 return ret; 361 358 } 362 359 363 360 res->flags &= ~IORESOURCE_UNSET; 364 361 res->flags &= ~IORESOURCE_STARTALIGN; 365 - pci_info(dev, "BAR %d: assigned %pR\n", resno, res); 362 + pci_info(dev, "%s %pR: assigned\n", res_name, res); 366 363 if (resno < PCI_BRIDGE_RESOURCES) 367 364 pci_update_resource(dev, resno); 368 365 ··· 370 367 } 371 368 EXPORT_SYMBOL(pci_assign_resource); 372 369 373 - int pci_reassign_resource(struct pci_dev *dev, int resno, resource_size_t addsize, 374 - resource_size_t min_align) 370 + int pci_reassign_resource(struct pci_dev *dev, int resno, 371 + resource_size_t addsize, resource_size_t min_align) 375 372 { 376 373 struct resource *res = dev->resource + resno; 374 + const char *res_name = pci_resource_name(dev, resno); 377 375 unsigned long flags; 378 376 resource_size_t new_size; 379 377 int ret; ··· 385 381 flags = res->flags; 386 382 res->flags |= IORESOURCE_UNSET; 387 383 if (!res->parent) { 388 - pci_info(dev, "BAR %d: can't reassign an unassigned resource %pR\n", 389 - resno, res); 384 + pci_info(dev, "%s %pR: can't reassign; unassigned resource\n", 385 + res_name, res); 390 386 return -EINVAL; 391 387 } 392 388 ··· 395 391 ret = _pci_assign_resource(dev, resno, new_size, min_align); 396 392 if (ret) { 397 393 res->flags = flags; 398 - pci_info(dev, "BAR %d: %pR (failed to expand by %#llx)\n", 399 - resno, res, (unsigned long long) addsize); 394 + pci_info(dev, "%s %pR: failed to expand by %#llx\n", 395 + res_name, res, (unsigned long long) addsize); 400 396 return ret; 401 397 } 402 398 403 399 res->flags &= ~IORESOURCE_UNSET; 404 400 res->flags &= ~IORESOURCE_STARTALIGN; 405 - pci_info(dev, "BAR %d: reassigned %pR (expanded by %#llx)\n", 406 - resno, res, (unsigned long long) addsize); 401 + pci_info(dev, "%s %pR: reassigned; expanded by %#llx\n", 402 + res_name, res, (unsigned long long) addsize); 407 403 if (resno < PCI_BRIDGE_RESOURCES) 408 404 pci_update_resource(dev, resno); 409 405 ··· 413 409 void pci_release_resource(struct pci_dev *dev, int resno) 414 410 { 415 411 struct resource *res = dev->resource + resno; 412 + const char *res_name = pci_resource_name(dev, resno); 416 413 417 - pci_info(dev, "BAR %d: releasing %pR\n", resno, res); 414 + pci_info(dev, "%s %pR: releasing\n", res_name, res); 418 415 419 416 if (!res->parent) 420 417 return; ··· 485 480 u16 cmd, old_cmd; 486 481 int i; 487 482 struct resource *r; 483 + const char *r_name; 488 484 489 485 pci_read_config_word(dev, PCI_COMMAND, &cmd); 490 486 old_cmd = cmd; ··· 494 488 if (!(mask & (1 << i))) 495 489 continue; 496 490 491 + r_name = pci_resource_name(dev, i); 492 + 497 493 if (!(r->flags & (IORESOURCE_IO | IORESOURCE_MEM))) 498 494 continue; 499 495 if ((i == PCI_ROM_RESOURCE) && ··· 503 495 continue; 504 496 505 497 if (r->flags & IORESOURCE_UNSET) { 506 - pci_err(dev, "can't enable device: BAR %d %pR not assigned\n", 507 - i, r); 498 + pci_err(dev, "%s %pR: not assigned; can't enable device\n", 499 + r_name, r); 508 500 return -EINVAL; 509 501 } 510 502 511 503 if (!r->parent) { 512 - pci_err(dev, "can't enable device: BAR %d %pR not claimed\n", 513 - i, r); 504 + pci_err(dev, "%s %pR: not claimed; can't enable device\n", 505 + r_name, r); 514 506 return -EINVAL; 515 507 } 516 508