Move test for DEFINE_SPINLOCK into include/dahdi/kernel.h

The check for DEFINE_SPINLOCK was spread throughout the source tree. If
not defined we can just define it in inlucde/dahdi/kernel.h.  Now
include/dahdi/kernel.h is the only place that references
SPIN_LOCK_UNLOCKED (which breaks lockdep checking if DEFINE_SPINLOCK is
otherwise defined in the kernel).

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Kinsey Moore <kmoore@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Review: https://reviewboard.asterisk.org/r/940/

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9411 a0bf4364-ded3-4de4-8d8a-66a801d63aff
This commit is contained in:
Shaun Ruffell 2010-09-24 22:44:53 +00:00
parent 41825e7c32
commit 283235686d
16 changed files with 13 additions and 42 deletions

View File

@ -375,13 +375,8 @@ struct dahdi_timer {
static LIST_HEAD(zaptimers); static LIST_HEAD(zaptimers);
#ifdef DEFINE_SPINLOCK
static DEFINE_SPINLOCK(zaptimerlock); static DEFINE_SPINLOCK(zaptimerlock);
static DEFINE_SPINLOCK(bigzaplock); static DEFINE_SPINLOCK(bigzaplock);
#else
static spinlock_t zaptimerlock = SPIN_LOCK_UNLOCKED;
static spinlock_t bigzaplock = SPIN_LOCK_UNLOCKED;
#endif
struct dahdi_zone { struct dahdi_zone {
atomic_t refcount; atomic_t refcount;

View File

@ -113,13 +113,8 @@ struct dahdi_dynamic {
struct list_head list; struct list_head list;
}; };
#ifdef DEFINE_SPINLOCK
static DEFINE_SPINLOCK(dspan_lock); static DEFINE_SPINLOCK(dspan_lock);
static DEFINE_SPINLOCK(driver_lock); static DEFINE_SPINLOCK(driver_lock);
#else
static spinlock_t dspan_lock = SPIN_LOCK_UNLOCKED;
static spinlock_t driver_lock = SPIN_LOCK_UNLOCKED;
#endif
static LIST_HEAD(dspan_list); static LIST_HEAD(dspan_list);
static LIST_HEAD(driver_list); static LIST_HEAD(driver_list);

View File

@ -42,11 +42,7 @@ struct ztdeth_header {
/* We take the raw message, put it in an ethernet frame, and add a /* We take the raw message, put it in an ethernet frame, and add a
two byte addressing header at the top for future use */ two byte addressing header at the top for future use */
#ifdef DEFINE_SPINLOCK
static DEFINE_SPINLOCK(zlock); static DEFINE_SPINLOCK(zlock);
#else
static spinlock_t zlock = SPIN_LOCK_UNLOCKED;
#endif
static struct sk_buff_head skbs; static struct sk_buff_head skbs;

View File

@ -129,11 +129,7 @@ struct ztdeth {
/** /**
* Lock for adding and removing items in ethmf_list * Lock for adding and removing items in ethmf_list
*/ */
#ifdef DEFINE_SPINLOCK
static DEFINE_SPINLOCK(ethmf_lock); static DEFINE_SPINLOCK(ethmf_lock);
#else
static spinlock_t ethmf_lock = SPIN_LOCK_UNLOCKED;
#endif
/** /**
* The active list of all running spans * The active list of all running spans
@ -401,7 +397,7 @@ static int ztdethmf_transmit(void *pvt, unsigned char *msg, int msglen)
unsigned char addr[ETH_ALEN]; unsigned char addr[ETH_ALEN];
int spans_ready = 0, index = 0; int spans_ready = 0, index = 0;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 10) #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 10)
static spinlock_t lock = SPIN_LOCK_UNLOCKED; static DEFINE_SPINLOCK(lock);
unsigned long flags; unsigned long flags;
#endif #endif

View File

@ -57,11 +57,7 @@
#include <dahdi/kernel.h> #include <dahdi/kernel.h>
#ifdef DEFINE_SPINLOCK
static DEFINE_SPINLOCK(zlock); static DEFINE_SPINLOCK(zlock);
#else
static spinlock_t zlock = SPIN_LOCK_UNLOCKED;
#endif
static struct ztdlocal { static struct ztdlocal {
unsigned short key; unsigned short key;

View File

@ -46,7 +46,7 @@ static LIST_HEAD(registration_list);
* is used as a simplistic way to spread the load amongst the different hardware * is used as a simplistic way to spread the load amongst the different hardware
* transcoders in the system. */ * transcoders in the system. */
static LIST_HEAD(active_list); static LIST_HEAD(active_list);
static spinlock_t translock = SPIN_LOCK_UNLOCKED; static DEFINE_SPINLOCK(translock);
EXPORT_SYMBOL(dahdi_transcoder_register); EXPORT_SYMBOL(dahdi_transcoder_register);
EXPORT_SYMBOL(dahdi_transcoder_unregister); EXPORT_SYMBOL(dahdi_transcoder_unregister);

View File

@ -1129,11 +1129,7 @@ static void tor2_tasklet(unsigned long data)
static int syncsrc = 0; static int syncsrc = 0;
static int syncnum = 0 /* -1 */; static int syncnum = 0 /* -1 */;
static int syncspan = 0; static int syncspan = 0;
#ifdef DEFINE_SPINLOCK
static DEFINE_SPINLOCK(synclock); static DEFINE_SPINLOCK(synclock);
#else
static spinlock_t synclock = SPIN_LOCK_UNLOCKED;
#endif
static int tor2_findsync(struct tor2 *tor) static int tor2_findsync(struct tor2 *tor)
{ {

View File

@ -2225,11 +2225,7 @@ static void t4_serial_setup(struct t4 *wc, int unit)
static int syncsrc = 0; static int syncsrc = 0;
static int syncnum = 0 /* -1 */; static int syncnum = 0 /* -1 */;
static int syncspan = 0; static int syncspan = 0;
#ifdef DEFINE_SPINLOCK
static DEFINE_SPINLOCK(synclock); static DEFINE_SPINLOCK(synclock);
#else
static spinlock_t synclock = SPIN_LOCK_UNLOCKED;
#endif
static void __t4_set_rclk_src(struct t4 *wc, int span) static void __t4_set_rclk_src(struct t4 *wc, int span)
{ {

View File

@ -87,7 +87,6 @@ static const struct dahdi_echocan_ops vpm150m_ec_ops = {
}; };
static struct t1 *ifaces[WC_MAX_IFACES]; static struct t1 *ifaces[WC_MAX_IFACES];
spinlock_t ifacelock = SPIN_LOCK_UNLOCKED;
struct t1_desc { struct t1_desc {
const char *name; const char *name;

View File

@ -77,8 +77,6 @@
#define TYPE_T1 1 #define TYPE_T1 1
#define TYPE_E1 2 #define TYPE_E1 2
extern spinlock_t ifacelock;
struct command { struct command {
struct list_head node; struct list_head node;
struct completion complete; struct completion complete;

View File

@ -68,7 +68,7 @@ struct counter {
static xbus_t *global_xbus; static xbus_t *global_xbus;
static bool tx_ready = 1; static bool tx_ready = 1;
static spinlock_t tx_ready_lock = SPIN_LOCK_UNLOCKED; static DEFINE_SPINLOCK(tx_ready_lock);
static struct xframe_queue txpool; static struct xframe_queue txpool;
static unsigned int pcm_in_pool_count; static unsigned int pcm_in_pool_count;
static bool disconnecting; static bool disconnecting;

View File

@ -36,7 +36,7 @@ static int parport_toggles[8]; /* 8 bit flip-flop */
void flip_parport_bit(unsigned char bitnum) void flip_parport_bit(unsigned char bitnum)
{ {
static unsigned char last_value; static unsigned char last_value;
spinlock_t lock = SPIN_LOCK_UNLOCKED; DEFINE_SPINLOCK(lock);
unsigned long flags; unsigned long flags;
unsigned char mask; unsigned char mask;
unsigned char value; unsigned char value;

View File

@ -78,7 +78,7 @@ static void transport_init(xbus_t *xbus, struct xbus_ops *ops, ushort max_send_s
static void transport_destroy(xbus_t *xbus); static void transport_destroy(xbus_t *xbus);
/* Data structures */ /* Data structures */
static spinlock_t xbuses_lock = SPIN_LOCK_UNLOCKED; static DEFINE_SPINLOCK(xbuses_lock);
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
static struct proc_dir_entry *proc_xbuses = NULL; static struct proc_dir_entry *proc_xbuses = NULL;
#endif #endif
@ -405,7 +405,7 @@ xpacket_t *xframe_next_packet(xframe_t *frm, int len)
return (xpacket_t *)(frm->packets + newlen - len); return (xpacket_t *)(frm->packets + newlen - len);
} }
static spinlock_t serialize_dump_xframe = SPIN_LOCK_UNLOCKED; static DEFINE_SPINLOCK(serialize_dump_xframe);
static void do_hexdump(const char msg[], byte *data, uint16_t len) static void do_hexdump(const char msg[], byte *data, uint16_t len)
{ {

View File

@ -55,8 +55,8 @@ static struct xpp_ticker dahdi_ticker;
* I.e: one of our AB or dahdi_ticker * I.e: one of our AB or dahdi_ticker
*/ */
static struct xpp_ticker *ref_ticker = NULL; static struct xpp_ticker *ref_ticker = NULL;
static spinlock_t ref_ticker_lock = SPIN_LOCK_UNLOCKED; static DEFINE_SPINLOCK(ref_ticker_lock);
static spinlock_t elect_syncer_lock = SPIN_LOCK_UNLOCKED; static DEFINE_SPINLOCK(elect_syncer_lock);
static bool force_dahdi_sync = 0; /* from /sys/bus/astribanks/drivers/xppdrv/sync */ static bool force_dahdi_sync = 0; /* from /sys/bus/astribanks/drivers/xppdrv/sync */
static xbus_t *global_ticker; static xbus_t *global_ticker;
static struct xpp_ticker global_ticks_series; static struct xpp_ticker global_ticks_series;

View File

@ -242,7 +242,7 @@ struct xusb {
}; };
static spinlock_t xusb_lock = SPIN_LOCK_UNLOCKED; static DEFINE_SPINLOCK(xusb_lock);
static xusb_t *xusb_array[MAX_BUSES] = {}; static xusb_t *xusb_array[MAX_BUSES] = {};
static unsigned bus_count = 0; static unsigned bus_count = 0;

View File

@ -1262,6 +1262,10 @@ wait_for_completion_timeout(struct completion *x, unsigned long timeout)
#endif /* 2.6.26 */ #endif /* 2.6.26 */
#endif /* 2.6.31 */ #endif /* 2.6.31 */
#ifndef DEFINE_SPINLOCK
#define DEFINE_SPINLOCK(x) spinlock_t x = SPIN_LOCK_UNLOCKED
#endif
#ifndef DMA_BIT_MASK #ifndef DMA_BIT_MASK
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1)) #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
#endif #endif