Bug#510140: zaptel-source: Zaptel modules fail to build under etch-and-a-half

Tzafrir Cohen tzafrir.cohen at xorcom.com
Sun Jan 11 23:41:05 UTC 2009


On Sat, Jan 10, 2009 at 10:06:08PM +0200, Tzafrir Cohen wrote:
> On Mon, Dec 29, 2008 at 12:29:57PM -0600, Karl Schmidt wrote:
> > Package: zaptel-source
> > Version: 1:1.4.11~dfsg-3
> > Severity: important
> > 
> > I have a Wildcard X100P (uses wct1xxp module)  that has just stopped 
> > working on upgrading the kernel to 2.6.24-etchnhalf.1-amd64
> > 
> > I updated to 2.6.24-etchnhalf.1-amd64 and would not build zaptel-source 
> > 1:1.2.11.dfsg-1 (See build log below) , so I loaded 1:1.4.11~dfsg-3 
> > which would build but still won't work as shown below.
> 
> OK. First set of patches. This goes as far as getting the modules
> shipped with Zaptel built . We still need to extend those to the other
> modules we ship.
> 
> All of them are rather trivial backports of upstream changes. But then
> again I see that the size of my message is 23k .

Now it builds. The bristuff drivers still give the 
"warning: ‘pci_find_device’ is deprecated"
warning. This was fixed much later by upstream.

The xpp drivers still have some warnings. But then again, that version 
of those drivers was rather buggy in the first place so I really
wouldn't recommend anyone to use it.

I also noticed that the build procedure seems to download the firmware 
from Digium. May be a problem when building with no internet connection.

I suppose I'll just mark it as having patch and wontfix, unless someone
wants to push this fix through.

-- 
               Tzafrir Cohen
icq#16849755              jabber:tzafrir.cohen at xorcom.com
+972-50-7952406           mailto:tzafrir.cohen at xorcom.com
http://www.xorcom.com  iax:guest at local.xorcom.com/tzafrir
-------------- next part --------------
#! /bin/sh /usr/share/dpatch/dpatch-run
## Makefile_clean.dpatch by Tzafrir Cohen <tzafrir.cohen at xorcom.com>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description.

@DPATCH@
diff -urNad zaptel-1.2.11.dfsg~/Makefile zaptel-1.2.11.dfsg/Makefile
--- zaptel-1.2.11.dfsg~/Makefile	2009-01-10 20:43:44.000000000 +0200
+++ zaptel-1.2.11.dfsg/Makefile	2009-01-10 20:44:33.000000000 +0200
@@ -182,7 +182,7 @@
 linux26: prereq $(BINS)
 	@echo $(KSRC)
 	@if [ -z "$(KSRC)" -o ! -d "$(KSRC)" ]; then echo "You do not appear to have the sources for the $(KVERS) kernel installed."; exit 1 ; fi
-	$(MAKE) -C $(KSRC) SUBDIRS=$(PWD) modules
+	$(KMAKE) modules
 
 version.h: FORCE
 	ZAPTELVERSION="${ZAPTELVERSION}" build_tools/make_version_h > $@.tmp
@@ -470,7 +470,7 @@
 	rm -f *.o ztcfg tzdriver sethdlc sethdlc-new
 	rm -f $(TZOBJS) $(LIBTONEZONE_SO) *.lo
 ifeq ($(BUILDVER),linux26)
-	$(MAKE) -C $(KSRC) SUBDIRS=$(PWD) clean
+	$(KMAKE) clean
 else
 	$(MAKE) -C wct4xxp clean
 endif
-------------- next part --------------
#! /bin/sh /usr/share/dpatch/dpatch-run
## Makefile_cflags.dpatch by Tzafrir Cohen <tzafrir.cohen at xorcom.com>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: We shouldn't pass CFLAGS to Kbuild . And 2.6.24 even complains
## DP: about it.
## DP: Sadly the fix for that is too complex. So let's pretend this is
## DP: not a problem and hope for the best.
## DP: Also sets the actual required CFLAGS values in EXTRA_CFLAGS.

@DPATCH@
diff -urNad zaptel-1.2.11.dfsg~/Makefile zaptel-1.2.11.dfsg/Makefile
--- zaptel-1.2.11.dfsg~/Makefile	2009-01-11 16:45:48.000000000 +0200
+++ zaptel-1.2.11.dfsg/Makefile	2009-01-11 16:45:49.000000000 +0200
@@ -62,7 +62,8 @@
 
 KFLAGS+=-DSTANDALONE_ZAPATA
 CFLAGS+=-DSTANDALONE_ZAPATA
-KMAKE:= $(MAKE) -C $(KSRC) SUBDIRS=$(PWD)
+EXTRA_CFLAGS	:= -DSTANDALONE_ZAPATA
+KMAKE:= $(MAKE) -C $(KSRC) SUBDIRS=$(PWD) KBUILD_NOPEDANTIC=yes HOTPLUG_FIRMWARE=yes
 KMAKE_INST:= $(KMAKE) INSTALL_MOD_PATH=$(INSTALL_PREFIX) INSTALL_MOD_DIR=misc modules_install
 
 CONFIG_FILE:=$(INSTALL_PREFIX)/etc/zaptel.conf
diff -urNad zaptel-1.2.11.dfsg~/wct4xxp/Kbuild zaptel-1.2.11.dfsg/wct4xxp/Kbuild
--- zaptel-1.2.11.dfsg~/wct4xxp/Kbuild	2009-01-11 16:45:48.000000000 +0200
+++ zaptel-1.2.11.dfsg/wct4xxp/Kbuild	2009-01-11 16:46:31.000000000 +0200
@@ -5,7 +5,7 @@
 
 obj-m += wct4xxp.o
 
-EXTRA_CFLAGS := -I$(src)/.. $(shell $(src)/../oct612x/octasic-helper cflags $(src)/../oct612x) -Wno-undef
+EXTRA_CFLAGS := -I$(src)/.. $(shell $(src)/../oct612x/octasic-helper cflags $(src)/../oct612x) -Wno-undef -DSTANDALONE_ZAPATA -DHOTPLUG_FIRMWARE
 
 wct4xxp-objs := base.o vpm450m.o $(shell $(src)/../oct612x/octasic-helper objects ../oct612x)
 
-------------- next part --------------
#! /bin/sh /usr/share/dpatch/dpatch-run
## zapirq_2619.dpatch by Tzafrir Cohen <tzafrir.cohen at xorcom.com>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Adds a function type ZAP_IRQ_HANDLER to provide compatibilty
## DP: for changes in kernel 2.6.19 .
## DP:
## DP: Upstream: http://svn.digium.com/view/zaptel?view=revision&revision=1697
## DP: Also applied to all the external drivers.

@DPATCH@
diff -urNad zaptel-1.2.11.dfsg~/cwain/cwain.c zaptel-1.2.11.dfsg/cwain/cwain.c
--- zaptel-1.2.11.dfsg~/cwain/cwain.c	2009-01-11 13:58:18.000000000 +0200
+++ zaptel-1.2.11.dfsg/cwain/cwain.c	2009-01-11 13:58:38.000000000 +0200
@@ -854,11 +854,7 @@
     return 0;
 }
 
