Remove mutex emulation

Using semaphores as mutexes was removed from the kernel in 4882720b267b.
Just use straight semaphores now.  'DECLARE_MUTEX()' -> 'DEFINE_SEMAPHORE()'
and 'init_MUTEX()' -> 'sema_init()'.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
LKML-Reference: <20100907125057.562399240@linutronix.de>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9464 a0bf4364-ded3-4de4-8d8a-66a801d63aff
This commit is contained in:
Shaun Ruffell 2010-11-04 16:40:29 +00:00
parent 3f9cb05bae
commit 37097411ea
8 changed files with 15 additions and 10 deletions

View File

@ -115,7 +115,7 @@ static void echo_can_process(struct dahdi_echocan_state *ec, short *isig, const
hpec_channel_update(pvt->hpec, isig, iref); hpec_channel_update(pvt->hpec, isig, iref);
} }
DECLARE_MUTEX(license_lock); DEFINE_SEMAPHORE(license_lock);
static int echo_can_create(struct dahdi_chan *chan, struct dahdi_echocanparams *ecp, static int echo_can_create(struct dahdi_chan *chan, struct dahdi_echocanparams *ecp,
struct dahdi_echocanparam *p, struct dahdi_echocan_state **ec) struct dahdi_echocanparam *p, struct dahdi_echocan_state **ec)

View File

@ -1107,7 +1107,7 @@ static void vb_stop_txrx_processors(struct voicebus *vb)
*/ */
void voicebus_stop(struct voicebus *vb) void voicebus_stop(struct voicebus *vb)
{ {
static DECLARE_MUTEX(stop); static DEFINE_SEMAPHORE(stop);
down(&stop); down(&stop);

View File

@ -3443,7 +3443,7 @@ wctc4xxp_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
return -EIO; return -EIO;
} }
init_MUTEX(&wc->chansem); sema_init(&wc->chansem, 1);
spin_lock_init(&wc->reglock); spin_lock_init(&wc->reglock);
spin_lock_init(&wc->cmd_list_lock); spin_lock_init(&wc->cmd_list_lock);
spin_lock_init(&wc->rx_list_lock); spin_lock_init(&wc->rx_list_lock);

View File

@ -207,7 +207,7 @@ static inline bool is_hx8(const struct wctdm *wc)
} }
struct wctdm *ifaces[WC_MAX_IFACES]; struct wctdm *ifaces[WC_MAX_IFACES];
DECLARE_MUTEX(ifacelock); DEFINE_SEMAPHORE(ifacelock);
static void wctdm_release(struct wctdm *wc); static void wctdm_release(struct wctdm *wc);
@ -4923,7 +4923,7 @@ __wctdm_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
/* This is to insure that the analog span is given lowest priority */ /* This is to insure that the analog span is given lowest priority */
wc->oldsync = -1; wc->oldsync = -1;
init_MUTEX(&wc->syncsem); sema_init(&wc->syncsem, 1);
INIT_LIST_HEAD(&wc->frame_list); INIT_LIST_HEAD(&wc->frame_list);
spin_lock_init(&wc->frame_list_lock); spin_lock_init(&wc->frame_list_lock);

View File

@ -2576,8 +2576,8 @@ static int b400m_probe(struct wctdm *wc, int modpos)
} }
spin_lock_init(&b4->reglock); spin_lock_init(&b4->reglock);
init_MUTEX(&b4->regsem); sema_init(&b4->regsem, 1);
init_MUTEX(&b4->fifosem); sema_init(&b4->fifosem, 1);
for (x = 0; x < 4; x++) { for (x = 0; x < 4; x++) {
fasthdlc_init(&b4->spans[x].rxhdlc, FASTHDLC_MODE_16); fasthdlc_init(&b4->spans[x].rxhdlc, FASTHDLC_MODE_16);

View File

@ -1165,7 +1165,7 @@ static void worker_init(xbus_t *xbus)
INIT_LIST_HEAD(&worker->card_list); INIT_LIST_HEAD(&worker->card_list);
init_waitqueue_head(&worker->wait_for_xpd_initialization); init_waitqueue_head(&worker->wait_for_xpd_initialization);
worker->wq = NULL; worker->wq = NULL;
init_MUTEX(&xbus->worker.running_initialization); sema_init(&xbus->worker.running_initialization, 1);
} }
/* /*

View File

@ -248,7 +248,7 @@ static unsigned bus_count = 0;
/* prevent races between open() and disconnect() */ /* prevent races between open() and disconnect() */
static DECLARE_MUTEX (disconnect_sem); static DEFINE_SEMAPHORE(disconnect_sem);
/* /*
* AsteriskNow kernel has backported the "lean" callback from 2.6.20 * AsteriskNow kernel has backported the "lean" callback from 2.6.20
@ -690,7 +690,7 @@ static int xusb_probe(struct usb_interface *interface, const struct usb_device_i
retval = -ENOMEM; retval = -ENOMEM;
goto probe_failed; goto probe_failed;
} }
init_MUTEX (&xusb->sem); sema_init(&xusb->sem, 1);
atomic_set(&xusb->pending_writes, 0); atomic_set(&xusb->pending_writes, 0);
atomic_set(&xusb->pending_reads, 0); atomic_set(&xusb->pending_reads, 0);
atomic_set(&xusb->pcm_tx_drops, 0); atomic_set(&xusb->pcm_tx_drops, 0);

View File

@ -1291,6 +1291,11 @@ wait_for_completion_timeout(struct completion *x, unsigned long timeout)
#define DEFINE_SPINLOCK(x) spinlock_t x = SPIN_LOCK_UNLOCKED #define DEFINE_SPINLOCK(x) spinlock_t x = SPIN_LOCK_UNLOCKED
#endif #endif
#ifndef DEFINE_SEMAPHORE
#define DEFINE_SEMAPHORE(name) \
struct semaphore name = __SEMAPHORE_INITIALIZER(name, 1)
#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