diff --git a/drivers/dahdi/hpec/dahdi_echocan_hpec.c b/drivers/dahdi/hpec/dahdi_echocan_hpec.c index b6d49df..2f6424e 100644 --- a/drivers/dahdi/hpec/dahdi_echocan_hpec.c +++ b/drivers/dahdi/hpec/dahdi_echocan_hpec.c @@ -115,7 +115,7 @@ static void echo_can_process(struct dahdi_echocan_state *ec, short *isig, const 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, struct dahdi_echocanparam *p, struct dahdi_echocan_state **ec) diff --git a/drivers/dahdi/voicebus/voicebus.c b/drivers/dahdi/voicebus/voicebus.c index 6fde52b..86883e6 100644 --- a/drivers/dahdi/voicebus/voicebus.c +++ b/drivers/dahdi/voicebus/voicebus.c @@ -1107,7 +1107,7 @@ static void vb_stop_txrx_processors(struct voicebus *vb) */ void voicebus_stop(struct voicebus *vb) { - static DECLARE_MUTEX(stop); + static DEFINE_SEMAPHORE(stop); down(&stop); diff --git a/drivers/dahdi/wctc4xxp/base.c b/drivers/dahdi/wctc4xxp/base.c index f8b6ecf..7848444 100644 --- a/drivers/dahdi/wctc4xxp/base.c +++ b/drivers/dahdi/wctc4xxp/base.c @@ -3443,7 +3443,7 @@ wctc4xxp_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) return -EIO; } - init_MUTEX(&wc->chansem); + sema_init(&wc->chansem, 1); spin_lock_init(&wc->reglock); spin_lock_init(&wc->cmd_list_lock); spin_lock_init(&wc->rx_list_lock); diff --git a/drivers/dahdi/wctdm24xxp/base.c b/drivers/dahdi/wctdm24xxp/base.c index 4fc2a42..4a287fc 100644 --- a/drivers/dahdi/wctdm24xxp/base.c +++ b/drivers/dahdi/wctdm24xxp/base.c @@ -207,7 +207,7 @@ static inline bool is_hx8(const struct wctdm *wc) } struct wctdm *ifaces[WC_MAX_IFACES]; -DECLARE_MUTEX(ifacelock); +DEFINE_SEMAPHORE(ifacelock); 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 */ wc->oldsync = -1; - init_MUTEX(&wc->syncsem); + sema_init(&wc->syncsem, 1); INIT_LIST_HEAD(&wc->frame_list); spin_lock_init(&wc->frame_list_lock); diff --git a/drivers/dahdi/wctdm24xxp/xhfc.c b/drivers/dahdi/wctdm24xxp/xhfc.c index 00be877..ee227e0 100644 --- a/drivers/dahdi/wctdm24xxp/xhfc.c +++ b/drivers/dahdi/wctdm24xxp/xhfc.c @@ -2576,8 +2576,8 @@ static int b400m_probe(struct wctdm *wc, int modpos) } spin_lock_init(&b4->reglock); - init_MUTEX(&b4->regsem); - init_MUTEX(&b4->fifosem); + sema_init(&b4->regsem, 1); + sema_init(&b4->fifosem, 1); for (x = 0; x < 4; x++) { fasthdlc_init(&b4->spans[x].rxhdlc, FASTHDLC_MODE_16); diff --git a/drivers/dahdi/xpp/xbus-core.c b/drivers/dahdi/xpp/xbus-core.c index 9223891..ebc7cba 100644 --- a/drivers/dahdi/xpp/xbus-core.c +++ b/drivers/dahdi/xpp/xbus-core.c @@ -1165,7 +1165,7 @@ static void worker_init(xbus_t *xbus) INIT_LIST_HEAD(&worker->card_list); init_waitqueue_head(&worker->wait_for_xpd_initialization); worker->wq = NULL; - init_MUTEX(&xbus->worker.running_initialization); + sema_init(&xbus->worker.running_initialization, 1); } /* diff --git a/drivers/dahdi/xpp/xpp_usb.c b/drivers/dahdi/xpp/xpp_usb.c index edc499b..7f370ee 100644 --- a/drivers/dahdi/xpp/xpp_usb.c +++ b/drivers/dahdi/xpp/xpp_usb.c @@ -248,7 +248,7 @@ static unsigned bus_count = 0; /* 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 @@ -690,7 +690,7 @@ static int xusb_probe(struct usb_interface *interface, const struct usb_device_i retval = -ENOMEM; goto probe_failed; } - init_MUTEX (&xusb->sem); + sema_init(&xusb->sem, 1); atomic_set(&xusb->pending_writes, 0); atomic_set(&xusb->pending_reads, 0); atomic_set(&xusb->pcm_tx_drops, 0); diff --git a/include/dahdi/kernel.h b/include/dahdi/kernel.h index cf9ee3c..e784b34 100644 --- a/include/dahdi/kernel.h +++ b/include/dahdi/kernel.h @@ -1291,6 +1291,11 @@ wait_for_completion_timeout(struct completion *x, unsigned long timeout) #define DEFINE_SPINLOCK(x) spinlock_t x = SPIN_LOCK_UNLOCKED #endif +#ifndef DEFINE_SEMAPHORE +#define DEFINE_SEMAPHORE(name) \ + struct semaphore name = __SEMAPHORE_INITIALIZER(name, 1) +#endif + #ifndef DMA_BIT_MASK #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1)) #endif