-#ifdef LINUX26
-static irqreturn_t cwain_dummy_interrupt(int irq, void *dev_id, struct pt_regs *regs) {
-#else
-static void cwain_dummy_interrupt(int irq, void *dev_id, struct pt_regs *regs) {
-#endif
+ZAP_IRQ_HANDLER(cwain_dummy_interrupt) {
     struct zt_cwain_card *cwaintmp = dev_id;
     if (!cwaintmp) {
 #ifdef LINUX26
@@ -875,11 +871,7 @@
 }
 
 
-#ifdef LINUX26
-static irqreturn_t cwain_interrupt(int irq, void *dev_id, struct pt_regs *regs) {
-#else
-static void cwain_interrupt(int irq, void *dev_id, struct pt_regs *regs) {
-#endif
+ZAP_IRQ_HANDLER(cwain_interrupt) {
     struct zt_cwain_card *cwaintmp = dev_id;
     unsigned char status, status2, status_tmp, irq_misc, irq_misc2 = 0;
 #ifndef RELAXED_LOCKING    
diff -urNad zaptel-1.2.11.dfsg~/opvxa1200.c zaptel-1.2.11.dfsg/opvxa1200.c
--- zaptel-1.2.11.dfsg~/opvxa1200.c	2009-01-11 13:56:17.000000000 +0200
+++ zaptel-1.2.11.dfsg/opvxa1200.c	2009-01-11 13:58:18.000000000 +0200
@@ -1219,11 +1219,7 @@
 	wc->mod[card].fxs.lastrxhook = hook;
 }
 
-#ifdef LINUX26
-static irqreturn_t wctdm_interrupt(int irq, void *dev_id, struct pt_regs *regs)
-#else
-static void wctdm_interrupt(int irq, void *dev_id, struct pt_regs *regs)
-#endif
+ZAP_IRQ_HANDLER(wctdm_interrupt)
 {
 	struct wctdm *wc = dev_id;
 	unsigned char ints;
diff -urNad zaptel-1.2.11.dfsg~/pciradio.c zaptel-1.2.11.dfsg/pciradio.c
--- zaptel-1.2.11.dfsg~/pciradio.c	2009-01-11 13:56:17.000000000 +0200
+++ zaptel-1.2.11.dfsg/pciradio.c	2009-01-11 13:58:18.000000000 +0200
@@ -712,11 +712,7 @@
 static void pciradio_reset_serial(struct pciradio *rad);
 static void pciradio_restart_dma(struct pciradio *rad);
 
-#ifdef LINUX26
-static irqreturn_t pciradio_interrupt(int irq, void *dev_id, struct pt_regs *regs)
-#else
-static void pciradio_interrupt(int irq, void *dev_id, struct pt_regs *regs)
-#endif
+ZAP_IRQ_HANDLER(pciradio_interrupt)
 {
 	struct pciradio *rad = dev_id;
 	unsigned char ints,byte1,byte2,gotcor,gotctcss,gotslowctcss,ctcss;
diff -urNad zaptel-1.2.11.dfsg~/qozap/qozap.c zaptel-1.2.11.dfsg/qozap/qozap.c
--- zaptel-1.2.11.dfsg~/qozap/qozap.c	2009-01-11 13:58:18.000000000 +0200
+++ zaptel-1.2.11.dfsg/qozap/qozap.c	2009-01-11 13:58:18.000000000 +0200
@@ -718,11 +718,7 @@
     }
 }
 
-#ifdef LINUX26
-static irqreturn_t qoz_interrupt(int irq, void *dev_id, struct pt_regs *regs) {
-#else
-static void qoz_interrupt(int irq, void *dev_id, struct pt_regs *regs) {
-#endif
+ZAP_IRQ_HANDLER(qoz_interrupt) {
     struct qoz_card *qoztmp = dev_id;
     struct zt_qoz *ztqoz = qoztmp->ztdev;
 #ifndef RELAXED_LOCKING
diff -urNad zaptel-1.2.11.dfsg~/tor2.c zaptel-1.2.11.dfsg/tor2.c
--- zaptel-1.2.11.dfsg~/tor2.c	2009-01-11 13:56:17.000000000 +0200
+++ zaptel-1.2.11.dfsg/tor2.c	2009-01-11 13:58:18.000000000 +0200
@@ -190,12 +190,7 @@
 static int tor2_rbsbits(struct zt_chan *chan, int bits);
 static int tor2_maint(struct zt_span *span, int cmd);
 static int tor2_ioctl(struct zt_chan *chan, unsigned int cmd, unsigned long data);
-#ifdef LINUX26
-static irqreturn_t tor2_intr(int irq, void *dev_id, struct pt_regs *regs);
-#else
-static void tor2_intr(int irq, void *dev_id, struct pt_regs *regs);
-#endif
-
+ZAP_IRQ_HANDLER(tor2_intr);
 
 /* translations of data channels for 24 channels in a 32 bit PCM highway */
 unsigned datxlt_t1[] = { 
@@ -1188,11 +1183,7 @@
 	return 0;
 }
 
-#ifdef LINUX26
-static irqreturn_t tor2_intr(int irq, void *dev_id, struct pt_regs *regs)
-#else
-static void tor2_intr(int irq, void *dev_id, struct pt_regs *regs)
-#endif
+ZAP_IRQ_HANDLER(tor2_intr)
 {
 	int n, i, j, k, syncsrc;
 	unsigned int rxword,txword;
diff -urNad zaptel-1.2.11.dfsg~/torisa.c zaptel-1.2.11.dfsg/torisa.c
--- zaptel-1.2.11.dfsg~/torisa.c	2009-01-11 13:56:17.000000000 +0200
+++ zaptel-1.2.11.dfsg/torisa.c	2009-01-11 13:58:18.000000000 +0200
@@ -744,11 +744,7 @@
 
 static int txerrors;
 
-#ifdef LINUX26
-static irqreturn_t torisa_intr(int irq, void *dev_id, struct pt_regs *regs)
-#else
-static void torisa_intr(int irq, void *dev_id, struct pt_regs *regs)
-#endif
+ZAP_IRQ_HANDLER(torisa_intr)
 {
 	static unsigned int passno = 0, mysynccnt = 0, lastsyncsrc = -1;
 	int n, n1, i, j, k, x, mysyncsrc, oldn;
diff -urNad zaptel-1.2.11.dfsg~/vzaphfc/vzaphfc_main.c zaptel-1.2.11.dfsg/vzaphfc/vzaphfc_main.c
--- zaptel-1.2.11.dfsg~/vzaphfc/vzaphfc_main.c	2009-01-11 13:56:17.000000000 +0200
+++ zaptel-1.2.11.dfsg/vzaphfc/vzaphfc_main.c	2009-01-11 13:58:18.000000000 +0200
@@ -1054,7 +1054,7 @@
 static void hfc_frame_arrived(struct hfc_chan_duplex *chan);
 static void hfc_handle_voice(struct hfc_card *card);
 
-static irqreturn_t hfc_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+ZAP_IRQ_HANDLER(hfc_interrupt)
 {
 	struct hfc_card *card = dev_id;
 	unsigned long flags;
diff -urNad zaptel-1.2.11.dfsg~/wcfxo.c zaptel-1.2.11.dfsg/wcfxo.c
--- zaptel-1.2.11.dfsg~/wcfxo.c	2009-01-11 13:56:17.000000000 +0200
+++ zaptel-1.2.11.dfsg/wcfxo.c	2009-01-11 13:58:18.000000000 +0200
@@ -396,11 +396,7 @@
 static void wcfxo_stop_dma(struct wcfxo *wc);
 static void wcfxo_restart_dma(struct wcfxo *wc);
 
-#ifdef LINUX26
-static irqreturn_t wcfxo_interrupt(int irq, void *dev_id, struct pt_regs *regs)
-#else
-static void wcfxo_interrupt(int irq, void *dev_id, struct pt_regs *regs)
-#endif
+ZAP_IRQ_HANDLER(wcfxo_interrupt)
 {
 	struct wcfxo *wc = dev_id;
 	unsigned char ints;
diff -urNad zaptel-1.2.11.dfsg~/wct1xxp.c zaptel-1.2.11.dfsg/wct1xxp.c
--- zaptel-1.2.11.dfsg~/wct1xxp.c	2009-01-11 13:56:17.000000000 +0200
+++ zaptel-1.2.11.dfsg/wct1xxp.c	2009-01-11 13:58:18.000000000 +0200
@@ -1126,11 +1126,7 @@
 	}
 }
 
-#ifdef LINUX26
-static irqreturn_t t1xxp_interrupt(int irq, void *dev_id, struct pt_regs *regs)
-#else
-static void t1xxp_interrupt(int irq, void *dev_id, struct pt_regs *regs)
-#endif
+ZAP_IRQ_HANDLER(t1xxp_interrupt)
 {
 	struct t1xxp *wc = dev_id;
 	unsigned char ints;
diff -urNad zaptel-1.2.11.dfsg~/wct4xxp/base.c zaptel-1.2.11.dfsg/wct4xxp/base.c
--- zaptel-1.2.11.dfsg~/wct4xxp/base.c	2009-01-11 13:56:17.000000000 +0200
+++ zaptel-1.2.11.dfsg/wct4xxp/base.c	2009-01-11 13:58:18.000000000 +0200
@@ -2238,11 +2238,7 @@
 }
 
 #ifdef SUPPORT_GEN1
-#ifdef LINUX26
-static irqreturn_t t4_interrupt(int irq, void *dev_id, struct pt_regs *regs)
-#else
-static void t4_interrupt(int irq, void *dev_id, struct pt_regs *regs)
-#endif
+ZAP_IRQ_HANDLER(t4_interrupt)
 {
 	struct t4 *wc = dev_id;
 	unsigned long flags;
@@ -2395,11 +2391,7 @@
 	}
 }
 
-#ifdef LINUX26
-static irqreturn_t t4_interrupt_gen2(int irq, void *dev_id, struct pt_regs *regs)
-#else
-static void t4_interrupt_gen2(int irq, void *dev_id, struct pt_regs *regs)
-#endif
+ZAP_IRQ_HANDLER(t4_interrupt_gen2)
 {
 	struct t4 *wc = dev_id;
 	unsigned long flags;
diff -urNad zaptel-1.2.11.dfsg~/wctdm.c zaptel-1.2.11.dfsg/wctdm.c
--- zaptel-1.2.11.dfsg~/wctdm.c	2009-01-11 13:56:17.000000000 +0200
+++ zaptel-1.2.11.dfsg/wctdm.c	2009-01-11 13:58:18.000000000 +0200
@@ -1024,11 +1024,7 @@
 	wc->mod[card].fxs.lastrxhook = hook;
 }
 
-#ifdef LINUX26
-static irqreturn_t wctdm_interrupt(int irq, void *dev_id, struct pt_regs *regs)
-#else
-static void wctdm_interrupt(int irq, void *dev_id, struct pt_regs *regs)
-#endif
+ZAP_IRQ_HANDLER(wctdm_interrupt)
 {
 	struct wctdm *wc = dev_id;
 	unsigned char ints;
diff -urNad zaptel-1.2.11.dfsg~/wctdm24xxp.c zaptel-1.2.11.dfsg/wctdm24xxp.c
--- zaptel-1.2.11.dfsg~/wctdm24xxp.c	2009-01-11 13:56:17.000000000 +0200
+++ zaptel-1.2.11.dfsg/wctdm24xxp.c	2009-01-11 13:58:18.000000000 +0200
@@ -1422,11 +1422,7 @@
 	}	
 }
 
-#ifdef LINUX26
-static irqreturn_t wctdm_interrupt(int irq, void *dev_id, struct pt_regs *regs)
-#else
-static void wctdm_interrupt(int irq, void *dev_id, struct pt_regs *regs)
-#endif
+ZAP_IRQ_HANDLER(wctdm_interrupt)
 {
 	struct wctdm *wc = dev_id;
 	unsigned int ints;
diff -urNad zaptel-1.2.11.dfsg~/wcte11xp.c zaptel-1.2.11.dfsg/wcte11xp.c
--- zaptel-1.2.11.dfsg~/wcte11xp.c	2009-01-11 13:56:17.000000000 +0200
+++ zaptel-1.2.11.dfsg/wcte11xp.c	2009-01-11 13:58:18.000000000 +0200
@@ -1257,11 +1257,7 @@
 	}
 }
 
-#ifdef LINUX26
-static irqreturn_t t1xxp_interrupt(int irq, void *dev_id, struct pt_regs *regs)
-#else
-static void t1xxp_interrupt(int irq, void *dev_id, struct pt_regs *regs)
-#endif
+ZAP_IRQ_HANDLER(t1xxp_interrupt)
 {
 	struct t1 *wc = dev_id;
 	unsigned char ints;
diff -urNad zaptel-1.2.11.dfsg~/wcusb.c zaptel-1.2.11.dfsg/wcusb.c
--- zaptel-1.2.11.dfsg~/wcusb.c	2009-01-11 13:56:17.000000000 +0200
+++ zaptel-1.2.11.dfsg/wcusb.c	2009-01-11 13:58:18.000000000 +0200
@@ -184,7 +184,7 @@
 }					  
 
 #ifdef USB2420
-#ifdef LINUX26
+#if defined(LINUX26) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
 static int wcusb_async_read(struct wc_usb_pvt *p, unsigned char index, unsigned char *data, int len, int state, void (*complete)(struct urb *urb, struct pt_regs *regs));
 static int wcusb_async_write(struct wc_usb_pvt *p, unsigned char index, unsigned char *data, int len, int state, void (*complete)(struct urb *urb, struct pt_regs *regs));
 static void wcusb_async_control(struct urb *urb, struct pt_regs *regs);
@@ -220,7 +220,7 @@
 }
 
 #ifdef USB2420
-#ifdef LINUX26
+#if defined(LINUX26) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
 static void wcusb_async_control(struct urb *urb, struct pt_regs *regs)
 #else
 static void wcusb_async_control(struct urb *urb)
@@ -312,7 +312,7 @@
 }
 
 #ifdef USB2420
-#ifdef LINUX26
+#if defined(LINUX26) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
 static void keypad_check_done(struct urb *urb, struct pt_regs *regs)
 #else
 static void keypad_check_done(struct urb *urb)
@@ -429,7 +429,7 @@
 }
 
 #ifdef USB2420
-#ifdef LINUX26
+#if defined(LINUX26) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
 static int wcusb_async_read(struct wc_usb_pvt *p, unsigned char index, unsigned char *data, int len, int state, void (*complete)(struct urb *urb, struct pt_regs *regs))
 #else
 static int wcusb_async_read(struct wc_usb_pvt *p, unsigned char index, unsigned char *data, int len, int state, void (*complete)(struct urb *urb))
@@ -477,7 +477,7 @@
 }
 
 #ifdef USB2420
-#ifdef LINUX26
+#if defined(LINUX26) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
 static int wcusb_async_write(struct wc_usb_pvt *p, unsigned char index, unsigned char *data, int len, int state, void (*complete)(struct urb *urb, struct pt_regs *regs))
 #else
 static int wcusb_async_write(struct wc_usb_pvt *p, unsigned char index, unsigned char *data, int len, int state, void (*complete)(struct urb *urb))
@@ -883,7 +883,7 @@
 	return ZT_LIN2MU(linsample);
 }
 
-#ifdef LINUX26
+#if defined(LINUX26)  && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
 static void wcusb_read_complete(struct urb *q, struct pt_regs *regs)
 #else
 static void wcusb_read_complete(struct urb *q)
@@ -949,7 +949,7 @@
 	return;
 }
 
-#ifdef LINUX26
+#if defined(LINUX26) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
 static void wcusb_write_complete(struct urb *q, struct pt_regs *regs)
 #else
 static void wcusb_write_complete(struct urb *q)
diff -urNad zaptel-1.2.11.dfsg~/zaphfc/zaphfc.c zaptel-1.2.11.dfsg/zaphfc/zaphfc.c
--- zaptel-1.2.11.dfsg~/zaphfc/zaphfc.c	2009-01-11 13:58:18.000000000 +0200
+++ zaptel-1.2.11.dfsg/zaphfc/zaphfc.c	2009-01-11 13:58:18.000000000 +0200
@@ -543,11 +543,7 @@
 }
 
 #ifndef RTAITIMING
