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 6/7] xen: Unified checking for Xen of PV drivers to x

To: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>, Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>, Ian Pratt <Ian.Pratt@xxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH 6/7] xen: Unified checking for Xen of PV drivers to xenbus_register_frontend()
From: Sheng Yang <sheng@xxxxxxxxxxxxxxx>
Date: Mon, 1 Mar 2010 17:38:34 +0800
Cc: linux-kernel@xxxxxxxxxxxxxxx, xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>, Ian Campbell <Ian.Campbell@xxxxxxxxxx>, Sheng Yang <sheng@xxxxxxxxxxxxxxx>, Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Delivery-date: Mon, 01 Mar 2010 01:42:33 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1267436315-24486-1-git-send-email-sheng@xxxxxxxxxxxxxxx>
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>
References: <1267436315-24486-1-git-send-email-sheng@xxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Signed-off-by: Sheng Yang <sheng@xxxxxxxxxxxxxxx>
---
 drivers/block/xen-blkfront.c |    3 ---
 drivers/input/xen-kbdfront.c |    3 ---
 drivers/net/xen-netfront.c   |    5 -----
 drivers/video/xen-fbfront.c  |    3 ---
 include/xen/xenbus.h         |    3 +++
 5 files changed, 3 insertions(+), 14 deletions(-)

diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index 05a31e5..d6465c1 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -1068,9 +1068,6 @@ static struct xenbus_driver blkfront = {
 
 static int __init xlblk_init(void)
 {
-       if (!xen_domain())
-               return -ENODEV;
-
        if (register_blkdev(XENVBD_MAJOR, DEV_NAME)) {
                printk(KERN_WARNING "xen_blk: can't get major %d with name 
%s\n",
                       XENVBD_MAJOR, DEV_NAME);
diff --git a/drivers/input/xen-kbdfront.c b/drivers/input/xen-kbdfront.c
index c721c0a..febffc3 100644
--- a/drivers/input/xen-kbdfront.c
+++ b/drivers/input/xen-kbdfront.c
@@ -338,9 +338,6 @@ static struct xenbus_driver xenkbd_driver = {
 
 static int __init xenkbd_init(void)
 {
-       if (!xen_domain())
-               return -ENODEV;
-
        /* Nothing to do if running in dom0. */
        if (xen_initial_domain())
                return -ENODEV;
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index a869b45..d89fd0b 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -1804,14 +1804,9 @@ static struct xenbus_driver netfront_driver = {
 
 static int __init netif_init(void)
 {
-       if (!xen_domain())
-               return -ENODEV;
-
        if (xen_initial_domain())
                return 0;
 
-       printk(KERN_INFO "Initialising Xen virtual ethernet driver.\n");
-
        return xenbus_register_frontend(&netfront_driver);
 }
 module_init(netif_init);
diff --git a/drivers/video/xen-fbfront.c b/drivers/video/xen-fbfront.c
index 603598f..daff72f 100644
--- a/drivers/video/xen-fbfront.c
+++ b/drivers/video/xen-fbfront.c
@@ -683,9 +683,6 @@ static struct xenbus_driver xenfb_driver = {
 
 static int __init xenfb_init(void)
 {
-       if (!xen_domain())
-               return -ENODEV;
-
        /* Nothing to do if running in dom0. */
        if (xen_initial_domain())
                return -ENODEV;
diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h
index b9763ba..9f68cf5 100644
--- a/include/xen/xenbus.h
+++ b/include/xen/xenbus.h
@@ -43,6 +43,7 @@
 #include <xen/interface/grant_table.h>
 #include <xen/interface/io/xenbus.h>
 #include <xen/interface/io/xs_wire.h>
+#include <xen/xen.h>
 
 /* Register callback to watch this node. */
 struct xenbus_watch
@@ -112,6 +113,8 @@ static inline int __must_check
 xenbus_register_frontend(struct xenbus_driver *drv)
 {
        WARN_ON(drv->owner != THIS_MODULE);
+       if (!xen_domain())
+               return -ENODEV;
        return __xenbus_register_frontend(drv, THIS_MODULE, KBUILD_MODNAME);
 }
 
-- 
1.5.4.5


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

<Prev in Thread] Current Thread [Next in Thread>