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

PCI/ACPI: Use dev_printk(), acpi_handle_print(), pr_xxx() when possible

Use dev_printk(), acpi_handle_print(), and pr_xxx() to print messages
in pci_root.c.

[bhelgaas: fold in dev_printk() changes, use dev_printk() in
handle_root_bridge_insertion()]
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Len Brown <lenb@kernel.org>

authored by

Jiang Liu and committed by
Bjorn Helgaas
6dc7d22c bbebed64

+27 -32
+27 -32
drivers/acpi/pci_root.c
··· 388 388 status = acpi_evaluate_integer(handle, METHOD_NAME__SEG, NULL, 389 389 &segment); 390 390 if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { 391 - printk(KERN_ERR PREFIX "can't evaluate _SEG\n"); 391 + dev_err(&device->dev, "can't evaluate _SEG\n"); 392 392 result = -ENODEV; 393 393 goto end; 394 394 } ··· 404 404 * can do is assume [_BBN-0xFF] or [0-0xFF]. 405 405 */ 406 406 root->secondary.end = 0xFF; 407 - printk(KERN_WARNING FW_BUG PREFIX 408 - "no secondary bus range in _CRS\n"); 407 + dev_warn(&device->dev, 408 + FW_BUG "no secondary bus range in _CRS\n"); 409 409 status = acpi_evaluate_integer(handle, METHOD_NAME__BBN, 410 410 NULL, &bus); 411 411 if (ACPI_SUCCESS(status)) ··· 413 413 else if (status == AE_NOT_FOUND) 414 414 root->secondary.start = 0; 415 415 else { 416 - printk(KERN_ERR PREFIX "can't evaluate _BBN\n"); 416 + dev_err(&device->dev, "can't evaluate _BBN\n"); 417 417 result = -ENODEV; 418 418 goto end; 419 419 } ··· 425 425 strcpy(acpi_device_class(device), ACPI_PCI_ROOT_CLASS); 426 426 device->driver_data = root; 427 427 428 - printk(KERN_INFO PREFIX "%s [%s] (domain %04x %pR)\n", 428 + pr_info(PREFIX "%s [%s] (domain %04x %pR)\n", 429 429 acpi_device_name(device), acpi_device_bid(device), 430 430 root->segment, &root->secondary); 431 431 ··· 451 451 */ 452 452 root->bus = pci_acpi_scan_root(root); 453 453 if (!root->bus) { 454 - printk(KERN_ERR PREFIX 455 - "Bus %04x:%02x not present in PCI namespace\n", 456 - root->segment, (unsigned int)root->secondary.start); 454 + dev_err(&device->dev, 455 + "Bus %04x:%02x not present in PCI namespace\n", 456 + root->segment, (unsigned int)root->secondary.start); 457 457 result = -ENODEV; 458 458 goto end; 459 459 } ··· 511 511 "ACPI _OSC request failed (%s), " 512 512 "returned control mask: 0x%02x\n", 513 513 acpi_format_exception(status), flags); 514 - pr_info("ACPI _OSC control for PCIe not granted, " 515 - "disabling ASPM\n"); 514 + dev_info(&device->dev, 515 + "ACPI _OSC control for PCIe not granted, disabling ASPM\n"); 516 516 pcie_no_aspm(); 517 517 } 518 518 } else { ··· 571 571 struct acpi_device *device; 572 572 573 573 if (!acpi_bus_get_device(handle, &device)) { 574 - printk(KERN_DEBUG "acpi device exists...\n"); 574 + dev_printk(KERN_DEBUG, &device->dev, 575 + "acpi device already exists; ignoring notify\n"); 575 576 return; 576 577 } 577 578 578 579 if (acpi_bus_scan(handle)) 579 - printk(KERN_ERR "cannot add bridge to acpi list\n"); 580 + acpi_handle_err(handle, "cannot add bridge to acpi list\n"); 580 581 } 581 582 582 583 static void handle_root_bridge_removal(struct acpi_device *device) ··· 606 605 static void _handle_hotplug_event_root(struct work_struct *work) 607 606 { 608 607 struct acpi_pci_root *root; 609 - struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER }; 610 608 struct acpi_hp_work *hp_work; 611 609 acpi_handle handle; 612 610 u32 type; ··· 617 617 acpi_scan_lock_acquire(); 618 618 619 619 root = acpi_pci_find_root(handle); 620 - acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer); 621 620 622 621 switch (type) { 623 622 case ACPI_NOTIFY_BUS_CHECK: 624 623 /* bus enumerate */ 625 - printk(KERN_DEBUG "%s: Bus check notify on %s\n", __func__, 626 - (char *)buffer.pointer); 624 + acpi_handle_printk(KERN_DEBUG, handle, 625 + "Bus check notify on %s\n", __func__); 627 626 if (!root) 628 627 handle_root_bridge_insertion(handle); 629 628 ··· 630 631 631 632 case ACPI_NOTIFY_DEVICE_CHECK: 632 633 /* device check */ 633 - printk(KERN_DEBUG "%s: Device check notify on %s\n", __func__, 634 - (char *)buffer.pointer); 634 + acpi_handle_printk(KERN_DEBUG, handle, 635 + "Device check notify on %s\n", __func__); 635 636 if (!root) 636 637 handle_root_bridge_insertion(handle); 637 638 break; 638 639 639 640 case ACPI_NOTIFY_EJECT_REQUEST: 640 641 /* request device eject */ 641 - printk(KERN_DEBUG "%s: Device eject notify on %s\n", __func__, 642 - (char *)buffer.pointer); 642 + acpi_handle_printk(KERN_DEBUG, handle, 643 + "Device eject notify on %s\n", __func__); 643 644 if (root) 644 645 handle_root_bridge_removal(root->device); 645 646 break; 646 647 default: 647 - printk(KERN_WARNING "notify_handler: unknown event type 0x%x for %s\n", 648 - type, (char *)buffer.pointer); 648 + acpi_handle_warn(handle, 649 + "notify_handler: unknown event type 0x%x\n", 650 + type); 649 651 break; 650 652 } 651 653 652 654 acpi_scan_lock_release(); 653 655 kfree(hp_work); /* allocated in handle_hotplug_event_bridge */ 654 - kfree(buffer.pointer); 655 656 } 656 657 657 658 static void handle_hotplug_event_root(acpi_handle handle, u32 type, ··· 665 666 find_root_bridges(acpi_handle handle, u32 lvl, void *context, void **rv) 666 667 { 667 668 acpi_status status; 668 - char objname[64]; 669 - struct acpi_buffer buffer = { .length = sizeof(objname), 670 - .pointer = objname }; 671 669 int *count = (int *)context; 672 670 673 671 if (!acpi_is_root_bridge(handle)) ··· 672 676 673 677 (*count)++; 674 678 675 - acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer); 676 - 677 679 status = acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, 678 680 handle_hotplug_event_root, NULL); 679 681 if (ACPI_FAILURE(status)) 680 - printk(KERN_DEBUG "acpi root: %s notify handler is not installed, exit status: %u\n", 681 - objname, (unsigned int)status); 682 + acpi_handle_printk(KERN_DEBUG, handle, 683 + "notify handler is not installed, exit status: %u\n", 684 + (unsigned int)status); 682 685 else 683 - printk(KERN_DEBUG "acpi root: %s notify handler is installed\n", 684 - objname); 686 + acpi_handle_printk(KERN_DEBUG, handle, 687 + "notify handler is installed\n"); 685 688 686 689 return AE_OK; 687 690 }