]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
xen/pci: make bus notifier handler return sane values
authorJan Beulich <JBeulich@novell.com>
Wed, 17 Aug 2011 08:32:32 +0000 (09:32 +0100)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Fri, 26 Aug 2011 16:10:18 +0000 (12:10 -0400)
Notifier functions are expected to return NOTIFY_* codes, not -E...
ones. In particular, since the respective hypercalls failing is not
fatal to the operation of the Dom0 kernel, it must be avoided to
return negative values here as those would make it appear as if
NOTIFY_STOP_MASK wa set, suppressing further notification calls to
other interested parties (which is also why we don't want to use
notifier_from_errno() here).

While at it, also notify the user of a failed hypercall.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
[v1: Added dev_err and the disable MSI/MSI-X call]
[v2: Removed the disable MSI/MSI-X call]
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
drivers/xen/pci.c

index cef4bafc07dc61d9eea2fe8f507c895ccef99f7b..02c402b1ed806c5eab68ee4018dc78c2793f194c 100644 (file)
@@ -96,13 +96,16 @@ static int xen_pci_notifier(struct notifier_block *nb,
                r = xen_remove_device(dev);
                break;
        default:
-               break;
+               return NOTIFY_DONE;
        }
-
-       return r;
+       if (r)
+               dev_err(dev, "Failed to %s - passthrough or MSI/MSI-X might fail!\n",
+                       action == BUS_NOTIFY_ADD_DEVICE ? "add" :
+                       (action == BUS_NOTIFY_DEL_DEVICE ? "delete" : "?"));
+       return NOTIFY_OK;
 }
 
-struct notifier_block device_nb = {
+static struct notifier_block device_nb = {
        .notifier_call = xen_pci_notifier,
 };