Commit 323c2a26 authored by Frederic Barrat's avatar Frederic Barrat Committed by Michael Ellerman

pci/hotplug/pnv-php: Improve error msg on power state change failure

When changing the slot state, if opal hits an error and tells as such
in the asynchronous reply, the warning "Wrong msg" is logged, which is
rather confusing. Instead we can reuse the better message which is
already used when we couldn't submit the asynchronous opal request
initially.
Reviewed-by: default avatarAlastair D'Silva <alastair@d-silva.org>
Reviewed-by: default avatarAndrew Donnellan <ajd@linux.ibm.com>
Signed-off-by: default avatarFrederic Barrat <fbarrat@linux.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20191121134918.7155-8-fbarrat@linux.ibm.com
parent 658ab186
...@@ -336,18 +336,19 @@ int pnv_php_set_slot_power_state(struct hotplug_slot *slot, ...@@ -336,18 +336,19 @@ int pnv_php_set_slot_power_state(struct hotplug_slot *slot,
ret = pnv_pci_set_power_state(php_slot->id, state, &msg); ret = pnv_pci_set_power_state(php_slot->id, state, &msg);
if (ret > 0) { if (ret > 0) {
if (be64_to_cpu(msg.params[1]) != php_slot->dn->phandle || if (be64_to_cpu(msg.params[1]) != php_slot->dn->phandle ||
be64_to_cpu(msg.params[2]) != state || be64_to_cpu(msg.params[2]) != state) {
be64_to_cpu(msg.params[3]) != OPAL_SUCCESS) {
pci_warn(php_slot->pdev, "Wrong msg (%lld, %lld, %lld)\n", pci_warn(php_slot->pdev, "Wrong msg (%lld, %lld, %lld)\n",
be64_to_cpu(msg.params[1]), be64_to_cpu(msg.params[1]),
be64_to_cpu(msg.params[2]), be64_to_cpu(msg.params[2]),
be64_to_cpu(msg.params[3])); be64_to_cpu(msg.params[3]));
return -ENOMSG; return -ENOMSG;
} }
if (be64_to_cpu(msg.params[3]) != OPAL_SUCCESS) {
ret = -ENODEV;
goto error;
}
} else if (ret < 0) { } else if (ret < 0) {
pci_warn(php_slot->pdev, "Error %d powering %s\n", goto error;
ret, (state == OPAL_PCI_SLOT_POWER_ON) ? "on" : "off");
return ret;
} }
if (state == OPAL_PCI_SLOT_POWER_OFF || state == OPAL_PCI_SLOT_OFFLINE) if (state == OPAL_PCI_SLOT_POWER_OFF || state == OPAL_PCI_SLOT_OFFLINE)
...@@ -356,6 +357,11 @@ int pnv_php_set_slot_power_state(struct hotplug_slot *slot, ...@@ -356,6 +357,11 @@ int pnv_php_set_slot_power_state(struct hotplug_slot *slot,
ret = pnv_php_add_devtree(php_slot); ret = pnv_php_add_devtree(php_slot);
return ret; return ret;
error:
pci_warn(php_slot->pdev, "Error %d powering %s\n",
ret, (state == OPAL_PCI_SLOT_POWER_ON) ? "on" : "off");
return ret;
} }
EXPORT_SYMBOL_GPL(pnv_php_set_slot_power_state); EXPORT_SYMBOL_GPL(pnv_php_set_slot_power_state);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment