Skip to content

Commit 323c2a2

Browse files
fbarratmpe
authored andcommitted
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: Alastair D'Silva <alastair@d-silva.org> Reviewed-by: Andrew Donnellan <ajd@linux.ibm.com> Signed-off-by: Frederic Barrat <fbarrat@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20191121134918.7155-8-fbarrat@linux.ibm.com
1 parent 658ab18 commit 323c2a2

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

‎drivers/pci/hotplug/pnv_php.c‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -336,18 +336,19 @@ int pnv_php_set_slot_power_state(struct hotplug_slot *slot,
336336
ret = pnv_pci_set_power_state(php_slot->id, state, &msg);
337337
if (ret > 0) {
338338
if (be64_to_cpu(msg.params[1]) != php_slot->dn->phandle ||
339-
be64_to_cpu(msg.params[2]) != state ||
340-
be64_to_cpu(msg.params[3]) != OPAL_SUCCESS) {
339+
be64_to_cpu(msg.params[2]) != state) {
341340
pci_warn(php_slot->pdev, "Wrong msg (%lld, %lld, %lld)\n",
342341
be64_to_cpu(msg.params[1]),
343342
be64_to_cpu(msg.params[2]),
344343
be64_to_cpu(msg.params[3]));
345344
return -ENOMSG;
346345
}
346+
if (be64_to_cpu(msg.params[3]) != OPAL_SUCCESS) {
347+
ret = -ENODEV;
348+
goto error;
349+
}
347350
} else if (ret < 0) {
348-
pci_warn(php_slot->pdev, "Error %d powering %s\n",
349-
ret, (state == OPAL_PCI_SLOT_POWER_ON) ? "on" : "off");
350-
return ret;
351+
goto error;
351352
}
352353

353354
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,
356357
ret = pnv_php_add_devtree(php_slot);
357358

358359
return ret;
360+
361+
error:
362+
pci_warn(php_slot->pdev, "Error %d powering %s\n",
363+
ret, (state == OPAL_PCI_SLOT_POWER_ON) ? "on" : "off");
364+
return ret;
359365
}
360366
EXPORT_SYMBOL_GPL(pnv_php_set_slot_power_state);
361367

0 commit comments

Comments
 (0)