Commit e9071b0be5e7ce4903b7f7c370769d485774d3e3
Committed by
Ingo Molnar
1 parent
6f5cf52114
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
iommu/dmar: Use pr_format() instead of PREFIX to tidy up pr_*() calls
Joe Perches recommended getting rid of the redundant formatting of adding "PREFIX" to all the uses of pr_*() calls. The recommendation helps to reduce source and improve readibility. While cleaning up the PREFIX's, I saw that one of the pr_warn() was redundant in dmar_parse_one_dev_scope(), since the same message was printed after breaking out of the while loop for the same condition, !pdev. So, to avoid a duplicate message, I removed the one in the while loop. Reported-by: Joe Perches <joe@perches.com> Signed-off-by: Donald Dutile <ddutile@redhat.com> Cc: iommu@lists.linux-foundation.org Cc: chrisw@redhat.com Cc: suresh.b.siddha@intel.com Cc: dwmw2@infradead.org Link: http://lkml.kernel.org/r/1339189991-13129-1-git-send-email-ddutile@redhat.com [ Small whitespace fixes. ] Signed-off-by: Ingo Molnar <mingo@kernel.org>
Showing 1 changed file with 24 additions and 30 deletions Side-by-side Diff
drivers/iommu/dmar.c
... | ... | @@ -26,6 +26,8 @@ |
26 | 26 | * These routines are used by both DMA-remapping and Interrupt-remapping |
27 | 27 | */ |
28 | 28 | |
29 | +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt /* has to precede printk.h */ | |
30 | + | |
29 | 31 | #include <linux/pci.h> |
30 | 32 | #include <linux/dmar.h> |
31 | 33 | #include <linux/iova.h> |
... | ... | @@ -39,8 +41,6 @@ |
39 | 41 | #include <asm/irq_remapping.h> |
40 | 42 | #include <asm/iommu_table.h> |
41 | 43 | |
42 | -#define PREFIX "DMAR: " | |
43 | - | |
44 | 44 | /* No locks are needed as DMA remapping hardware unit |
45 | 45 | * list is constructed at boot time and hotplug of |
46 | 46 | * these units are not supported by the architecture. |
47 | 47 | |
... | ... | @@ -83,15 +83,12 @@ |
83 | 83 | * ignore it |
84 | 84 | */ |
85 | 85 | if (!bus) { |
86 | - pr_warn(PREFIX "Device scope bus [%d] not found\n", | |
87 | - scope->bus); | |
86 | + pr_warn("Device scope bus [%d] not found\n", scope->bus); | |
88 | 87 | break; |
89 | 88 | } |
90 | 89 | pdev = pci_get_slot(bus, PCI_DEVFN(path->dev, path->fn)); |
91 | 90 | if (!pdev) { |
92 | - pr_warn(PREFIX "Device scope device" | |
93 | - "[%04x:%02x:%02x.%02x] not found\n", | |
94 | - segment, bus->number, path->dev, path->fn); | |
91 | + /* warning will be printed below */ | |
95 | 92 | break; |
96 | 93 | } |
97 | 94 | path ++; |
... | ... | @@ -99,8 +96,7 @@ |
99 | 96 | bus = pdev->subordinate; |
100 | 97 | } |
101 | 98 | if (!pdev) { |
102 | - pr_warn(PREFIX | |
103 | - "Device scope device [%04x:%02x:%02x.%02x] not found\n", | |
99 | + pr_warn("Device scope device [%04x:%02x:%02x.%02x] not found\n", | |
104 | 100 | segment, scope->bus, path->dev, path->fn); |
105 | 101 | *dev = NULL; |
106 | 102 | return 0; |
... | ... | @@ -109,8 +105,8 @@ |
109 | 105 | pdev->subordinate) || (scope->entry_type == \ |
110 | 106 | ACPI_DMAR_SCOPE_TYPE_BRIDGE && !pdev->subordinate)) { |
111 | 107 | pci_dev_put(pdev); |
112 | - pr_warn(PREFIX "Device scope type does not match for %s\n", | |
113 | - pci_name(pdev)); | |
108 | + pr_warn("Device scope type does not match for %s\n", | |
109 | + pci_name(pdev)); | |
114 | 110 | return -EINVAL; |
115 | 111 | } |
116 | 112 | *dev = pdev; |
... | ... | @@ -132,7 +128,7 @@ |
132 | 128 | scope->entry_type == ACPI_DMAR_SCOPE_TYPE_BRIDGE) |
133 | 129 | (*cnt)++; |
134 | 130 | else if (scope->entry_type != ACPI_DMAR_SCOPE_TYPE_IOAPIC) { |
135 | - pr_warn(PREFIX "Unsupported device scope\n"); | |
131 | + pr_warn("Unsupported device scope\n"); | |
136 | 132 | } |
137 | 133 | start += scope->length; |
138 | 134 | } |
139 | 135 | |
140 | 136 | |
141 | 137 | |
... | ... | @@ -258,23 +254,23 @@ |
258 | 254 | case ACPI_DMAR_TYPE_HARDWARE_UNIT: |
259 | 255 | drhd = container_of(header, struct acpi_dmar_hardware_unit, |
260 | 256 | header); |
261 | - pr_info(PREFIX "DRHD base: %#016Lx flags: %#x\n", | |
257 | + pr_info("DRHD base: %#016Lx flags: %#x\n", | |
262 | 258 | (unsigned long long)drhd->address, drhd->flags); |
263 | 259 | break; |
264 | 260 | case ACPI_DMAR_TYPE_RESERVED_MEMORY: |
265 | 261 | rmrr = container_of(header, struct acpi_dmar_reserved_memory, |
266 | 262 | header); |
267 | - pr_info(PREFIX "RMRR base: %#016Lx end: %#016Lx\n", | |
263 | + pr_info("RMRR base: %#016Lx end: %#016Lx\n", | |
268 | 264 | (unsigned long long)rmrr->base_address, |
269 | 265 | (unsigned long long)rmrr->end_address); |
270 | 266 | break; |
271 | 267 | case ACPI_DMAR_TYPE_ATSR: |
272 | 268 | atsr = container_of(header, struct acpi_dmar_atsr, header); |
273 | - pr_info(PREFIX "ATSR flags: %#x\n", atsr->flags); | |
269 | + pr_info("ATSR flags: %#x\n", atsr->flags); | |
274 | 270 | break; |
275 | 271 | case ACPI_DMAR_HARDWARE_AFFINITY: |
276 | 272 | rhsa = container_of(header, struct acpi_dmar_rhsa, header); |
277 | - pr_info(PREFIX "RHSA base: %#016Lx proximity domain: %#x\n", | |
273 | + pr_info("RHSA base: %#016Lx proximity domain: %#x\n", | |
278 | 274 | (unsigned long long)rhsa->base_address, |
279 | 275 | rhsa->proximity_domain); |
280 | 276 | break; |
... | ... | @@ -294,7 +290,7 @@ |
294 | 290 | &dmar_tbl_size); |
295 | 291 | |
296 | 292 | if (ACPI_SUCCESS(status) && !dmar_tbl) { |
297 | - pr_warn(PREFIX "Unable to map DMAR\n"); | |
293 | + pr_warn("Unable to map DMAR\n"); | |
298 | 294 | status = AE_NOT_FOUND; |
299 | 295 | } |
300 | 296 | |
301 | 297 | |
302 | 298 | |
... | ... | @@ -328,18 +324,18 @@ |
328 | 324 | return -ENODEV; |
329 | 325 | |
330 | 326 | if (dmar->width < PAGE_SHIFT - 1) { |
331 | - pr_warn(PREFIX "Invalid DMAR haw\n"); | |
327 | + pr_warn("Invalid DMAR haw\n"); | |
332 | 328 | return -EINVAL; |
333 | 329 | } |
334 | 330 | |
335 | - pr_info(PREFIX "Host address width %d\n", dmar->width + 1); | |
331 | + pr_info("Host address width %d\n", dmar->width + 1); | |
336 | 332 | |
337 | 333 | entry_header = (struct acpi_dmar_header *)(dmar + 1); |
338 | 334 | while (((unsigned long)entry_header) < |
339 | 335 | (((unsigned long)dmar) + dmar_tbl->length)) { |
340 | 336 | /* Avoid looping forever on bad ACPI tables */ |
341 | 337 | if (entry_header->length == 0) { |
342 | - pr_warn(PREFIX "Invalid 0-length structure\n"); | |
338 | + pr_warn("Invalid 0-length structure\n"); | |
343 | 339 | ret = -EINVAL; |
344 | 340 | break; |
345 | 341 | } |
... | ... | @@ -362,7 +358,7 @@ |
362 | 358 | #endif |
363 | 359 | break; |
364 | 360 | default: |
365 | - pr_warn(PREFIX "Unknown DMAR structure type %d\n", | |
361 | + pr_warn("Unknown DMAR structure type %d\n", | |
366 | 362 | entry_header->type); |
367 | 363 | ret = 0; /* for forward compatibility */ |
368 | 364 | break; |
369 | 365 | |
... | ... | @@ -461,12 +457,12 @@ |
461 | 457 | ret = parse_dmar_table(); |
462 | 458 | if (ret) { |
463 | 459 | if (ret != -ENODEV) |
464 | - pr_info(PREFIX "parse DMAR table failure.\n"); | |
460 | + pr_info("parse DMAR table failure.\n"); | |
465 | 461 | return ret; |
466 | 462 | } |
467 | 463 | |
468 | 464 | if (list_empty(&dmar_drhd_units)) { |
469 | - pr_info(PREFIX "No DMAR devices found\n"); | |
465 | + pr_info("No DMAR devices found\n"); | |
470 | 466 | return -ENODEV; |
471 | 467 | } |
472 | 468 | |
... | ... | @@ -498,7 +494,7 @@ |
498 | 494 | (((unsigned long)dmar) + dmar_tbl->length)) { |
499 | 495 | /* Avoid looping forever on bad ACPI tables */ |
500 | 496 | if (entry_header->length == 0) { |
501 | - pr_warn(PREFIX "Invalid 0-length structure\n"); | |
497 | + pr_warn("Invalid 0-length structure\n"); | |
502 | 498 | return 0; |
503 | 499 | } |
504 | 500 | |
... | ... | @@ -549,8 +545,7 @@ |
549 | 545 | |
550 | 546 | if (ret && irq_remapping_enabled && cpu_has_x2apic && |
551 | 547 | dmar->flags & 0x1) |
552 | - pr_info("Queued invalidation will be enabled to " | |
553 | - "support x2apic and Intr-remapping.\n"); | |
548 | + pr_info("Queued invalidation will be enabled to support x2apic and Intr-remapping.\n"); | |
554 | 549 | |
555 | 550 | if (ret && !no_iommu && !iommu_detected && !dmar_disabled) { |
556 | 551 | iommu_detected = 1; |
557 | 552 | |
... | ... | @@ -580,9 +575,9 @@ |
580 | 575 | * map_iommu: map the iommu's registers |
581 | 576 | * @iommu: the iommu to map |
582 | 577 | * @phys_addr: the physical address of the base resgister |
583 | - * | |
578 | + * | |
584 | 579 | * Memory map the iommu's registers. Start w/ a single page, and |
585 | - * possibly expand if that turns out to be insufficent. | |
580 | + * possibly expand if that turns out to be insufficent. | |
586 | 581 | */ |
587 | 582 | static int map_iommu(struct intel_iommu *iommu, u64 phys_addr) |
588 | 583 | { |
... | ... | @@ -1302,8 +1297,7 @@ |
1302 | 1297 | ret = dmar_set_interrupt(iommu); |
1303 | 1298 | |
1304 | 1299 | if (ret) { |
1305 | - pr_err("DRHD %Lx: failed to enable fault, " | |
1306 | - " interrupt, ret %d\n", | |
1300 | + pr_err("DRHD %Lx: failed to enable fault, interrupt, ret %d\n", | |
1307 | 1301 | (unsigned long long)drhd->reg_base_addr, ret); |
1308 | 1302 | return -1; |
1309 | 1303 | } |