diff options
author | Jiang Liu <jiang.liu@huawei.com> | 2013-05-28 20:10:05 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2013-05-29 16:35:51 -0400 |
commit | 6dc7d22c67384d313fca88c1a63af3220a2beff7 (patch) | |
tree | 2708aa95301a9b00f12fe3752a728e4a1798f22c /drivers/acpi/pci_root.c | |
parent | bbebed6423f5b281f9ca314518531f90424f6f57 (diff) |
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>
Diffstat (limited to 'drivers/acpi/pci_root.c')
-rw-r--r-- | drivers/acpi/pci_root.c | 59 |
1 files changed, 27 insertions, 32 deletions
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 18b7ab2dee4f..27020882eb97 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c | |||
@@ -388,7 +388,7 @@ static int acpi_pci_root_add(struct acpi_device *device, | |||
388 | status = acpi_evaluate_integer(handle, METHOD_NAME__SEG, NULL, | 388 | status = acpi_evaluate_integer(handle, METHOD_NAME__SEG, NULL, |
389 | &segment); | 389 | &segment); |
390 | if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { | 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 | result = -ENODEV; | 392 | result = -ENODEV; |
393 | goto end; | 393 | goto end; |
394 | } | 394 | } |
@@ -404,8 +404,8 @@ static int acpi_pci_root_add(struct acpi_device *device, | |||
404 | * can do is assume [_BBN-0xFF] or [0-0xFF]. | 404 | * can do is assume [_BBN-0xFF] or [0-0xFF]. |
405 | */ | 405 | */ |
406 | root->secondary.end = 0xFF; | 406 | root->secondary.end = 0xFF; |
407 | printk(KERN_WARNING FW_BUG PREFIX | 407 | dev_warn(&device->dev, |
408 | "no secondary bus range in _CRS\n"); | 408 | FW_BUG "no secondary bus range in _CRS\n"); |
409 | status = acpi_evaluate_integer(handle, METHOD_NAME__BBN, | 409 | status = acpi_evaluate_integer(handle, METHOD_NAME__BBN, |
410 | NULL, &bus); | 410 | NULL, &bus); |
411 | if (ACPI_SUCCESS(status)) | 411 | if (ACPI_SUCCESS(status)) |
@@ -413,7 +413,7 @@ static int acpi_pci_root_add(struct acpi_device *device, | |||
413 | else if (status == AE_NOT_FOUND) | 413 | else if (status == AE_NOT_FOUND) |
414 | root->secondary.start = 0; | 414 | root->secondary.start = 0; |
415 | else { | 415 | else { |
416 | printk(KERN_ERR PREFIX "can't evaluate _BBN\n"); | 416 | dev_err(&device->dev, "can't evaluate _BBN\n"); |
417 | result = -ENODEV; | 417 | result = -ENODEV; |
418 | goto end; | 418 | goto end; |
419 | } | 419 | } |
@@ -425,7 +425,7 @@ static int acpi_pci_root_add(struct acpi_device *device, | |||
425 | strcpy(acpi_device_class(device), ACPI_PCI_ROOT_CLASS); | 425 | strcpy(acpi_device_class(device), ACPI_PCI_ROOT_CLASS); |
426 | device->driver_data = root; | 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 | acpi_device_name(device), acpi_device_bid(device), | 429 | acpi_device_name(device), acpi_device_bid(device), |
430 | root->segment, &root->secondary); | 430 | root->segment, &root->secondary); |
431 | 431 | ||
@@ -451,9 +451,9 @@ static int acpi_pci_root_add(struct acpi_device *device, | |||
451 | */ | 451 | */ |
452 | root->bus = pci_acpi_scan_root(root); | 452 | root->bus = pci_acpi_scan_root(root); |
453 | if (!root->bus) { | 453 | if (!root->bus) { |
454 | printk(KERN_ERR PREFIX | 454 | dev_err(&device->dev, |
455 | "Bus %04x:%02x not present in PCI namespace\n", | 455 | "Bus %04x:%02x not present in PCI namespace\n", |
456 | root->segment, (unsigned int)root->secondary.start); | 456 | root->segment, (unsigned int)root->secondary.start); |
457 | result = -ENODEV; | 457 | result = -ENODEV; |
458 | goto end; | 458 | goto end; |
459 | } | 459 | } |
@@ -511,8 +511,8 @@ static int acpi_pci_root_add(struct acpi_device *device, | |||
511 | "ACPI _OSC request failed (%s), " | 511 | "ACPI _OSC request failed (%s), " |
512 | "returned control mask: 0x%02x\n", | 512 | "returned control mask: 0x%02x\n", |
513 | acpi_format_exception(status), flags); | 513 | acpi_format_exception(status), flags); |
514 | pr_info("ACPI _OSC control for PCIe not granted, " | 514 | dev_info(&device->dev, |
515 | "disabling ASPM\n"); | 515 | "ACPI _OSC control for PCIe not granted, disabling ASPM\n"); |
516 | pcie_no_aspm(); | 516 | pcie_no_aspm(); |
517 | } | 517 | } |
518 | } else { | 518 | } else { |
@@ -571,12 +571,13 @@ static void handle_root_bridge_insertion(acpi_handle handle) | |||
571 | struct acpi_device *device; | 571 | struct acpi_device *device; |
572 | 572 | ||
573 | if (!acpi_bus_get_device(handle, &device)) { | 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 | return; | 576 | return; |
576 | } | 577 | } |
577 | 578 | ||
578 | if (acpi_bus_scan(handle)) | 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 | static void handle_root_bridge_removal(struct acpi_device *device) | 583 | static void handle_root_bridge_removal(struct acpi_device *device) |
@@ -605,7 +606,6 @@ static void handle_root_bridge_removal(struct acpi_device *device) | |||
605 | static void _handle_hotplug_event_root(struct work_struct *work) | 606 | static void _handle_hotplug_event_root(struct work_struct *work) |
606 | { | 607 | { |
607 | struct acpi_pci_root *root; | 608 | struct acpi_pci_root *root; |
608 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER }; | ||
609 | struct acpi_hp_work *hp_work; | 609 | struct acpi_hp_work *hp_work; |
610 | acpi_handle handle; | 610 | acpi_handle handle; |
611 | u32 type; | 611 | u32 type; |
@@ -617,13 +617,12 @@ static void _handle_hotplug_event_root(struct work_struct *work) | |||
617 | acpi_scan_lock_acquire(); | 617 | acpi_scan_lock_acquire(); |
618 | 618 | ||
619 | root = acpi_pci_find_root(handle); | 619 | root = acpi_pci_find_root(handle); |
620 | acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer); | ||
621 | 620 | ||
622 | switch (type) { | 621 | switch (type) { |
623 | case ACPI_NOTIFY_BUS_CHECK: | 622 | case ACPI_NOTIFY_BUS_CHECK: |
624 | /* bus enumerate */ | 623 | /* bus enumerate */ |
625 | printk(KERN_DEBUG "%s: Bus check notify on %s\n", __func__, | 624 | acpi_handle_printk(KERN_DEBUG, handle, |
626 | (char *)buffer.pointer); | 625 | "Bus check notify on %s\n", __func__); |
627 | if (!root) | 626 | if (!root) |
628 | handle_root_bridge_insertion(handle); | 627 | handle_root_bridge_insertion(handle); |
629 | 628 | ||
@@ -631,28 +630,28 @@ static void _handle_hotplug_event_root(struct work_struct *work) | |||
631 | 630 | ||
632 | case ACPI_NOTIFY_DEVICE_CHECK: | 631 | case ACPI_NOTIFY_DEVICE_CHECK: |
633 | /* device check */ | 632 | /* device check */ |
634 | printk(KERN_DEBUG "%s: Device check notify on %s\n", __func__, | 633 | acpi_handle_printk(KERN_DEBUG, handle, |
635 | (char *)buffer.pointer); | 634 | "Device check notify on %s\n", __func__); |
636 | if (!root) | 635 | if (!root) |
637 | handle_root_bridge_insertion(handle); | 636 | handle_root_bridge_insertion(handle); |
638 | break; | 637 | break; |
639 | 638 | ||
640 | case ACPI_NOTIFY_EJECT_REQUEST: | 639 | case ACPI_NOTIFY_EJECT_REQUEST: |
641 | /* request device eject */ | 640 | /* request device eject */ |
642 | printk(KERN_DEBUG "%s: Device eject notify on %s\n", __func__, | 641 | acpi_handle_printk(KERN_DEBUG, handle, |
643 | (char *)buffer.pointer); | 642 | "Device eject notify on %s\n", __func__); |
644 | if (root) | 643 | if (root) |
645 | handle_root_bridge_removal(root->device); | 644 | handle_root_bridge_removal(root->device); |
646 | break; | 645 | break; |
647 | default: | 646 | default: |
648 | printk(KERN_WARNING "notify_handler: unknown event type 0x%x for %s\n", | 647 | acpi_handle_warn(handle, |
649 | type, (char *)buffer.pointer); | 648 | "notify_handler: unknown event type 0x%x\n", |
649 | type); | ||
650 | break; | 650 | break; |
651 | } | 651 | } |
652 | 652 | ||
653 | acpi_scan_lock_release(); | 653 | acpi_scan_lock_release(); |
654 | kfree(hp_work); /* allocated in handle_hotplug_event_bridge */ | 654 | kfree(hp_work); /* allocated in handle_hotplug_event_bridge */ |
655 | kfree(buffer.pointer); | ||
656 | } | 655 | } |
657 | 656 | ||
658 | static void handle_hotplug_event_root(acpi_handle handle, u32 type, | 657 | static void handle_hotplug_event_root(acpi_handle handle, u32 type, |
@@ -666,9 +665,6 @@ static acpi_status __init | |||
666 | find_root_bridges(acpi_handle handle, u32 lvl, void *context, void **rv) | 665 | find_root_bridges(acpi_handle handle, u32 lvl, void *context, void **rv) |
667 | { | 666 | { |
668 | acpi_status status; | 667 | acpi_status status; |
669 | char objname[64]; | ||
670 | struct acpi_buffer buffer = { .length = sizeof(objname), | ||
671 | .pointer = objname }; | ||
672 | int *count = (int *)context; | 668 | int *count = (int *)context; |
673 | 669 | ||
674 | if (!acpi_is_root_bridge(handle)) | 670 | if (!acpi_is_root_bridge(handle)) |
@@ -676,16 +672,15 @@ find_root_bridges(acpi_handle handle, u32 lvl, void *context, void **rv) | |||
676 | 672 | ||
677 | (*count)++; | 673 | (*count)++; |
678 | 674 | ||
679 | acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer); | ||
680 | |||
681 | status = acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, | 675 | status = acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, |
682 | handle_hotplug_event_root, NULL); | 676 | handle_hotplug_event_root, NULL); |
683 | if (ACPI_FAILURE(status)) | 677 | if (ACPI_FAILURE(status)) |
684 | printk(KERN_DEBUG "acpi root: %s notify handler is not installed, exit status: %u\n", | 678 | acpi_handle_printk(KERN_DEBUG, handle, |
685 | objname, (unsigned int)status); | 679 | "notify handler is not installed, exit status: %u\n", |
680 | (unsigned int)status); | ||
686 | else | 681 | else |
687 | printk(KERN_DEBUG "acpi root: %s notify handler is installed\n", | 682 | acpi_handle_printk(KERN_DEBUG, handle, |
688 | objname); | 683 | "notify handler is installed\n"); |
689 | 684 | ||
690 | return AE_OK; | 685 | return AE_OK; |
691 | } | 686 | } |