-#ifdef LINUX26
-static irqreturn_t hfc_interrupt(int irq, void *dev_id, struct pt_regs *regs) {
-#else
-static void hfc_interrupt(int irq, void *dev_id, struct pt_regs *regs) {
-#endif
+ZAP_IRQ_HANDLER(hfc_interrupt) {
     struct hfc_card *hfctmp = dev_id;
     unsigned long flags = 0;
     unsigned char stat;
diff -urNad zaptel-1.2.11.dfsg~/zaptel.h zaptel-1.2.11.dfsg/zaptel.h
--- zaptel-1.2.11.dfsg~/zaptel.h	2009-01-11 13:58:18.000000000 +0200
+++ zaptel-1.2.11.dfsg/zaptel.h	2009-01-11 13:58:18.000000000 +0200
@@ -66,6 +66,16 @@
 #define ZAP_IRQ_SHARED_DISABLED SA_SHIRQ | SA_INTERRUPT
 #endif
 
+#ifdef LINUX26
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
+#define ZAP_IRQ_HANDLER(a) static irqreturn_t a(int irq, void *dev_id)
+#else
+#define ZAP_IRQ_HANDLER(a) static irqreturn_t a(int irq, void *dev_id, struct pt_regs *regs)
+#endif
+#else
+#define ZAP_IRQ_HANDLER(a) static void a(int irq, void *dev_id, struct pt_regs *regs)
+#endif
+
 #include "ecdis.h"
 #include "fasthdlc.h"
 #endif
diff -urNad zaptel-1.2.11.dfsg~/ztgsm/ztgsm.c zaptel-1.2.11.dfsg/ztgsm/ztgsm.c
--- zaptel-1.2.11.dfsg~/ztgsm/ztgsm.c	2009-01-11 13:58:18.000000000 +0200
+++ zaptel-1.2.11.dfsg/ztgsm/ztgsm.c	2009-01-11 13:58:18.000000000 +0200
@@ -759,11 +759,7 @@
 
 
 
-#ifdef LINUX26
-static irqreturn_t ztgsm_interrupt(int irq, void *dev_id, struct pt_regs *regs) {
-#else
-static void ztgsm_interrupt(int irq, void *dev_id, struct pt_regs *regs) {
-#endif
+ZAP_IRQ_HANDLER(ztgsm_interrupt) {
     struct ztgsm_card *gsmtmp = dev_id;
     unsigned int ser_status = 0;
     unsigned char mods = 0;
-------------- next part --------------
#! /bin/sh /usr/share/dpatch/dpatch-run
## zapirq_2622.dpatch by Tzafrir Cohen <tzafrir.cohen at xorcom.com>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Fix compatibility issue with kernels >= 2.6.22: slightly
## DP: different interface to request_irq . The constants ZAP_IRQ_*
## DP: have been introduced to avoid duplicating ifdef-s all over.
## DP:
## DP: Upstream fix: 
## DP: http://svn.digium.com/view/zaptel?view=revision&revision=2756
## DP: (Patch to wctdm24xxp.c was slightly edited)
## DP: Also applied to all the external drivers.

@DPATCH@
diff -urNad zaptel-1.2.11.dfsg~/cwain/cwain.c zaptel-1.2.11.dfsg/cwain/cwain.c
--- zaptel-1.2.11.dfsg~/cwain/cwain.c	2009-01-11 13:49:02.000000000 +0200
+++ zaptel-1.2.11.dfsg/cwain/cwain.c	2009-01-11 13:52:13.000000000 +0200
@@ -1355,16 +1355,16 @@
     cwaintmp->irq = cwaintmp->span[0]->irq;
     
     if (cwaintmp->spans == 2) {
-	if (request_irq(cwaintmp->irq, cwain_interrupt, SA_INTERRUPT | SA_SHIRQ, "cwain2", cwaintmp)) {
+	if (request_irq(cwaintmp->irq, cwain_interrupt, ZAP_IRQ_SHARED_DISABLED, "cwain2", cwaintmp)) {
     	    printk(KERN_WARNING "cwain: unable to register irq\n");
 	    return -1;
 	}
-	if (request_irq(cwaintmp->span[1]->irq, cwain_dummy_interrupt, SA_INTERRUPT | SA_SHIRQ, "cwaindummy", cwaintmp)) {
+	if (request_irq(cwaintmp->span[1]->irq, cwain_dummy_interrupt, ZAP_IRQ_SHARED_DISABLED, "cwaindummy", cwaintmp)) {
     	    printk(KERN_WARNING "cwain: unable to register irq\n");
 	    return -1;
 	}
     } else {
-	if (request_irq(cwaintmp->irq, cwain_interrupt, SA_INTERRUPT | SA_SHIRQ, "cwain", cwaintmp)) {
+	if (request_irq(cwaintmp->irq, cwain_interrupt, ZAP_IRQ_SHARED_DISABLED, "cwain", cwaintmp)) {
     	    printk(KERN_WARNING "cwain: unable to register irq\n");
 	    return -1;
 	}
diff -urNad zaptel-1.2.11.dfsg~/opvxa1200.c zaptel-1.2.11.dfsg/opvxa1200.c
--- zaptel-1.2.11.dfsg~/opvxa1200.c	2009-01-11 13:49:02.000000000 +0200
+++ zaptel-1.2.11.dfsg/opvxa1200.c	2009-01-11 13:54:44.000000000 +0200
@@ -2469,7 +2469,7 @@
 			/* Keep track of which device we are */
 			pci_set_drvdata(pdev, wc);
 
-			if (request_irq(pdev->irq, wctdm_interrupt, SA_SHIRQ, "opvxa1200", wc)) {
+			if (request_irq(pdev->irq, wctdm_interrupt, ZAP_IRQ_SHARED, "opvxa1200", wc)) {
 				printk("opvxa1200: Unable to request IRQ %d\n", pdev->irq);
 				if (wc->freeregion & 0x01)
 					release_region(wc->ioaddr, 0xff);
diff -urNad zaptel-1.2.11.dfsg~/pciradio.c zaptel-1.2.11.dfsg/pciradio.c
--- zaptel-1.2.11.dfsg~/pciradio.c	2009-01-11 13:49:02.000000000 +0200
+++ zaptel-1.2.11.dfsg/pciradio.c	2009-01-11 13:49:02.000000000 +0200
@@ -1711,7 +1711,7 @@
 
 			}
 
-			if (request_irq(pdev->irq, pciradio_interrupt, SA_SHIRQ, "pciradio", rad)) {
+			if (request_irq(pdev->irq, pciradio_interrupt, ZAP_IRQ_SHARED, "pciradio", rad)) {
 				printk("pciradio: Unable to request IRQ %d\n", pdev->irq);
 				if (rad->freeregion)
 					release_region(rad->ioaddr, 0xff);
diff -urNad zaptel-1.2.11.dfsg~/qozap/qozap.c zaptel-1.2.11.dfsg/qozap/qozap.c
--- zaptel-1.2.11.dfsg~/qozap/qozap.c	2009-01-11 13:49:02.000000000 +0200
+++ zaptel-1.2.11.dfsg/qozap/qozap.c	2009-01-11 13:52:38.000000000 +0200
@@ -1410,7 +1410,7 @@
 	    return -EIO;
 	}
 	
-	if (request_irq(qoztmp->irq, qoz_interrupt, SA_INTERRUPT | SA_SHIRQ, "qozap", qoztmp)) {
+	if (request_irq(qoztmp->irq, qoz_interrupt, ZAP_IRQ_SHARED_DISABLED, "qozap", qoztmp)) {
 	    printk(KERN_WARNING "qozap: unable to register irq\n");
 	    kfree(qoztmp);
 	    pci_disable_device(tmp);
diff -urNad zaptel-1.2.11.dfsg~/tor2.c zaptel-1.2.11.dfsg/tor2.c
--- zaptel-1.2.11.dfsg~/tor2.c	2009-01-11 13:49:02.000000000 +0200
+++ zaptel-1.2.11.dfsg/tor2.c	2009-01-11 13:49:02.000000000 +0200
@@ -536,7 +536,7 @@
 	for (x = 0; x < 256; x++) tor->mem32[x] = 0x7f7f7f7f;
 
 
-	if (request_irq(tor->irq, tor2_intr, SA_INTERRUPT | SA_SHIRQ, "tor2", tor)) {
+	if (request_irq(tor->irq, tor2_intr, ZAP_IRQ_SHARED_DISABLED, "tor2", tor)) {
 		printk(KERN_ERR "Unable to request tormenta IRQ %d\n", tor->irq);
 		goto err_out_release_all;
 	}
diff -urNad zaptel-1.2.11.dfsg~/torisa.c zaptel-1.2.11.dfsg/torisa.c
--- zaptel-1.2.11.dfsg~/torisa.c	2009-01-11 13:49:02.000000000 +0200
+++ zaptel-1.2.11.dfsg/torisa.c	2009-01-11 13:49:02.000000000 +0200
@@ -1070,7 +1070,7 @@
 		printk(KERN_ERR "No ISA tormenta card found at %05lx\n", base);
 		return -EIO;
 	}
-	if (request_irq(irq, torisa_intr, SA_INTERRUPT, "torisa", NULL)) {
+	if (request_irq(irq, torisa_intr, ZAP_IRQ_DISABLED, "torisa", NULL)) {
 		printk(KERN_ERR "Unable to request tormenta IRQ %d\n", irq);
 		return -EIO;
 	}
diff -urNad zaptel-1.2.11.dfsg~/vzaphfc/vzaphfc_main.c zaptel-1.2.11.dfsg/vzaphfc/vzaphfc_main.c
--- zaptel-1.2.11.dfsg~/vzaphfc/vzaphfc_main.c	2009-01-11 13:49:02.000000000 +0200
+++ zaptel-1.2.11.dfsg/vzaphfc/vzaphfc_main.c	2009-01-11 13:54:23.000000000 +0200
@@ -1681,7 +1681,7 @@
 	pci_write_config_dword(card->pcidev, hfc_PCI_MWBA, card->fifo_bus_mem);
 
 	if ((err = request_irq(card->pcidev->irq, &hfc_interrupt,
-		SA_SHIRQ, hfc_DRIVER_NAME, card))) {
+		ZAP_IRQ_SHARED, hfc_DRIVER_NAME, card))) {
 		printk(KERN_CRIT hfc_DRIVER_PREFIX
 			"card %d: "
 			"unable to register irq\n",
diff -urNad zaptel-1.2.11.dfsg~/wcfxo.c zaptel-1.2.11.dfsg/wcfxo.c
--- zaptel-1.2.11.dfsg~/wcfxo.c	2009-01-11 13:49:02.000000000 +0200
+++ zaptel-1.2.11.dfsg/wcfxo.c	2009-01-11 13:49:02.000000000 +0200
@@ -894,7 +894,7 @@
 			/* Keep track of which device we are */
 			pci_set_drvdata(pdev, wc);
 
-			if (request_irq(pdev->irq, wcfxo_interrupt, SA_SHIRQ, "wcfxo", wc)) {
+			if (request_irq(pdev->irq, wcfxo_interrupt, ZAP_IRQ_SHARED, "wcfxo", wc)) {
 				printk("wcfxo: Unable to request IRQ %d\n", pdev->irq);
 				if (wc->freeregion)
 					release_region(wc->ioaddr, 0xff);
diff -urNad zaptel-1.2.11.dfsg~/wct1xxp.c zaptel-1.2.11.dfsg/wct1xxp.c
--- zaptel-1.2.11.dfsg~/wct1xxp.c	2009-01-11 13:49:02.000000000 +0200
+++ zaptel-1.2.11.dfsg/wct1xxp.c	2009-01-11 13:49:02.000000000 +0200
@@ -1297,7 +1297,7 @@
 			/* Keep track of which device we are */
 			pci_set_drvdata(pdev, wc);
 
-			if (request_irq(pdev->irq, t1xxp_interrupt, SA_INTERRUPT | SA_SHIRQ, "t1xxp", wc)) {
+			if (request_irq(pdev->irq, t1xxp_interrupt, ZAP_IRQ_SHARED_DISABLED, "t1xxp", wc)) {
 				printk("t1xxp: Unable to request IRQ %d\n", pdev->irq);
 				kfree(wc);
 				return -EIO;
diff -urNad zaptel-1.2.11.dfsg~/wct4xxp/base.c zaptel-1.2.11.dfsg/wct4xxp/base.c
--- zaptel-1.2.11.dfsg~/wct4xxp/base.c	2009-01-11 13:49:02.000000000 +0200
+++ zaptel-1.2.11.dfsg/wct4xxp/base.c	2009-01-11 13:49:02.000000000 +0200
@@ -3180,14 +3180,14 @@
 
 
 #ifdef SUPPORT_GEN1
-			if (request_irq(pdev->irq, (dt->flags & FLAG_2NDGEN) ? t4_interrupt_gen2 :t4_interrupt, SA_INTERRUPT | SA_SHIRQ, (wc->numspans == 2) ? "wct2xxp" : "wct4xxp", wc)) 
+			if (request_irq(pdev->irq, (dt->flags & FLAG_2NDGEN) ? t4_interrupt_gen2 :t4_interrupt, ZAP_IRQ_SHARED_DISABLED, (wc->numspans == 2) ? "wct2xxp" : "wct4xxp", wc)) 
 #else
 			if (!(wc->tspans[0]->spanflags & FLAG_2NDGEN)) {
 				printk("This driver does not support 1st gen modules\n");
 				kfree(wc);
 				return -ENODEV;
 			}	
-			if (request_irq(pdev->irq, t4_interrupt_gen2, SA_INTERRUPT | SA_SHIRQ, "t4xxp", wc)) 
+			if (request_irq(pdev->irq, t4_interrupt_gen2, ZAP_IRQ_SHARED_DISABLED, "t4xxp", wc)) 
 #endif
 			{
 				printk("t4xxp: Unable to request IRQ %d\n", pdev->irq);
diff -urNad zaptel-1.2.11.dfsg~/wctdm.c zaptel-1.2.11.dfsg/wctdm.c
--- zaptel-1.2.11.dfsg~/wctdm.c	2009-01-11 13:49:02.000000000 +0200
+++ zaptel-1.2.11.dfsg/wctdm.c	2009-01-11 13:49:02.000000000 +0200
@@ -2235,7 +2235,7 @@
 			/* Keep track of which device we are */
 			pci_set_drvdata(pdev, wc);
 
-			if (request_irq(pdev->irq, wctdm_interrupt, SA_SHIRQ, "wctdm", wc)) {
+			if (request_irq(pdev->irq, wctdm_interrupt, ZAP_IRQ_SHARED, "wctdm", wc)) {
 				printk("wctdm: Unable to request IRQ %d\n", pdev->irq);
 				if (wc->freeregion)
 					release_region(wc->ioaddr, 0xff);
diff -urNad zaptel-1.2.11.dfsg~/wctdm24xxp.c zaptel-1.2.11.dfsg/wctdm24xxp.c
--- zaptel-1.2.11.dfsg~/wctdm24xxp.c	2009-01-11 13:49:02.000000000 +0200
+++ zaptel-1.2.11.dfsg/wctdm24xxp.c	2009-01-11 13:49:02.000000000 +0200
@@ -2744,7 +2744,7 @@
 			/* Keep track of which device we are */
 			pci_set_drvdata(pdev, wc);
 
-			if (request_irq(pdev->irq, wctdm_interrupt, SA_SHIRQ, "wctdm24xxp", wc)) {
+			if (request_irq(pdev->irq, wctdm_interrupt, ZAP_IRQ_SHARED, "wctdm24xxp", wc)) {
 				printk("wctdm: Unable to request IRQ %d\n", pdev->irq);
 				if (wc->freeregion)
 					release_region(wc->iobase, 0xff);
diff -urNad zaptel-1.2.11.dfsg~/wcte11xp.c zaptel-1.2.11.dfsg/wcte11xp.c
--- zaptel-1.2.11.dfsg~/wcte11xp.c	2009-01-11 13:49:02.000000000 +0200
+++ zaptel-1.2.11.dfsg/wcte11xp.c	2009-01-11 13:49:02.000000000 +0200
@@ -1452,7 +1452,7 @@
 			/* Keep track of which device we are */
 			pci_set_drvdata(pdev, wc);
 
-			if (request_irq(pdev->irq, t1xxp_interrupt, SA_INTERRUPT | SA_SHIRQ, "wcte11xp", wc)) {
+			if (request_irq(pdev->irq, t1xxp_interrupt, ZAP_IRQ_SHARED_DISABLED, "wcte11xp", wc)) {
 				printk("wcte11xp: Unable to request IRQ %d\n", pdev->irq);
 				kfree(wc);
 				return -EIO;
diff -urNad zaptel-1.2.11.dfsg~/zaphfc/zaphfc.c zaptel-1.2.11.dfsg/zaphfc/zaphfc.c
--- zaptel-1.2.11.dfsg~/zaphfc/zaphfc.c	2009-01-11 13:49:02.000000000 +0200
+++ zaptel-1.2.11.dfsg/zaphfc/zaphfc.c	2009-01-11 13:53:01.000000000 +0200
@@ -1006,7 +1006,7 @@
 	/* we need no stinking irq */
 	hfctmp->irq = 0;
 #else
-	if (request_irq(hfctmp->irq, &hfc_interrupt, SA_INTERRUPT | SA_SHIRQ, "zaphfc", hfctmp)) {
+	if (request_irq(hfctmp->irq, &hfc_interrupt, ZAP_IRQ_SHARED_DISABLED, "zaphfc", hfctmp)) {
 	    printk(KERN_WARNING "zaphfc: unable to register irq\n");
 	    kfree(hfctmp->fifomem);
 	    kfree(hfctmp);
diff -urNad zaptel-1.2.11.dfsg~/zaptel.h zaptel-1.2.11.dfsg/zaptel.h
--- zaptel-1.2.11.dfsg~/zaptel.h	2009-01-11 13:49:02.000000000 +0200
+++ zaptel-1.2.11.dfsg/zaptel.h	2009-01-11 13:49:02.000000000 +0200
@@ -76,6 +76,16 @@
 #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,22)
+#define ZAP_IRQ_SHARED IRQF_SHARED
+#define ZAP_IRQ_DISABLED IRQF_DISABLED
+#define ZAP_IRQ_SHARED_DISABLED IRQF_SHARED | IRQF_DISABLED
+#else
+#define ZAP_IRQ_SHARED SA_SHIRQ
+#define ZAP_IRQ_DISABLED SA_INTERRUPT
+#define ZAP_IRQ_SHARED_DISABLED SA_SHIRQ | SA_INTERRUPT
+#endif
+
 #include "ecdis.h"
 #include "fasthdlc.h"
 #endif
diff -urNad zaptel-1.2.11.dfsg~/ztdummy.c zaptel-1.2.11.dfsg/ztdummy.c
--- zaptel-1.2.11.dfsg~/ztdummy.c	2009-01-11 13:48:52.000000000 +0200
+++ zaptel-1.2.11.dfsg/ztdummy.c	2009-01-11 13:49:02.000000000 +0200
@@ -265,13 +265,13 @@
     irq=s->irq;
     spin_lock_irq(&mylock);
     free_irq(s->irq, s);	/* remove uhci_interrupt temporaly */
-    if (request_irq (irq, ztdummy_interrupt, SA_SHIRQ, "ztdummy", ztd)) {
+    if (request_irq (irq, ztdummy_interrupt, ZAP_IRQ_SHARED, "ztdummy", ztd)) {
     	spin_unlock_irq(&mylock);
 		err("Our request_irq %d failed!",irq);
 		kfree(ztd);
 		return -EIO;
     }		/* we add our handler first, to assure, that our handler gets called first */
-    if (request_irq (irq, uhci_interrupt, SA_SHIRQ, s->uhci_pci->driver->name, s)) {
+    if (request_irq (irq, uhci_interrupt, ZAP_IRQ_SHARED, s->uhci_pci->driver->name, s)) {
         spin_unlock_irq(&mylock);
 		err("Original request_irq %d failed!",irq);
     }
diff -urNad zaptel-1.2.11.dfsg~/ztgsm/ztgsm.c zaptel-1.2.11.dfsg/ztgsm/ztgsm.c
--- zaptel-1.2.11.dfsg~/ztgsm/ztgsm.c	2009-01-11 13:49:02.000000000 +0200
+++ zaptel-1.2.11.dfsg/ztgsm/ztgsm.c	2009-01-11 13:53:18.000000000 +0200
@@ -1083,7 +1083,7 @@
 	    return -EIO;
 	}
 	
-	if (request_irq(gsmtmp->irq, ztgsm_interrupt, SA_INTERRUPT | SA_SHIRQ, "ztgsm", gsmtmp)) {
+	if (request_irq(gsmtmp->irq, ztgsm_interrupt, ZAP_IRQ_SHARED_DISABLED, "ztgsm", gsmtmp)) {
 	    printk(KERN_WARNING "ztgsm: unable to register irq\n");
 	    release_region(gsmtmp->ioport, 0x100);
 	    release_mem_region(gsmtmp->pci_io_phys, gsmtmp->iomem_size);
-------------- next part --------------
#! /bin/sh /usr/share/dpatch/dpatch-run
## zapirq_wctdm24xxp.dpatch by Tzafrir Cohen <tzafrir.cohen at xorcom.com>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: wctdm24xxp.c accidentally missed using a compatibility macro.
## DP: Upstream: http://svn.digium.com/view/zaptel?view=revision&revision=2765
## DP: Also applied to vzaphfc.

@DPATCH@
diff -urNad zaptel-1.2.11.dfsg~/vzaphfc/vzaphfc_main.c zaptel-1.2.11.dfsg/vzaphfc/vzaphfc_main.c
--- zaptel-1.2.11.dfsg~/vzaphfc/vzaphfc_main.c	2009-01-11 14:00:18.000000000 +0200
+++ zaptel-1.2.11.dfsg/vzaphfc/vzaphfc_main.c	2009-01-11 14:02:20.000000000 +0200
@@ -1970,7 +1970,7 @@
 
 	hfc_proc_zaphfc_dir = proc_mkdir(hfc_DRIVER_NAME, proc_root_driver);
 
-	ret = pci_module_init(&hfc_driver);
+	ret = zap_pci_module(&hfc_driver);
 	return ret;
 }
 
diff -urNad zaptel-1.2.11.dfsg~/wctdm24xxp.c zaptel-1.2.11.dfsg/wctdm24xxp.c
--- zaptel-1.2.11.dfsg~/wctdm24xxp.c	2009-01-11 14:00:18.000000000 +0200
+++ zaptel-1.2.11.dfsg/wctdm24xxp.c	2009-01-11 14:00:18.000000000 +0200
@@ -2861,7 +2861,7 @@
 		return -ENODEV;
 	}
 
-	res = pci_module_init(&wctdm_driver);
+	res = zap_pci_module(&wctdm_driver);
 	if (res)
 		return -ENODEV;
 	return 0;
-------------- next part --------------
#! /bin/sh /usr/share/dpatch/dpatch-run
## netdev_2622.dpatch by Tzafrir Cohen <tzafrir.cohen at xorcom.com>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Fix ztd-eth.c for network interface changes in 2.6.22.
## DP: Upstream: http://svn.digium.com/view/zaptel?view=revision&revision=2675

@DPATCH@
diff -urNad zaptel-1.2.11.dfsg~/ztd-eth.c zaptel-1.2.11.dfsg/ztd-eth.c
--- zaptel-1.2.11.dfsg~/ztd-eth.c	2005-11-29 20:42:08.000000000 +0200
+++ zaptel-1.2.11.dfsg/ztd-eth.c	2009-01-10 21:44:36.000000000 +0200
@@ -88,7 +88,11 @@
 {
 	struct zt_span *span;
 	struct ztdeth_header *zh;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
+	zh = (struct ztdeth_header *)skb_network_header(skb);
+#else
 	zh = (struct ztdeth_header *)skb->nh.raw;
+#endif
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,9)
 	span = ztdeth_getspan(eth_hdr(skb)->h_source, zh->subaddr);
 #else
@@ -167,7 +171,11 @@
 
 			/* Setup protocol and such */
 			skb->protocol = __constant_htons(ETH_P_ZTDETH);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
+			skb_set_network_header(skb, 0);
+#else
 			skb->nh.raw = skb->data;
+#endif
 			skb->dev = dev;
 			if (dev->hard_header)
 				dev->hard_header(skb, dev, ETH_P_ZTDETH, addr, dev->dev_addr, skb->len);
-------------- next part --------------
#! /bin/sh /usr/share/dpatch/dpatch-run
## netdev_2623.dpatch by Tzafrir Cohen <tzafrir.cohen at xorcom.com>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Some more netdev interface changes fixes. 
## DP: Commit header claims that they are for 2.6.22, but in one place
## DP: it is for 2.6.23. 
## DP: Upstream: http://svn.digium.com/view/zaptel?view=revision&revision=3737
## DP: also applied to vzaphfc.

@DPATCH@
diff -urNad zaptel-1.2.11.dfsg~/vzaphfc/vzaphfc_main.c zaptel-1.2.11.dfsg/vzaphfc/vzaphfc_main.c
--- zaptel-1.2.11.dfsg~/vzaphfc/vzaphfc_main.c	2009-01-11 15:51:06.000000000 +0200
+++ zaptel-1.2.11.dfsg/vzaphfc/vzaphfc_main.c	2009-01-11 15:54:09.000000000 +0200
@@ -1585,7 +1585,9 @@
 
 	memset(chan->netdev->dev_addr, 0x00, sizeof(chan->netdev->dev_addr));
 
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,23)
 	SET_MODULE_OWNER(chan->netdev);
+#endif
 }
 
 static int __devinit hfc_probe(struct pci_dev *pci_dev,
diff -urNad zaptel-1.2.11.dfsg~/zaptel.c zaptel-1.2.11.dfsg/zaptel.c
--- zaptel-1.2.11.dfsg~/zaptel.c	2009-01-11 15:51:06.000000000 +0200
+++ zaptel-1.2.11.dfsg/zaptel.c	2009-01-11 15:53:02.000000000 +0200
@@ -3295,7 +3295,9 @@
 				chans[ch.chan]->hdlcnetdev->netdev = alloc_hdlcdev(chans[ch.chan]->hdlcnetdev);
 				if (chans[ch.chan]->hdlcnetdev->netdev) {
 					chans[ch.chan]->hdlcnetdev->chan = chans[ch.chan];
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,23)
 					SET_MODULE_OWNER(chans[ch.chan]->hdlcnetdev->netdev);
+#endif
 					chans[ch.chan]->hdlcnetdev->netdev->irq = chans[ch.chan]->span->irq;
 					chans[ch.chan]->hdlcnetdev->netdev->tx_queue_len = 50;
 					chans[ch.chan]->hdlcnetdev->netdev->do_ioctl = zt_net_ioctl;
@@ -6111,7 +6113,11 @@
 		if (skb && (ms->flags & ZT_FLAG_NETDEV))
 #ifdef NEW_HDLC_INTERFACE
 		{
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,22)
 			skb->mac.raw = skb->data;
+#else
+			skb_reset_mac_header(skb);
+#endif
 			skb->dev = ztchan_to_dev(ms);
 #ifdef ZAP_HDLC_TYPE_TRANS
 			skb->protocol = hdlc_type_trans(skb, ztchan_to_dev(ms));
-------------- next part --------------
#! /bin/sh /usr/share/dpatch/dpatch-run
## netdev_2624.dpatch by Tzafrir Cohen <tzafrir.cohen at xorcom.com>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Fix ztd-eth.c for network interface changes in 2.6.24.
## DP: Upstream: http://svn.digium.com/view/zaptel?view=revision&revision=3577

@DPATCH@
diff -urNad zaptel-1.2.11.dfsg~/vzaphfc/lapd.c zaptel-1.2.11.dfsg/vzaphfc/lapd.c
--- zaptel-1.2.11.dfsg~/vzaphfc/lapd.c	2009-01-11 16:42:53.000000000 +0200
+++ zaptel-1.2.11.dfsg/vzaphfc/lapd.c	2009-01-11 16:43:33.000000000 +0200
@@ -7,6 +7,7 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/version.h>
 #include <linux/netdevice.h>
 
 #include "lapd.h"
@@ -25,11 +26,13 @@
 {
 
 	netdev->change_mtu         = lapd_change_mtu;
+	netdev->set_mac_address    = lapd_mac_addr;
+#if  LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
 	netdev->hard_header        = NULL;
 	netdev->rebuild_header     = NULL;
-	netdev->set_mac_address    = lapd_mac_addr;
 	netdev->hard_header_cache  = NULL;
 	netdev->header_cache_update= NULL;
+#endif
 
 	netdev->type               = ARPHRD_LAPD;
 	netdev->hard_header_len    = 0;
diff -urNad zaptel-1.2.11.dfsg~/ztd-eth.c zaptel-1.2.11.dfsg/ztd-eth.c
--- zaptel-1.2.11.dfsg~/ztd-eth.c	2009-01-11 16:43:00.000000000 +0200
+++ zaptel-1.2.11.dfsg/ztd-eth.c	2009-01-11 16:43:00.000000000 +0200
@@ -177,8 +177,12 @@
 			skb->nh.raw = skb->data;
 #endif
 			skb->dev = dev;
+#if  LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
+			dev_hard_header(skb, dev, ETH_P_ZTDETH, addr, dev->dev_addr, skb->len);
+#else
 			if (dev->hard_header)
 				dev->hard_header(skb, dev, ETH_P_ZTDETH, addr, dev->dev_addr, skb->len);
+#endif
 			dev_queue_xmit(skb);
 		}
 	}
@@ -355,7 +359,11 @@
 			}
 			z->subaddr = htons(sub);
 		}
-		z->dev = dev_get_by_name(z->ethdev);
+		z->dev = dev_get_by_name(
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
+				&init_net,
+#endif
+				z->ethdev);
 		if (!z->dev) {
 			printk("TDMoE: Invalid device '%s'\n", z->ethdev);
 			kfree(z);
-------------- next part --------------
#! /bin/sh /usr/share/dpatch/dpatch-run
## vzaphfc_config_h.dpatch by Tzafrir Cohen <tzafrir.cohen at xorcom.com>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: <linux/config.h> is no longer needed.

@DPATCH@
diff -urNad zaptel-1.2.11.dfsg~/vzaphfc/vzaphfc_main.c zaptel-1.2.11.dfsg/vzaphfc/vzaphfc_main.c
--- zaptel-1.2.11.dfsg~/vzaphfc/vzaphfc_main.c	2009-01-11 16:19:17.000000000 +0200
+++ zaptel-1.2.11.dfsg/vzaphfc/vzaphfc_main.c	2009-01-11 16:20:10.000000000 +0200
@@ -21,7 +21,6 @@
 
 #include <linux/spinlock.h>
 #include <linux/init.h>
-#include <linux/config.h>
 #include <linux/pci.h>
 #include <linux/interrupt.h>
 #include <linux/module.h>
-------------- next part --------------
#! /bin/sh /usr/share/dpatch/dpatch-run
## xpp_bool.dpatch by Tzafrir Cohen <tzafrir.cohen at xorcom.com>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: The code of xpp used 'bool' before it was an official type of 
## DP: the kernel.
## DP: Backport based on later xpp code.

@DPATCH@
diff -urNad zaptel-1.2.11.dfsg~/xpp/card_fxo.c zaptel-1.2.11.dfsg/xpp/card_fxo.c
--- zaptel-1.2.11.dfsg~/xpp/card_fxo.c	2006-09-09 18:24:12.000000000 +0300
+++ zaptel-1.2.11.dfsg/xpp/card_fxo.c	2009-01-12 00:35:10.000000000 +0200
@@ -35,7 +35,7 @@
 
 DEF_PARM(int, print_dbg, 0, "Print DBG statements");	/* must be before zap_debug.h */
 DEF_PARM(uint, poll_battery_interval, 100, "Poll battery interval in milliseconds");
-DEF_PARM(bool, report_battery, 0, "Report battery status to zaptel");
+DEF_PARM_BOOL(report_battery, 0, "Report battery status to zaptel");
 
 /* Signaling is opposite (fxs signalling for fxo card) */
 #if 1
diff -urNad zaptel-1.2.11.dfsg~/xpp/card_fxs.c zaptel-1.2.11.dfsg/xpp/card_fxs.c
--- zaptel-1.2.11.dfsg~/xpp/card_fxs.c	2006-09-09 18:24:12.000000000 +0300
+++ zaptel-1.2.11.dfsg/xpp/card_fxs.c	2009-01-12 00:34:42.000000000 +0200
@@ -34,7 +34,7 @@
 static const char rcsid[] = "$Id: card_fxs.c 1457 2006-09-09 15:24:12Z tzafrir $";
 
 DEF_PARM(int, print_dbg, 0, "Print DBG statements");	/* must be before zap_debug.h */
-DEF_PARM(bool, poll_digital_inputs, 1, "Poll Digital Inputs");	/* must be before zap_debug.h */
+DEF_PARM_BOOL(poll_digital_inputs, 1, "Poll Digital Inputs");	/* must be before zap_debug.h */
 
 /* Signaling is opposite (fxo signalling for fxs card) */
 #if 1
diff -urNad zaptel-1.2.11.dfsg~/xpp/xdefs.h zaptel-1.2.11.dfsg/xpp/xdefs.h
--- zaptel-1.2.11.dfsg~/xpp/xdefs.h	2009-01-12 00:31:50.000000000 +0200
+++ zaptel-1.2.11.dfsg/xpp/xdefs.h	2009-01-12 00:31:56.000000000 +0200
@@ -25,6 +25,7 @@
 #ifdef	__KERNEL__
 
 #include <linux/kernel.h>
+#include <linux/version.h>
 
 #else
 
@@ -90,7 +91,9 @@
 
 typedef char			*charp;
 typedef unsigned char		byte;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
 typedef int			bool;
+#endif
 typedef struct xbus		xbus_t;
 typedef	struct xpd		xpd_t;
 typedef	struct xpacket_raw	xpacket_raw_t;
diff -urNad zaptel-1.2.11.dfsg~/xpp/xpd.h zaptel-1.2.11.dfsg/xpp/xpd.h
--- zaptel-1.2.11.dfsg~/xpp/xpd.h	2009-01-12 00:31:50.000000000 +0200
+++ zaptel-1.2.11.dfsg/xpp/xpd.h	2009-01-12 00:31:56.000000000 +0200
@@ -40,6 +40,17 @@
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
 typedef	unsigned gfp_t;		/* Added in 2.6.14 */
 #endif
+
+/*
+ * FIXME: Kludge for 2.6.19
+ * bool is now defined as a proper boolean type (gcc _Bool)
+ * but the command line parsing framework handles it as int.
+ */
+#define DEF_PARM_BOOL(name,init,desc)	\
+	int name = init;	\
+	module_param(name, bool, 0600);		\
+	MODULE_PARM_DESC(name, desc)
+
 #define	DEF_PARM(type,name,init,desc)	\
 	type name = init;	\
 	module_param(name, type, 0600);		\
diff -urNad zaptel-1.2.11.dfsg~/xpp/xpp_zap.c zaptel-1.2.11.dfsg/xpp/xpp_zap.c
--- zaptel-1.2.11.dfsg~/xpp/xpp_zap.c	2009-01-12 00:31:50.000000000 +0200
+++ zaptel-1.2.11.dfsg/xpp/xpp_zap.c	2009-01-12 00:32:58.000000000 +0200
@@ -67,8 +67,8 @@
 
 DEF_PARM(int, print_dbg, 0, "Print DBG statements");
 DEF_PARM(int, max_queue_len, MAX_QUEUE_LEN, "Maximum Queue Length.");
-DEF_PARM(bool, have_sync_bus, 0, "True if all Astribank(TM) devices are connected via a sync-cable");
-DEF_PARM(bool, zap_autoreg, 1, "Register spans automatically (1) or not (0)");
+DEF_PARM_BOOL(have_sync_bus, 0, "True if all Astribank(TM) devices are connected via a sync-cable");
+DEF_PARM_BOOL(zap_autoreg, 1, "Register spans automatically (1) or not (0)");
 
 #include "zap_debug.h"
 #ifdef	XPP_EC_CHUNK
@@ -722,7 +722,7 @@
 	xbus_t		*xbus;
 	xpd_t		*xpd;
 	int		ret;
-	bool		setit;
+	int		setit;
 
 	// DBG("%s: count=%ld\n", __FUNCTION__, count);
 	if(count >= MAX_PROC_WRITE)
@@ -793,7 +793,7 @@
 {
 	xpd_t		*xpd = data;
 	char		buf[MAX_PROC_WRITE];
-	bool		zt_reg;
+	int		zt_reg;
 	int		ret;
 
 	BUG_ON(!xpd);
-------------- next part --------------
#! /bin/sh /usr/share/dpatch/dpatch-run
## xpp_init_work.dpatch by Tzafrir Cohen <tzafrir.cohen at xorcom.com>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Yet another kernel interface change that needed to be ifdefed-
## DP: around. This is the later xpp code.

@DPATCH@
diff -urNad zaptel-1.2.11.dfsg~/xpp/xbus-core.c zaptel-1.2.11.dfsg/xpp/xbus-core.c
--- zaptel-1.2.11.dfsg~/xpp/xbus-core.c	2006-09-09 18:24:12.000000000 +0300
+++ zaptel-1.2.11.dfsg/xpp/xbus-core.c	2009-01-11 17:42:20.000000000 +0200
@@ -437,7 +437,11 @@
 	xbus->hardware_exists = 1;
 	DBG("Activating: %s\n", xbus->busname);
 	/* Poll it */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
+	INIT_WORK(&xbus->xpds_init_work, (void (*)(void *))xbus_poll);
+#else
 	INIT_WORK(&xbus->xpds_init_work, (void (*)(void *))xbus_poll, (void *)xbus);
+#endif
 	if(!queue_work(xpp_worker, &xbus->xpds_init_work)) {
 		ERR("Failed to queue xpd initialization work\n");
 		/* FIXME: need to return error */
-------------- next part --------------
#! /bin/sh /usr/share/dpatch/dpatch-run
## xpp_usb_2620.dpatch by Tzafrir Cohen <tzafrir.cohen at xorcom.com>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Two more backports, both from kernel 2.6.20.
## DP: Again, backported from later xpp code.

@DPATCH@
diff -urNad zaptel-1.2.11.dfsg~/xpp/xbus-core.c zaptel-1.2.11.dfsg/xpp/xbus-core.c
--- zaptel-1.2.11.dfsg~/xpp/xbus-core.c	2009-01-12 00:47:02.000000000 +0200
+++ zaptel-1.2.11.dfsg/xpp/xbus-core.c	2009-01-12 00:52:28.000000000 +0200
@@ -85,7 +85,11 @@
 static	DEVICE_ATTR(status, S_IRUGO, status_show, NULL);
 
 /*------------------------- Packet Handling ------------------------*/
-static kmem_cache_t	*packet_cache = NULL;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+static kmem_cache_t		*packet_cache = NULL;
+#else
+static struct kmem_cache	*packet_cache = NULL;
+#endif
 static atomic_t	xpacket_count = ATOMIC_INIT(0);
 
 /**
diff -urNad zaptel-1.2.11.dfsg~/xpp/xpp_usb.c zaptel-1.2.11.dfsg/xpp/xpp_usb.c
--- zaptel-1.2.11.dfsg~/xpp/xpp_usb.c	2006-09-09 18:24:12.000000000 +0300
+++ zaptel-1.2.11.dfsg/xpp/xpp_usb.c	2009-01-12 00:51:18.000000000 +0200
@@ -164,10 +164,17 @@
 static int xusb_release		(struct inode *inode, struct file *file);
 static void xusb_write_bulk_callback	(struct urb *urb, struct pt_regs *regs);
 #endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+#define USB_PASS_CB(u)  struct urb *u, struct pt_regs *regs
+#else
+#define USB_PASS_CB(u)  struct urb *u
+#endif
+
 static void xpp_urb_delete(struct urb *urb);
 static struct urb *xpp_urb_new(xusb_t *dev, enum xusb_dir dir, size_t size);
-static void xpp_send_callback(struct urb *urb, struct pt_regs *regs);
-static void xpp_receive_callback(struct urb *urb, struct pt_regs *regs);
+static void xpp_send_callback(USB_PASS_CB(urb));
+static void xpp_receive_callback(USB_PASS_CB(urb));
 
 static int xusb_probe		(struct usb_interface *interface, const struct usb_device_id *id);
 static void xusb_disconnect	(struct usb_interface *interface);
@@ -742,7 +749,7 @@
 	INFO("XUSB #%d now disconnected\n", minor);
 }
 
-static void xpp_send_callback(struct urb *urb, struct pt_regs *regs)
+static void xpp_send_callback(USB_PASS_CB(urb))
 {
 	xusb_t			*xusb = (xusb_t *)urb->context;
 	xbus_t			*xbus = xusb->xbus;
@@ -765,7 +772,7 @@
 	XUSB_COUNTER(xusb, TX_PACKETS)++;
 }
 
-static void xpp_receive_callback(struct urb *urb, struct pt_regs *regs)
+static void xpp_receive_callback(USB_PASS_CB(urb))
 {
 	xusb_t		*xusb = (xusb_t *)urb->context;
 	xbus_t		*xbus;


More information about the Pkg-voip-maintainers mailing list