diff options
author | Frederick Lawler <fred@fredlawl.com> | 2018-01-18 13:55:24 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2018-01-18 13:55:24 -0500 |
commit | 7506dc7989933235e6fc23f3d0516bdbf0f7d1a8 (patch) | |
tree | 9ea5a5569ac0b5c6e52f2e2294b9d4dc15b67022 /drivers/pci/hotplug/pnv_php.c | |
parent | c7abb2352c298e8ac2ccfd843f036ae5244d6f35 (diff) |
PCI: Add wrappers for dev_printk()
Add PCI-specific dev_printk() wrappers and use them to simplify the code
slightly. No functional change intended.
Signed-off-by: Frederick Lawler <fred@fredlawl.com>
[bhelgaas: squash into one patch]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/hotplug/pnv_php.c')
-rw-r--r-- | drivers/pci/hotplug/pnv_php.c | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/drivers/pci/hotplug/pnv_php.c b/drivers/pci/hotplug/pnv_php.c index 318baa507364..0373b9d88c6d 100644 --- a/drivers/pci/hotplug/pnv_php.c +++ b/drivers/pci/hotplug/pnv_php.c | |||
@@ -271,8 +271,7 @@ static int pnv_php_add_devtree(struct pnv_php_slot *php_slot) | |||
271 | 271 | ||
272 | ret = pnv_pci_get_device_tree(php_slot->dn->phandle, fdt1, 0x10000); | 272 | ret = pnv_pci_get_device_tree(php_slot->dn->phandle, fdt1, 0x10000); |
273 | if (ret) { | 273 | if (ret) { |
274 | dev_warn(&php_slot->pdev->dev, "Error %d getting FDT blob\n", | 274 | pci_warn(php_slot->pdev, "Error %d getting FDT blob\n", ret); |
275 | ret); | ||
276 | goto free_fdt1; | 275 | goto free_fdt1; |
277 | } | 276 | } |
278 | 277 | ||
@@ -287,7 +286,7 @@ static int pnv_php_add_devtree(struct pnv_php_slot *php_slot) | |||
287 | dt = of_fdt_unflatten_tree(fdt, php_slot->dn, NULL); | 286 | dt = of_fdt_unflatten_tree(fdt, php_slot->dn, NULL); |
288 | if (!dt) { | 287 | if (!dt) { |
289 | ret = -EINVAL; | 288 | ret = -EINVAL; |
290 | dev_warn(&php_slot->pdev->dev, "Cannot unflatten FDT\n"); | 289 | pci_warn(php_slot->pdev, "Cannot unflatten FDT\n"); |
291 | goto free_fdt; | 290 | goto free_fdt; |
292 | } | 291 | } |
293 | 292 | ||
@@ -297,7 +296,7 @@ static int pnv_php_add_devtree(struct pnv_php_slot *php_slot) | |||
297 | ret = pnv_php_populate_changeset(&php_slot->ocs, php_slot->dn); | 296 | ret = pnv_php_populate_changeset(&php_slot->ocs, php_slot->dn); |
298 | if (ret) { | 297 | if (ret) { |
299 | pnv_php_reverse_nodes(php_slot->dn); | 298 | pnv_php_reverse_nodes(php_slot->dn); |
300 | dev_warn(&php_slot->pdev->dev, "Error %d populating changeset\n", | 299 | pci_warn(php_slot->pdev, "Error %d populating changeset\n", |
301 | ret); | 300 | ret); |
302 | goto free_dt; | 301 | goto free_dt; |
303 | } | 302 | } |
@@ -305,8 +304,7 @@ static int pnv_php_add_devtree(struct pnv_php_slot *php_slot) | |||
305 | php_slot->dn->child = NULL; | 304 | php_slot->dn->child = NULL; |
306 | ret = of_changeset_apply(&php_slot->ocs); | 305 | ret = of_changeset_apply(&php_slot->ocs); |
307 | if (ret) { | 306 | if (ret) { |
308 | dev_warn(&php_slot->pdev->dev, "Error %d applying changeset\n", | 307 | pci_warn(php_slot->pdev, "Error %d applying changeset\n", ret); |
309 | ret); | ||
310 | goto destroy_changeset; | 308 | goto destroy_changeset; |
311 | } | 309 | } |
312 | 310 | ||
@@ -342,14 +340,14 @@ int pnv_php_set_slot_power_state(struct hotplug_slot *slot, | |||
342 | if (be64_to_cpu(msg.params[1]) != php_slot->dn->phandle || | 340 | if (be64_to_cpu(msg.params[1]) != php_slot->dn->phandle || |
343 | be64_to_cpu(msg.params[2]) != state || | 341 | be64_to_cpu(msg.params[2]) != state || |
344 | be64_to_cpu(msg.params[3]) != OPAL_SUCCESS) { | 342 | be64_to_cpu(msg.params[3]) != OPAL_SUCCESS) { |
345 | dev_warn(&php_slot->pdev->dev, "Wrong msg (%lld, %lld, %lld)\n", | 343 | pci_warn(php_slot->pdev, "Wrong msg (%lld, %lld, %lld)\n", |
346 | be64_to_cpu(msg.params[1]), | 344 | be64_to_cpu(msg.params[1]), |
347 | be64_to_cpu(msg.params[2]), | 345 | be64_to_cpu(msg.params[2]), |
348 | be64_to_cpu(msg.params[3])); | 346 | be64_to_cpu(msg.params[3])); |
349 | return -ENOMSG; | 347 | return -ENOMSG; |
350 | } | 348 | } |
351 | } else if (ret < 0) { | 349 | } else if (ret < 0) { |
352 | dev_warn(&php_slot->pdev->dev, "Error %d powering %s\n", | 350 | pci_warn(php_slot->pdev, "Error %d powering %s\n", |
353 | ret, (state == OPAL_PCI_SLOT_POWER_ON) ? "on" : "off"); | 351 | ret, (state == OPAL_PCI_SLOT_POWER_ON) ? "on" : "off"); |
354 | return ret; | 352 | return ret; |
355 | } | 353 | } |
@@ -376,7 +374,7 @@ static int pnv_php_get_power_state(struct hotplug_slot *slot, u8 *state) | |||
376 | */ | 374 | */ |
377 | ret = pnv_pci_get_power_state(php_slot->id, &power_state); | 375 | ret = pnv_pci_get_power_state(php_slot->id, &power_state); |
378 | if (ret) { | 376 | if (ret) { |
379 | dev_warn(&php_slot->pdev->dev, "Error %d getting power status\n", | 377 | pci_warn(php_slot->pdev, "Error %d getting power status\n", |
380 | ret); | 378 | ret); |
381 | } else { | 379 | } else { |
382 | *state = power_state; | 380 | *state = power_state; |
@@ -402,8 +400,7 @@ static int pnv_php_get_adapter_state(struct hotplug_slot *slot, u8 *state) | |||
402 | slot->info->adapter_status = presence; | 400 | slot->info->adapter_status = presence; |
403 | ret = 0; | 401 | ret = 0; |
404 | } else { | 402 | } else { |
405 | dev_warn(&php_slot->pdev->dev, "Error %d getting presence\n", | 403 | pci_warn(php_slot->pdev, "Error %d getting presence\n", ret); |
406 | ret); | ||
407 | } | 404 | } |
408 | 405 | ||
409 | return ret; | 406 | return ret; |
@@ -626,8 +623,7 @@ static int pnv_php_register_slot(struct pnv_php_slot *php_slot) | |||
626 | ret = pci_hp_register(&php_slot->slot, php_slot->bus, | 623 | ret = pci_hp_register(&php_slot->slot, php_slot->bus, |
627 | php_slot->slot_no, php_slot->name); | 624 | php_slot->slot_no, php_slot->name); |
628 | if (ret) { | 625 | if (ret) { |
629 | dev_warn(&php_slot->pdev->dev, "Error %d registering slot\n", | 626 | pci_warn(php_slot->pdev, "Error %d registering slot\n", ret); |
630 | ret); | ||
631 | return ret; | 627 | return ret; |
632 | } | 628 | } |
633 | 629 | ||
@@ -680,7 +676,7 @@ static int pnv_php_enable_msix(struct pnv_php_slot *php_slot) | |||
680 | /* Enable MSIx */ | 676 | /* Enable MSIx */ |
681 | ret = pci_enable_msix_exact(pdev, &entry, 1); | 677 | ret = pci_enable_msix_exact(pdev, &entry, 1); |
682 | if (ret) { | 678 | if (ret) { |
683 | dev_warn(&pdev->dev, "Error %d enabling MSIx\n", ret); | 679 | pci_warn(pdev, "Error %d enabling MSIx\n", ret); |
684 | return ret; | 680 | return ret; |
685 | } | 681 | } |
686 | 682 | ||
@@ -724,7 +720,7 @@ static irqreturn_t pnv_php_interrupt(int irq, void *data) | |||
724 | (sts & PCI_EXP_SLTSTA_PDC)) { | 720 | (sts & PCI_EXP_SLTSTA_PDC)) { |
725 | ret = pnv_pci_get_presence_state(php_slot->id, &presence); | 721 | ret = pnv_pci_get_presence_state(php_slot->id, &presence); |
726 | if (ret) { | 722 | if (ret) { |
727 | dev_warn(&pdev->dev, "PCI slot [%s] error %d getting presence (0x%04x), to retry the operation.\n", | 723 | pci_warn(pdev, "PCI slot [%s] error %d getting presence (0x%04x), to retry the operation.\n", |
728 | php_slot->name, ret, sts); | 724 | php_slot->name, ret, sts); |
729 | return IRQ_HANDLED; | 725 | return IRQ_HANDLED; |
730 | } | 726 | } |
@@ -754,12 +750,12 @@ static irqreturn_t pnv_php_interrupt(int irq, void *data) | |||
754 | */ | 750 | */ |
755 | event = kzalloc(sizeof(*event), GFP_ATOMIC); | 751 | event = kzalloc(sizeof(*event), GFP_ATOMIC); |
756 | if (!event) { | 752 | if (!event) { |
757 | dev_warn(&pdev->dev, "PCI slot [%s] missed hotplug event 0x%04x\n", | 753 | pci_warn(pdev, "PCI slot [%s] missed hotplug event 0x%04x\n", |
758 | php_slot->name, sts); | 754 | php_slot->name, sts); |
759 | return IRQ_HANDLED; | 755 | return IRQ_HANDLED; |
760 | } | 756 | } |
761 | 757 | ||
762 | dev_info(&pdev->dev, "PCI slot [%s] %s (IRQ: %d)\n", | 758 | pci_info(pdev, "PCI slot [%s] %s (IRQ: %d)\n", |
763 | php_slot->name, added ? "added" : "removed", irq); | 759 | php_slot->name, added ? "added" : "removed", irq); |
764 | INIT_WORK(&event->work, pnv_php_event_handler); | 760 | INIT_WORK(&event->work, pnv_php_event_handler); |
765 | event->added = added; | 761 | event->added = added; |
@@ -779,7 +775,7 @@ static void pnv_php_init_irq(struct pnv_php_slot *php_slot, int irq) | |||
779 | /* Allocate workqueue */ | 775 | /* Allocate workqueue */ |
780 | php_slot->wq = alloc_workqueue("pciehp-%s", 0, 0, php_slot->name); | 776 | php_slot->wq = alloc_workqueue("pciehp-%s", 0, 0, php_slot->name); |
781 | if (!php_slot->wq) { | 777 | if (!php_slot->wq) { |
782 | dev_warn(&pdev->dev, "Cannot alloc workqueue\n"); | 778 | pci_warn(pdev, "Cannot alloc workqueue\n"); |
783 | pnv_php_disable_irq(php_slot, true); | 779 | pnv_php_disable_irq(php_slot, true); |
784 | return; | 780 | return; |
785 | } | 781 | } |
@@ -803,7 +799,7 @@ static void pnv_php_init_irq(struct pnv_php_slot *php_slot, int irq) | |||
803 | php_slot->name, php_slot); | 799 | php_slot->name, php_slot); |
804 | if (ret) { | 800 | if (ret) { |
805 | pnv_php_disable_irq(php_slot, true); | 801 | pnv_php_disable_irq(php_slot, true); |
806 | dev_warn(&pdev->dev, "Error %d enabling IRQ %d\n", ret, irq); | 802 | pci_warn(pdev, "Error %d enabling IRQ %d\n", ret, irq); |
807 | return; | 803 | return; |
808 | } | 804 | } |
809 | 805 | ||
@@ -839,7 +835,7 @@ static void pnv_php_enable_irq(struct pnv_php_slot *php_slot) | |||
839 | 835 | ||
840 | ret = pci_enable_device(pdev); | 836 | ret = pci_enable_device(pdev); |
841 | if (ret) { | 837 | if (ret) { |
842 | dev_warn(&pdev->dev, "Error %d enabling device\n", ret); | 838 | pci_warn(pdev, "Error %d enabling device\n", ret); |
843 | return; | 839 | return; |
844 | } | 840 | } |
845 | 841 | ||