xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Sheng Yang <sheng@linux.intel.com>
To: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Cc: Keir Fraser <keir.fraser@eu.citrix.com>,
	Ian Campbell <Ian.Campbell@citrix.com>,
	xen-devel <xen-devel@lists.xensource.com>,
	linux-kernel@vger.kernel.org, Sheng Yang <sheng@linux.intel.com>
Subject: [PATCH 6/7] xen: Unified checking for Xen of PV drivers to xenbus_register_frontend()
Date: Mon,  8 Feb 2010 16:05:53 +0800	[thread overview]
Message-ID: <1265616354-7384-7-git-send-email-sheng@linux.intel.com> (raw)
In-Reply-To: <1265616354-7384-1-git-send-email-sheng@linux.intel.com>


Signed-off-by: Sheng Yang <sheng@linux.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

  parent reply	other threads:[~2010-02-08  8:05 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-08  8:05 [PATCH 0/7][v3] PV featured HVM(Hybrid) for Xen Sheng Yang
2010-02-08  8:05 ` [PATCH 1/7] xen: add support for hvm_op Sheng Yang
2010-02-08  8:05 ` [PATCH 2/7] xen: Import cpuid.h from Xen Sheng Yang
2010-02-08  8:05 ` [PATCH 3/7] xen/hvm: Xen PV featured HVM initialization Sheng Yang
2010-02-08  8:05 ` [PATCH 4/7] xen: The entrance for PV featured HVM Sheng Yang
2010-02-08  8:05 ` [PATCH 5/7] xen: Make event channel work with " Sheng Yang
2010-02-09 11:52   ` Ian Campbell
2010-02-09 12:46     ` Sheng Yang
2010-02-09 14:02       ` Ian Campbell
2010-02-09 17:17         ` Sheng Yang
2010-02-09 18:01           ` [Xen-devel] " Stefano Stabellini
2010-02-11  9:59             ` Sheng Yang
2010-02-12 11:59               ` Re: [PATCH 5/7] xen: Make event channel work with PV featured HVe Stefano Stabellini
2010-02-10  3:16         ` Re: [PATCH 5/7] xen: Make event channel work with PV featured HVM Nakajima, Jun
2010-02-10 10:20           ` Ian Campbell
2010-02-11  9:59             ` [Xen-devel] " Sheng Yang
2010-02-09 12:51   ` Stefano Stabellini
2010-02-08  8:05 ` Sheng Yang [this message]
2010-02-08  8:05 ` [PATCH 7/7] xen: Enable grant table and xenbus Sheng Yang
  -- strict thread matches above, loose matches on Subject: below --
2010-03-01  9:38 [PATCH 0/7][v4] PV extension of HVM (Hybrid) for Xen Sheng Yang
2010-03-01  9:38 ` [PATCH 6/7] xen: Unified checking for Xen of PV drivers to xenbus_register_frontend() Sheng Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1265616354-7384-7-git-send-email-sheng@linux.intel.com \
    --to=sheng@linux.intel.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=jeremy.fitzhardinge@citrix.com \
    --cc=keir.fraser@eu.citrix.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).