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 1/3] [PATCH] use DEFINE_SPINLOCK in drivers/xen

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [patch 1/3] [PATCH] use DEFINE_SPINLOCK in drivers/xen
From: Chris Wright <chrisw@xxxxxxxxxxxx>
Date: Wed, 24 May 2006 00:00:01 -0700
Cc: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>
Delivery-date: Wed, 24 May 2006 03:23:00 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20060524102445.372306000@xxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Conforming to typical CodingStyle.

Signed-off-by: Chris Wright <chrisw@xxxxxxxxxxxx>
---
 linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c |    2 +-
 linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c |    2 +-
 linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c    |    2 +-
 linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c   |    2 +-
 linux-2.6-xen-sparse/drivers/xen/console/console.c |    2 +-
 linux-2.6-xen-sparse/drivers/xen/core/evtchn.c     |    4 +---
 linux-2.6-xen-sparse/drivers/xen/core/gnttab.c     |    2 +-
 linux-2.6-xen-sparse/drivers/xen/netback/netback.c |    4 ++--
 8 files changed, 9 insertions(+), 11 deletions(-)

--- xen-unstable.orig/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c
+++ xen-unstable/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c
@@ -67,7 +67,7 @@ static DECLARE_MUTEX(balloon_mutex);
  * Also protects non-atomic updates of current_pages and driver_pages, and
  * balloon lists.
  */
-spinlock_t balloon_lock = SPIN_LOCK_UNLOCKED;
+DEFINE_SPINLOCK(balloon_lock);
 
 /* We aim for 'current allocation' == 'target allocation'. */
 static unsigned long current_pages;
--- xen-unstable.orig/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c
+++ xen-unstable/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c
@@ -82,7 +82,7 @@ typedef struct {
 
 static pending_req_t *pending_reqs;
 static struct list_head pending_free;
-static spinlock_t pending_free_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(pending_free_lock);
 static DECLARE_WAIT_QUEUE_HEAD(pending_free_wq);
 
 #define BLKBACK_INVALID_HANDLE (~0)
--- xen-unstable.orig/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c
+++ xen-unstable/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c
@@ -93,7 +93,7 @@ static struct block_device_operations xl
        .ioctl  = blkif_ioctl,
 };
 
-spinlock_t blkif_io_lock = SPIN_LOCK_UNLOCKED;
+DEFINE_SPINLOCK(blkif_io_lock);
 
 static struct xlbd_major_info *
 xlbd_alloc_major_info(int major, int minor, int index)
--- xen-unstable.orig/linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c
+++ xen-unstable/linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c
@@ -138,7 +138,7 @@ typedef struct {
  */
 static pending_req_t pending_reqs[MAX_PENDING_REQS];
 static unsigned char pending_ring[MAX_PENDING_REQS];
-static spinlock_t pend_prod_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(pend_prod_lock);
 /* NB. We use a different index type to differentiate from shared blk rings. */
 typedef unsigned int PEND_RING_IDX;
 #define MASK_PEND_IDX(_i) ((_i)&(MAX_PENDING_REQS-1))
--- xen-unstable.orig/linux-2.6-xen-sparse/drivers/xen/console/console.c
+++ xen-unstable/linux-2.6-xen-sparse/drivers/xen/console/console.c
@@ -124,7 +124,7 @@ static int __init xencons_bufsz_setup(ch
 __setup("xencons_bufsz=", xencons_bufsz_setup);
 
 /* This lock protects accesses to the common transmit buffer. */
-static spinlock_t xencons_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(xencons_lock);
 
 /* Common transmit-kick routine. */
 static void __xencons_tx_flush(void);
--- xen-unstable.orig/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c
+++ xen-unstable/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c
@@ -81,7 +81,7 @@ EXPORT_SYMBOL_GPL(gnttab_grant_foreign_t
 static grant_ref_t gnttab_list[NR_GRANT_ENTRIES];
 static int gnttab_free_count;
 static grant_ref_t gnttab_free_head;
-static spinlock_t gnttab_list_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(gnttab_list_lock);
 
 static grant_entry_t *shared = NULL;
 
--- xen-unstable.orig/linux-2.6-xen-sparse/drivers/xen/netback/netback.c
+++ xen-unstable/linux-2.6-xen-sparse/drivers/xen/netback/netback.c
@@ -99,7 +99,7 @@ static spinlock_t net_schedule_list_lock
 #define MAX_MFN_ALLOC 64
 static unsigned long mfn_list[MAX_MFN_ALLOC];
 static unsigned int alloc_index = 0;
-static spinlock_t mfn_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(mfn_lock);
 
 static unsigned long alloc_mfn(void)
 {
@@ -691,7 +691,7 @@ static void net_tx_action(unsigned long 
 
 static void netif_idx_release(u16 pending_idx)
 {
-       static spinlock_t _lock = SPIN_LOCK_UNLOCKED;
+       static DEFINE_SPINLOCK(_lock);
        unsigned long flags;
 
        spin_lock_irqsave(&_lock, flags);
--- xen-unstable.orig/linux-2.6-xen-sparse/drivers/xen/core/evtchn.c
+++ xen-unstable/linux-2.6-xen-sparse/drivers/xen/core/evtchn.c
@@ -51,7 +51,7 @@
  * This lock protects updates to the following mapping and reference-count
  * arrays. The lock does not need to be acquired to read the mapping tables.
  */
-static spinlock_t irq_mapping_update_lock;
+static DEFINE_SPINLOCK(irq_mapping_update_lock);
 
 /* IRQ <-> event-channel mappings. */
 static int evtchn_to_irq[NR_EVENT_CHANNELS];
@@ -815,8 +815,6 @@ void __init xen_init_IRQ(void)
        int i;
        int cpu;
 
-       spin_lock_init(&irq_mapping_update_lock);
-
        init_evtchn_cpu_bindings();
 
        /* No VIRQ or IPI bindings. */

--

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