Jan Beulich
2012-Mar-09  10:13 UTC
[PATCH] linux-2.6.18: consolidate GRANT_INVALID_REF definitions
No need for each frontend to define this for itself, the more that this
really is a property of the gnttab.c code.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/drivers/char/tpm/tpm_xen.c
+++ b/drivers/char/tpm/tpm_xen.c
@@ -109,8 +109,6 @@ void __exit tpmif_exit(void);
 #define WPRINTK(fmt, args...) \
     printk(KERN_WARNING "xen_tpm_fr: " fmt, ##args)
 
-#define GRANT_INVALID_REF	0
-
 
 static inline int
 tx_buffer_copy(struct tx_buffer *txb, const u8 *src, int len,
--- a/drivers/xen/blkfront/blkfront.c
+++ b/drivers/xen/blkfront/blkfront.c
@@ -60,7 +60,6 @@
 
 #define MAXIMUM_OUTSTANDING_BLOCK_REQS \
     (BLKIF_MAX_SEGMENTS_PER_REQUEST * BLK_RING_SIZE)
-#define GRANT_INVALID_REF	0
 
 static void connect(struct blkfront_info *);
 static void blkfront_closing(struct blkfront_info *);
--- a/drivers/xen/netfront/netfront.c
+++ b/drivers/xen/netfront/netfront.c
@@ -147,8 +147,6 @@ static inline int netif_needs_gso(struct
 #define ethtool_op_set_tso(dev, data)	(-ENOSYS)
 #endif
 
-#define GRANT_INVALID_REF	0
-
 struct netfront_rx_info {
 	struct netif_rx_response rx;
 	struct netif_extra_info extras[XEN_NETIF_EXTRA_TYPE_MAX - 1];
--- a/drivers/xen/pcifront/xenbus.c
+++ b/drivers/xen/pcifront/xenbus.c
@@ -15,7 +15,6 @@
 #define __init_refok
 #endif
 
-#define INVALID_GRANT_REF (0)
 #define INVALID_EVTCHN    (-1)
 
 static struct pcifront_device *alloc_pdev(struct xenbus_device *xdev)
@@ -47,7 +46,7 @@ static struct pcifront_device *alloc_pde
 	spin_lock_init(&pdev->sh_info_lock);
 
 	pdev->evtchn = INVALID_EVTCHN;
-	pdev->gnt_ref = INVALID_GRANT_REF;
+	pdev->gnt_ref = GRANT_INVALID_REF;
 	pdev->irq = -1;
 
 	INIT_WORK(&pdev->op_work, pcifront_do_aer, pdev);
@@ -73,7 +72,7 @@ static void free_pdev(struct pcifront_de
 	if (pdev->evtchn != INVALID_EVTCHN)
 		xenbus_free_evtchn(pdev->xdev, pdev->evtchn);
 
-	if (pdev->gnt_ref != INVALID_GRANT_REF)
+	if (pdev->gnt_ref != GRANT_INVALID_REF)
 		gnttab_end_foreign_access(pdev->gnt_ref,
 					  (unsigned long)pdev->sh_info);
 	else
--- a/drivers/xen/scsifront/common.h
+++ b/drivers/xen/scsifront/common.h
@@ -61,7 +61,6 @@
 #include <xen/platform-compat.h>
 #endif
 
-#define GRANT_INVALID_REF	0
 #define VSCSI_IN_ABORT		1
 #define VSCSI_IN_RESET		2
 
--- a/drivers/xen/usbfront/xenbus.c
+++ b/drivers/xen/usbfront/xenbus.c
@@ -45,8 +45,6 @@
 
 #include "usbfront.h"
 
-#define GRANT_INVALID_REF 0
-
 static void destroy_rings(struct usbfront_info *info)
 {
 	if (info->irq)
--- a/include/xen/gnttab.h
+++ b/include/xen/gnttab.h
@@ -44,6 +44,8 @@
 #include <xen/interface/grant_table.h>
 #include <xen/features.h>
 
+#define GRANT_INVALID_REF	0
+
 struct gnttab_free_callback {
 	struct gnttab_free_callback *next;
 	void (*fn)(void *);
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel