WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] xen/pci: make bus notifier handler return sane value

To: "Konrad Rzeszutek Wilk" <konrad.wilk@xxxxxxxxxx>
Subject: [Xen-devel] [PATCH] xen/pci: make bus notifier handler return sane values
From: "Jan Beulich" <JBeulich@xxxxxxxxxx>
Date: Wed, 17 Aug 2011 09:32:32 +0100
Cc: Jeremy Fitzhardinge <jeremy@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Wed, 17 Aug 2011 01:32:34 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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).

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

---
 drivers/xen/pci.c |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

--- 3.1-rc2/drivers/xen/pci.c
+++ 3.1-rc2-xen-pci-bus-notifier/drivers/xen/pci.c
@@ -86,23 +86,22 @@ static int xen_pci_notifier(struct notif
                            unsigned long action, void *data)
 {
        struct device *dev = data;
-       int r = 0;
 
        switch (action) {
        case BUS_NOTIFY_ADD_DEVICE:
-               r = xen_add_device(dev);
+               xen_add_device(dev);
                break;
        case BUS_NOTIFY_DEL_DEVICE:
-               r = xen_remove_device(dev);
+               xen_remove_device(dev);
                break;
        default:
-               break;
+               return NOTIFY_DONE;
        }
 
-       return r;
+       return NOTIFY_OK;
 }
 
-struct notifier_block device_nb = {
+static struct notifier_block device_nb = {
        .notifier_call = xen_pci_notifier,
 };
 



Attachment: linux-3.1-rc2-xen-pci-bus-notifier.patch
Description: Text document

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel