From ae158b038ae61289b0bfcb0b744610e89f80ee2a Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Fri, 26 Feb 2010 18:51:49 +0000 Subject: dahdi_dynamic: Changes to allow to compile against vanilla 2.6.9 kernel. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8140 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- drivers/dahdi/dahdi_dynamic_ethmf.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'drivers/dahdi/dahdi_dynamic_ethmf.c') diff --git a/drivers/dahdi/dahdi_dynamic_ethmf.c b/drivers/dahdi/dahdi_dynamic_ethmf.c index 78068a5..a88fc37 100644 --- a/drivers/dahdi/dahdi_dynamic_ethmf.c +++ b/drivers/dahdi/dahdi_dynamic_ethmf.c @@ -129,7 +129,11 @@ struct ztdeth { /** * Lock for adding and removing items in ethmf_list */ +#ifdef DEFINE_SPINLOCK static DEFINE_SPINLOCK(ethmf_lock); +#else +static spinlock_t ethmf_lock = SPIN_LOCK_UNLOCKED; +#endif /** * The active list of all running spans @@ -396,6 +400,10 @@ static int ztdethmf_transmit(void *pvt, unsigned char *msg, int msglen) struct net_device *dev; unsigned char addr[ETH_ALEN]; int spans_ready = 0, index = 0; +#if LINUX_VERSION < KERNEL_VERSION(2, 6, 18) + static spinlock_t lock = SPIN_LOCK_UNLOCKED; + unsigned long flags; +#endif if (atomic_read(&shutdown)) return 0; @@ -407,12 +415,24 @@ static int ztdethmf_transmit(void *pvt, unsigned char *msg, int msglen) return 0; } +#if LINUX_VERSION < KERNEL_VERSION(2, 6, 18) + if (!atomic_read(&z->ready)) { + spin_lock_irqsave(&lock, flags); + atomic_inc(&z->ready); + if (1 == atomic_read(&z->ready)) { + memcpy(z->msgbuf, msg, msglen); + z->msgbuf_len = msglen; + } + spin_unlock_irqrestore(&lock, flags); + } +#else if (!atomic_read(&z->ready)) { if (atomic_inc_return(&z->ready) == 1) { memcpy(z->msgbuf, msg, msglen); z->msgbuf_len = msglen; } } +#endif spans_ready = ethmf_trx_spans_ready(z->addr_hash, &ready_spans); if (spans_ready) { -- cgit v1.2.3