[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1265616354-7384-7-git-send-email-sheng@linux.intel.com>
Date: Mon, 8 Feb 2010 16:05:53 +0800
From: Sheng Yang <sheng@...ux.intel.com>
To: Jeremy Fitzhardinge <jeremy.fitzhardinge@...rix.com>
Cc: Keir Fraser <keir.fraser@...citrix.com>,
Ian Campbell <Ian.Campbell@...rix.com>,
xen-devel <xen-devel@...ts.xensource.com>,
linux-kernel@...r.kernel.org, Sheng Yang <sheng@...ux.intel.com>
Subject: [PATCH 6/7] xen: Unified checking for Xen of PV drivers to xenbus_register_frontend()
Signed-off-by: Sheng Yang <sheng@...ux.intel.com>
---
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists