Index: build_tools/genudevrules
===================================================================
--- build_tools/genudevrules	(revision 1243)
+++ build_tools/genudevrules	(working copy)
@@ -3,8 +3,13 @@
 ver=`udevinfo -V | cut -f3 -d" "`
 
 if [ -z "${ver}" ]; then
-   # nobody has that old version, anyway.
-   ver=54
+   # Not found - try udevadm
+   ver=`udevadm info -V | cut -f3 -d" "`
+
+   if [ -z "${ver}" ]; then
+      # nobody has that old version, anyway.
+      ver=54
+   fi
 fi
 
 # udev versions prior to 055 use a single '=' for matching key values
Index: kernel/wct4xxp/vpm450m.c
===================================================================
--- kernel/wct4xxp/vpm450m.c	(revision 1243)
+++ kernel/wct4xxp/vpm450m.c	(working copy)
@@ -31,7 +31,7 @@
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
 #include <linux/config.h>
 #else
-#include <linux/autoconf.h>
+#include <generated/autoconf.h>
 #endif
 
 /* API for Octasic access */
Index: kernel/torisa.c
===================================================================
--- kernel/torisa.c	(revision 1243)
+++ kernel/torisa.c	(working copy)
@@ -424,8 +424,8 @@
 	if (wasrunning)
 		spansstarted--;
 	write_unlock_irqrestore(&torisa, flags);	
-	if (!spans[0].flags & ZT_FLAG_RUNNING &&
-	    !spans[1].flags & ZT_FLAG_RUNNING)
+	if (!(spans[0].flags & ZT_FLAG_RUNNING) &&
+	    !(spans[1].flags & ZT_FLAG_RUNNING))
 		/* No longer in use, disable interrupts */
 		setctlreg(clockvals[syncsrc]);
 
Index: kernel/zaptel.h
===================================================================
--- kernel/zaptel.h	(revision 1243)
+++ kernel/zaptel.h	(working copy)
@@ -74,6 +74,10 @@
 #define ZAP_IRQ_HANDLER(a) static void a(int irq, void *dev_id, struct pt_regs *regs)
 #endif
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)
+#define HAVE_NET_DEVICE_OPS
+#endif
+
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)
 #define ZAP_IRQ_SHARED IRQF_SHARED
 #define ZAP_IRQ_DISABLED IRQF_DISABLED
Index: kernel/zconfig.h
===================================================================
--- kernel/zconfig.h	(revision 1243)
+++ kernel/zconfig.h	(working copy)
@@ -23,7 +23,7 @@
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
 #include <linux/config.h>
 #else
-#include <linux/autoconf.h>
+#include <generated/autoconf.h>
 #endif
 #endif
 
Index: kernel/wctdm.c
===================================================================
--- kernel/wctdm.c	(revision 1243)
+++ kernel/wctdm.c	(working copy)
@@ -27,9 +27,10 @@
 #include <linux/errno.h>
 #include <linux/module.h>
 #include <linux/init.h>
-#include <linux/errno.h>
 #include <linux/pci.h>
 #include <linux/interrupt.h>
+#include <linux/moduleparam.h>
+#include <linux/sched.h>
 #include <asm/io.h>
 #include "proslic.h"
 #include "wctdm.h"
Index: kernel/zttranscode.c
===================================================================
--- kernel/zttranscode.c	(revision 1243)
+++ kernel/zttranscode.c	(working copy)
@@ -40,7 +40,7 @@
 
 static int debug;
 LIST_HEAD(trans);
-static spinlock_t translock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(translock);
 
 EXPORT_SYMBOL(zt_transcoder_register);
 EXPORT_SYMBOL(zt_transcoder_unregister);
@@ -377,10 +377,12 @@
 	};
 }
 
+#ifndef HAVE_UNLOCKED_IOCTL
 static int zt_tc_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long data)
 {
 	return (int)zt_tc_unlocked_ioctl(file, cmd, data);
 }
+#endif
 
 static int zt_tc_mmap(struct file *file, struct vm_area_struct *vma)
 {
@@ -411,14 +413,15 @@
 	owner:   THIS_MODULE,
 	open:    zt_tc_open,
 	release: zt_tc_release,
+#ifdef HAVE_UNLOCKED_IOCTL
+	unlocked_ioctl: zt_tc_unlocked_ioctl,
+#else
 	ioctl:   zt_tc_ioctl,
+#endif
 	read:    zt_tc_read,
 	write:   zt_tc_write,
 	poll:    zt_tc_poll,
 	mmap:    zt_tc_mmap,
-#if HAVE_UNLOCKED_IOCTL
-	unlocked_ioctl: zt_tc_unlocked_ioctl,
-#endif
 };
 
 static struct zt_chardev transcode_chardev = {
Index: kernel/wctc4xxp/base.c
===================================================================
--- kernel/wctc4xxp/base.c	(revision 1243)
+++ kernel/wctc4xxp/base.c	(working copy)
@@ -60,7 +60,7 @@
 #	define ALLOC_FLAGS GFP_KERNEL
 #endif
 
-#define WARN() WARN_ON(1)
+#define WARN_ALWAYS() WARN_ON(1)
 
 #define DTE_PRINTK(_lvl, _fmt, _args...) \
 	   printk(KERN_##_lvl "%s: %s: " _fmt, THIS_MODULE->name, \
@@ -493,6 +493,18 @@
 
 };
 
+struct wcdte_netdev_priv {
+	struct wcdte *wc;
+};
+
+static inline struct wcdte *
+wcdte_from_netdev(struct net_device *netdev)
+{
+	struct wcdte_netdev_priv *priv;
+	priv = netdev_priv(netdev);
+	return priv->wc;
+}
+
 static inline void wctc4xxp_set_ready(struct wcdte *wc) {
 	set_bit(DTE_READY, &wc->flags);
 }
@@ -608,7 +620,7 @@
 static void 
 wctc4xxp_net_set_multi(struct net_device *netdev)
 {
-	struct wcdte *wc = netdev->priv;
+	struct wcdte *wc = wcdte_from_netdev(netdev);
 	DTE_DEBUG(DTE_DEBUG_GENERAL, "%s promiscuity:%d\n", 
 	   __FUNCTION__, netdev->promiscuity);
 }
@@ -616,7 +628,7 @@
 static int 
 wctc4xxp_net_up(struct net_device *netdev)
 {
-	struct wcdte *wc = netdev->priv;
+	struct wcdte *wc = wcdte_from_netdev(netdev);
 	DTE_DEBUG(DTE_DEBUG_GENERAL, "%s\n", __FUNCTION__);
 #if 1
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
@@ -631,7 +643,7 @@
 static int 
 wctc4xxp_net_down(struct net_device *netdev)
 {
-	struct wcdte *wc = netdev->priv;
+	struct wcdte *wc = wcdte_from_netdev(netdev);
 	DTE_DEBUG(DTE_DEBUG_GENERAL, "%s\n", __FUNCTION__);
 #if 1
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
@@ -648,7 +660,7 @@
 static int 
 wctc4xxp_net_hard_start_xmit(struct sk_buff *skb, struct net_device *netdev)
 {
-	struct wcdte *wc = netdev->priv;
+	struct wcdte *wc = wcdte_from_netdev(netdev);
 	struct tcb *cmd;
 
 	/* We set DO_NOT_CAPTURE because this packet was already captured by
@@ -683,7 +695,7 @@
 static int 
 wctc4xxp_poll(struct net_device *netdev, int *budget)
 {
-	struct wcdte *wc = netdev->priv;
+	struct wcdte *wc = wcdte_from_netdev(netdev);
 	int count = 0;
 	int quota = min(netdev->quota, *budget);
 
@@ -718,7 +730,7 @@
 static struct net_device_stats *
 wctc4xxp_net_get_stats(struct net_device *netdev)
 {
-	struct wcdte *wc = netdev->priv;
+	struct wcdte *wc = wcdte_from_netdev(netdev);
 	return &wc->net_stats;
 }
 
@@ -755,7 +767,7 @@
 static int 
 wctc4xxp_net_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
 {
-	struct wcdte *wc = netdev->priv;
+	struct wcdte *wc = wcdte_from_netdev(netdev);
 	switch(cmd) {
 	case 0x89f0:
 		down(&wc->chansem);
@@ -771,6 +783,17 @@
 	return 0;
 }
 
+#ifdef HAVE_NET_DEVICE_OPS
+static const struct net_device_ops wctc4xxp_netdev_ops = {
+	.ndo_set_multicast_list = &wctc4xxp_net_set_multi,
+	.ndo_open = &wctc4xxp_net_up,
+	.ndo_stop = &wctc4xxp_net_down,
+	.ndo_start_xmit = &wctc4xxp_net_hard_start_xmit,
+	.ndo_get_stats = &wctc4xxp_net_get_stats,
+	.ndo_do_ioctl = &wctc4xxp_net_ioctl,
+};
+#endif
+
 /** 
  * wctc4xxp_net_register - Register a new network interface.
  * @wc: transcoder card to register the interface for.
@@ -784,20 +807,26 @@
 {
 	int res;
 	struct net_device *netdev;
+	struct wcdte_netdev_priv *priv;
 	const char our_mac[] = { 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff};
 
-	if (!(netdev = alloc_netdev(0, wc->board_name, ether_setup))) {
+	netdev = alloc_netdev(sizeof(*priv), wc->board_name, ether_setup);
+	if (!netdev)
 		return -ENOMEM;
-	}
+	priv = netdev_priv(netdev);
+	priv->wc = wc;
+	memcpy(netdev->dev_addr, our_mac, sizeof(our_mac));
 
-	memcpy(netdev->dev_addr, our_mac, sizeof(our_mac));
-	netdev->priv = wc;
+#	ifdef HAVE_NET_DEVICE_OPS
 	netdev->set_multicast_list = &wctc4xxp_net_set_multi;
+#	else
 	netdev->open = &wctc4xxp_net_up;
 	netdev->stop = &wctc4xxp_net_down;
 	netdev->hard_start_xmit = &wctc4xxp_net_hard_start_xmit;
 	netdev->get_stats = &wctc4xxp_net_get_stats;
 	netdev->do_ioctl = &wctc4xxp_net_ioctl;
+#	endif
+
 	netdev->promiscuity = 0;
 	netdev->flags |= IFF_NOARP;
 #	if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
@@ -2185,7 +2214,7 @@
 	
 	for (i = 0; i < DRING_SIZE; ++i) { 
 		if (!(cmd = alloc_cmd())) {
-			WARN();
+			WARN_ALWAYS();
 			return;
 		}
 		cmd->data_len = SFRAME_SIZE;
@@ -2193,7 +2222,7 @@
 			/* When we're starting the DMA, we should always be
 			 * able to fill the ring....so something is wrong
 			 * here. */
-			WARN();
+			WARN_ALWAYS();
 			free_cmd(cmd);
 			break;
 		}
@@ -2707,7 +2736,7 @@
 {
 	int ret;
 	if ((ret=down_interruptible(&wc->chansem))) {
-		WARN();
+		WARN_ALWAYS();
 		return ret;
 	}
 	ret = __wctc4xxp_setup_channels(wc);
Index: kernel/zaptel-base.c
===================================================================
--- kernel/zaptel-base.c	(revision 1243)
+++ kernel/zaptel-base.c	(working copy)
@@ -48,18 +48,27 @@
 #include <linux/kmod.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
+
+#if defined(HAVE_UNLOCKED_IOCTL) && defined(CONFIG_BKL)
+#include <linux/smp_lock.h>
+#endif
+
 #ifdef CONFIG_DEVFS_FS
 #include <linux/devfs_fs_kernel.h>
 #endif /* CONFIG_DEVFS_FS */
+
 #ifdef CONFIG_ZAPATA_NET
 #include <linux/netdevice.h>
 #endif /* CONFIG_ZAPATA_NET */
+
 #include <linux/ppp_defs.h>
+
 #ifdef CONFIG_ZAPATA_PPP
 #include <linux/netdevice.h>
 #include <linux/if.h>
 #include <linux/if_ppp.h>
 #endif
+
 #include <asm/atomic.h>
 
 #ifndef CONFIG_OLD_HDLC_API
@@ -333,7 +342,7 @@
 	.mfr2_tonelen = DEFAULT_MFR2_LENGTH,
 };
 
-static int zt_chan_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long data, int unit);
+static int zt_chan_ioctl(struct file *file, unsigned int cmd, unsigned long data, int unit);
 
 #if defined(CONFIG_ZAPTEL_MMX) || defined(ECHO_CAN_FP)
 /* XXX kernel_fpu_begin() is NOT exported properly (in 2.4), so we have to make
@@ -2069,7 +2078,7 @@
 	return amnt;
 }
 
-static int zt_ctl_open(struct inode *inode, struct file *file)
+static int zt_ctl_open(struct file *file)
 {
 	/* Nothing to do, really */
 #ifndef LINUX26
@@ -2078,7 +2087,7 @@
 	return 0;
 }
 
-static int zt_chan_open(struct inode *inode, struct file *file)
+static int zt_chan_open(struct file *file)
 {
 	/* Nothing to do here for now either */
 #ifndef LINUX26
@@ -2087,7 +2096,7 @@
 	return 0;
 }
 
-static int zt_ctl_release(struct inode *inode, struct file *file)
+static int zt_ctl_release(struct file *file)
 {
 	/* Nothing to do */
 #ifndef LINUX26
@@ -2096,7 +2105,7 @@
 	return 0;
 }
 
-static int zt_chan_release(struct inode *inode, struct file *file)
+static int zt_chan_release(struct file *file)
 {
 	/* Nothing to do for now */
 #ifndef LINUX26
@@ -2157,7 +2166,7 @@
 
 	/* if no span, return doing nothing */
 	if (!chan->span) return;
-	if (!chan->span->flags & ZT_FLAG_RBS) {
+	if (!(chan->span->flags & ZT_FLAG_RBS)) {
 		printk("zt_rbs: Tried to set RBS hook state on non-RBS channel %s\n", chan->name);
 		return;
 	}
@@ -2420,7 +2429,7 @@
 	return 0;
 }
 
-static int zt_timing_open(struct inode *inode, struct file *file)
+static int zt_timing_open(struct file *file)
 {
 	struct zt_timer *t;
 	unsigned long flags;
@@ -2441,7 +2450,7 @@
 	return 0;
 }
 
-static int zt_timer_release(struct inode *inode, struct file *file)
+static int zt_timer_release(struct file *file)
 {
 	struct zt_timer *t, *cur, *prev;
 	unsigned long flags;
@@ -2475,7 +2484,7 @@
 	return 0;
 }
 
-static int zt_specchan_open(struct inode *inode, struct file *file, int unit, int inc)
+static int zt_specchan_open(struct file *file, int unit, int inc)
 {
 	int res = 0;
 
@@ -2520,7 +2529,7 @@
 	return res;
 }
 
-static int zt_specchan_release(struct inode *node, struct file *file, int unit)
+static int zt_specchan_release(struct file *file, int unit)
 {
 	int res=0;
 	unsigned long flags;
@@ -2588,7 +2597,7 @@
 	struct zt_chan *chan;
 	/* Minor 0: Special "control" descriptor */
 	if (!unit) 
-		return zt_ctl_open(inode, file);
+		return zt_ctl_open(file);
 	if (unit == 250) {
 		if (!zt_transcode_fops)
 			if (request_module("zttranscode")) {
@@ -2612,26 +2621,26 @@
 	}
 	if (unit == 253) {
 		if (maxspans) {
-			return zt_timing_open(inode, file);
+			return zt_timing_open(file);
 		} else {
 			return -ENXIO;
 		}
 	}
 	if (unit == 254)
-		return zt_chan_open(inode, file);
+		return zt_chan_open(file);
 	if (unit == 255) {
 		if (maxspans) {
 			chan = zt_alloc_pseudo();
 			if (chan) {
 				file->private_data = chan;
-				return zt_specchan_open(inode, file, chan->channo, 1);
+				return zt_specchan_open(file, chan->channo, 1);
 			} else {
 				return -ENXIO;
 			}
 		} else
 			return -ENXIO;
 	}
-	return zt_specchan_open(inode, file, unit, 1);
+	return zt_specchan_open(file, unit, 1);
 }
 
 #if 0
@@ -2640,7 +2649,7 @@
 	int res;
 	unsigned long flags;
 	spin_lock_irqsave(&bigzaplock, flags);
-	res = __zt_open(inode, file);
+	res = __zt_open(file);
 	spin_unlock_irqrestore(&bigzaplock, flags);
 	return res;
 }
@@ -3123,9 +3132,9 @@
 	struct zt_chan *chan;
 
 	if (!unit) 
-		return zt_ctl_release(inode, file);
+		return zt_ctl_release(file);
 	if (unit == 253) {
-		return zt_timer_release(inode, file);
+		return zt_timer_release(file);
 	}
 	if (unit == 250) {
 		/* We should not be here because the zttranscode.ko module
@@ -3137,14 +3146,14 @@
 	if (unit == 254) {
 		chan = file->private_data;
 		if (!chan)
-			return zt_chan_release(inode, file);
+			return zt_chan_release(file);
 		else
-			return zt_specchan_release(inode, file, chan->channo);
+			return zt_specchan_release(file, chan->channo);
 	}
 	if (unit == 255) {
 		chan = file->private_data;
 		if (chan) {
-			res = zt_specchan_release(inode, file, chan->channo);
+			res = zt_specchan_release(file, chan->channo);
 			zt_free_pseudo(chan);
 		} else {
 			printk("Pseudo release and no private data??\n");
@@ -3152,7 +3161,7 @@
 		}
 		return res;
 	}
-	return zt_specchan_release(inode, file, unit);
+	return zt_specchan_release(file, unit);
 }
 
 #if 0
@@ -3162,7 +3171,7 @@
 	unsigned long flags;
 	int res;
 	spin_lock_irqsave(&bigzaplock, flags);
-	res = __zt_release(inode, file);
+	res = __zt_release(file);
 	spin_unlock_irqrestore(&bigzaplock, flags);
 	return res;
 }
@@ -3230,7 +3239,7 @@
 		return -ENXIO; \
 } while(0)
 
-static int zt_timer_ioctl(struct inode *node, struct file *file, unsigned int cmd, unsigned long data, struct zt_timer *timer)
+static int zt_timer_ioctl(struct file *file, unsigned int cmd, unsigned long data, struct zt_timer *timer)
 {
 	int j;
 	unsigned long flags;
@@ -3279,7 +3288,7 @@
 	return 0;
 }
 
-static int zt_common_ioctl(struct inode *node, struct file *file, unsigned int cmd, unsigned long data, int unit)
+static int zt_common_ioctl(struct file *file, unsigned int cmd, unsigned long data, int unit)
 {
 	union {
 		struct zt_gains gain;
@@ -3640,7 +3649,7 @@
 #endif
 }
 
-static int zt_ctl_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long data)
+static int zt_ctl_ioctl(struct file *file, unsigned int cmd, unsigned long data)
 {
 	/* I/O CTL's for control interface */
 	int i,j;
@@ -3658,7 +3667,7 @@
 		if (copy_from_user(&ind, (struct zt_indirect_data *)data, sizeof(ind)))
 			return -EFAULT;
 		VALID_CHANNEL(ind.chan);
-		return zt_chan_ioctl(inode, file, ind.op, (unsigned long) ind.data, ind.chan);
+		return zt_chan_ioctl(file, ind.op, (unsigned long) ind.data, ind.chan);
 	}
 	case ZT_SPANCONFIG:
 	{
@@ -4082,7 +4091,7 @@
 		return hpec_license_ioctl(cmd, data);
 #endif /* defined(ECHO_CAN_HPEC) */
 	default:
-		return zt_common_ioctl(inode, file, cmd, data, 0);
+		return zt_common_ioctl(file, cmd, data, 0);
 	}
 	return 0;
 }
@@ -4144,7 +4153,7 @@
 	return rv;
 }
 
-static int zt_chanandpseudo_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long data, int unit)
+static int zt_chanandpseudo_ioctl(struct file *file, unsigned int cmd, unsigned long data, int unit)
 {
 	struct zt_chan *chan = chans[unit];
 	union {
@@ -4622,7 +4631,7 @@
 		break;
 	default:
 		/* Check for common ioctl's and private ones */
-		rv = zt_common_ioctl(inode, file, cmd, data, unit);
+		rv = zt_common_ioctl(file, cmd, data, unit);
 		/* if no span, just return with value */
 		if (!chan->span) return rv;
 		if ((rv == -ENOTTY) && chan->span->ioctl) 
@@ -4756,7 +4765,7 @@
 	return ret;
 }
 
-static int zt_chan_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long data, int unit)
+static int zt_chan_ioctl(struct file *file, unsigned int cmd, unsigned long data, int unit)
 {
 	struct zt_chan *chan = chans[unit];
 	unsigned long flags;
@@ -5103,12 +5112,12 @@
 		break;
 #endif
 	default:
-		return zt_chanandpseudo_ioctl(inode, file, cmd, data, unit);
+		return zt_chanandpseudo_ioctl(file, cmd, data, unit);
 	}
 	return 0;
 }
 
-static int zt_prechan_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long data, int unit)
+static int zt_prechan_ioctl(struct file *file, unsigned int cmd, unsigned long data, int unit)
 {
 	struct zt_chan *chan = file->private_data;
 	int channo;
@@ -5124,7 +5133,7 @@
 			return -EINVAL;
 		if (channo > ZT_MAX_CHANNELS)
 			return -EINVAL;
-		res = zt_specchan_open(inode, file, channo, 0);
+		res = zt_specchan_open(file, channo, 0);
 		if (!res) {
 			/* Setup the pointer for future stuff */
 			chan = chans[channo];
@@ -5139,47 +5148,85 @@
 	return 0;
 }
 
-static int zt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long data)
+static long zt_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long data)
 {
 	int unit = UNIT(file);
 	struct zt_chan *chan;
 	struct zt_timer *timer;
+	int ret;
 
-	if (!unit)
-		return zt_ctl_ioctl(inode, file, cmd, data);
+#if defined(HAVE_UNLOCKED_IOCTL) && defined(CONFIG_BKL)
+	lock_kernel();
+#endif
 
+	if (!unit) {
+		ret = zt_ctl_ioctl(file, cmd, data);
+		goto unlock_exit;
+	}
+
 	if (unit == 250) {
 		/* zttranscode should have updated the file_operations on
 		 * this file object on open, so we shouldn't be here. */
 		WARN_ON(1);
-		return -EFAULT;
+		ret = -EFAULT;
+		goto unlock_exit;
 	}
 
 	if (unit == 253) {
 		timer = file->private_data;
 		if (timer)
-			return zt_timer_ioctl(inode, file, cmd, data, timer);
+			ret = zt_timer_ioctl(file, cmd, data, timer);
 		else
-			return -EINVAL;
+			ret = -EINVAL;
+		goto unlock_exit;
 	}
 	if (unit == 254) {
 		chan = file->private_data;
 		if (chan)
-			return zt_chan_ioctl(inode, file, cmd, data, chan->channo);
+			ret = zt_chan_ioctl(file, cmd, data, chan->channo);
 		else
-			return zt_prechan_ioctl(inode, file, cmd, data, unit);
+			ret = zt_prechan_ioctl(file, cmd, data, unit);
+		goto unlock_exit;
 	}
 	if (unit == 255) {
 		chan = file->private_data;
 		if (!chan) {
 			printk("No pseudo channel structure to read?\n");
-			return -EINVAL;
+			ret = -EINVAL;
+			goto unlock_exit;
 		}
-		return zt_chanandpseudo_ioctl(inode, file, cmd, data, chan->channo);
+		ret = zt_chanandpseudo_ioctl(file, cmd, data, chan->channo);
+		goto unlock_exit;
 	}
-	return zt_chan_ioctl(inode, file, cmd, data, unit);
+
+	ret = zt_chan_ioctl(file, cmd, data, unit);
+
+unlock_exit:
+#if defined(HAVE_UNLOCKED_IOCTL) && defined(CONFIG_BKL)
+	unlock_kernel();
+#endif
+	return ret;
 }
 
+#ifndef HAVE_UNLOCKED_IOCTL
+static int zt_ioctl(struct inode *inode, struct file *file,
+		unsigned int cmd, unsigned long data)
+{
+   	return zt_unlocked_ioctl(file, cmd, data);
+}
+#endif
+
+#ifdef HAVE_COMPAT_IOCTL
+static long zt_ioctl_compat(struct file *file, unsigned int cmd,
+		unsigned long data)
+{
+	if (cmd == ZT_SFCONFIG)
+		return -ENOTTY; /* Not supported yet */
+
+	return zt_unlocked_ioctl(file, cmd, data);
+}
+#endif
+
 int zt_register(struct zt_span *span, int prefmaster)
 {
 	int x;
@@ -7647,7 +7694,14 @@
 	llseek: NULL,
 	open: zt_open,
 	release: zt_release,
+#ifdef HAVE_UNLOCKED_IOCTL
+	unlocked_ioctl: zt_unlocked_ioctl,
+#ifdef HAVE_COMPAT_IOCTL
+	compat_ioctl: zt_ioctl_compat,
+#endif
+#else
 	ioctl: zt_ioctl,
+#endif
 	read: zt_read,
 	write: zt_write,
 	poll: zt_poll,
Index: kernel/pciradio.c
===================================================================
--- kernel/pciradio.c	(revision 1243)
+++ kernel/pciradio.c	(working copy)
@@ -46,9 +46,10 @@
 #include <linux/errno.h>
 #include <linux/module.h>
 #include <linux/init.h>
-#include <linux/errno.h>
 #include <linux/pci.h>
 #include <linux/interrupt.h>
+#include <linux/moduleparam.h>
+#include <linux/sched.h>
 #include <asm/io.h>
 #include <asm/delay.h> 
 
