From 446f56766abc49dc0ded2240f61c14edce99092b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20R=C4=99korajski?= Date: Sat, 9 Mar 2019 22:41:50 +0100 Subject: [PATCH] - up to 3.0.0, doesn't build with kernel 5.0 --- ...command_timer-functions-to-xbus-core.patch | 97 ------ ...ing-with-4.15-init_timer-setup_timer.patch | 296 ----------------- dahdi-linux.spec | 14 +- kernel-4.11.patch | 141 --------- kernel-4.13.patch | 299 ------------------ 5 files changed, 3 insertions(+), 844 deletions(-) delete mode 100644 0001-xpp-move-command_timer-functions-to-xbus-core.patch delete mode 100644 0002-fix-building-with-4.15-init_timer-setup_timer.patch delete mode 100644 kernel-4.11.patch delete mode 100644 kernel-4.13.patch diff --git a/0001-xpp-move-command_timer-functions-to-xbus-core.patch b/0001-xpp-move-command_timer-functions-to-xbus-core.patch deleted file mode 100644 index b3070b3..0000000 --- a/0001-xpp-move-command_timer-functions-to-xbus-core.patch +++ /dev/null @@ -1,97 +0,0 @@ -From 529b104aacaa6164d39e955003718bf15edcf08e Mon Sep 17 00:00:00 2001 -From: Tzafrir Cohen -Date: Mon, 1 Jan 2018 16:06:25 +0200 -Subject: [PATCH 1/2] xpp: move command_timer functions to xbus-core - -Would allow to later fully initializing the command_timer in xbus-core.c -rather than xbus-pcm.c . ---- - drivers/dahdi/xpp/xbus-core.c | 30 ++++++++++++++++++++++++++++++ - drivers/dahdi/xpp/xbus-pcm.c | 30 ------------------------------ - 2 files changed, 30 insertions(+), 30 deletions(-) - -diff --git a/drivers/dahdi/xpp/xbus-core.c b/drivers/dahdi/xpp/xbus-core.c -index 4281f1c..ca129cd 100644 ---- a/drivers/dahdi/xpp/xbus-core.c -+++ b/drivers/dahdi/xpp/xbus-core.c -@@ -1350,6 +1350,36 @@ err: - return 0; - } - -+static void xbus_command_timer(unsigned long param) -+{ -+ xbus_t *xbus = (xbus_t *)param; -+ struct timeval now; -+ -+ BUG_ON(!xbus); -+ do_gettimeofday(&now); -+ xbus_command_queue_tick(xbus); -+ if (!xbus->self_ticking) /* Must be 1KHz rate */ -+ mod_timer(&xbus->command_timer, jiffies + 1); -+} -+ -+void xbus_set_command_timer(xbus_t *xbus, bool on) -+{ -+ XBUS_DBG(SYNC, xbus, "%s\n", (on) ? "ON" : "OFF"); -+ if (on) { -+ if (!timer_pending(&xbus->command_timer)) { -+ XBUS_DBG(SYNC, xbus, "add_timer\n"); -+ xbus->command_timer.function = xbus_command_timer; -+ xbus->command_timer.data = (unsigned long)xbus; -+ xbus->command_timer.expires = jiffies + 1; -+ add_timer(&xbus->command_timer); -+ } -+ } else if (timer_pending(&xbus->command_timer)) { -+ XBUS_DBG(SYNC, xbus, "del_timer\n"); -+ del_timer(&xbus->command_timer); -+ } -+ xbus->self_ticking = !on; -+} -+ - bool xbus_setflags(xbus_t *xbus, int flagbit, bool on) - { - unsigned long flags; -diff --git a/drivers/dahdi/xpp/xbus-pcm.c b/drivers/dahdi/xpp/xbus-pcm.c -index 32f04fa..3f46780 100644 ---- a/drivers/dahdi/xpp/xbus-pcm.c -+++ b/drivers/dahdi/xpp/xbus-pcm.c -@@ -353,36 +353,6 @@ static void xpp_set_syncer(xbus_t *xbus, bool on) - (syncer) ? syncer->busname : "NO-SYNC"); - } - --static void xbus_command_timer(unsigned long param) --{ -- xbus_t *xbus = (xbus_t *)param; -- struct timeval now; -- -- BUG_ON(!xbus); -- do_gettimeofday(&now); -- xbus_command_queue_tick(xbus); -- if (!xbus->self_ticking) /* Must be 1KHz rate */ -- mod_timer(&xbus->command_timer, jiffies + 1); --} -- --void xbus_set_command_timer(xbus_t *xbus, bool on) --{ -- XBUS_DBG(SYNC, xbus, "%s\n", (on) ? "ON" : "OFF"); -- if (on) { -- if (!timer_pending(&xbus->command_timer)) { -- XBUS_DBG(SYNC, xbus, "add_timer\n"); -- xbus->command_timer.function = xbus_command_timer; -- xbus->command_timer.data = (unsigned long)xbus; -- xbus->command_timer.expires = jiffies + 1; -- add_timer(&xbus->command_timer); -- } -- } else if (timer_pending(&xbus->command_timer)) { -- XBUS_DBG(SYNC, xbus, "del_timer\n"); -- del_timer(&xbus->command_timer); -- } -- xbus->self_ticking = !on; --} -- - /* - * Called when the Astribank replies to a sync change request - */ --- -2.11.0 - diff --git a/0002-fix-building-with-4.15-init_timer-setup_timer.patch b/0002-fix-building-with-4.15-init_timer-setup_timer.patch deleted file mode 100644 index a624e0d..0000000 --- a/0002-fix-building-with-4.15-init_timer-setup_timer.patch +++ /dev/null @@ -1,296 +0,0 @@ -From 19af3ae5af6857402e0e8a3e3b35c81320917454 Mon Sep 17 00:00:00 2001 -From: Tzafrir Cohen -Date: Mon, 1 Jan 2018 09:50:01 +0200 -Subject: [PATCH 2/2] fix building with 4.15: init_timer / setup_timer - -Kernel 4.15 revised the interface for callbacks to timers. For that the -initialization of timers has changed. - -Changes are conditioned on the preprocesson define init_timer that was -removed. - -DAHLIN-359 #close - -Signed-off-by: Tzafrir Cohen ---- - drivers/dahdi/dahdi-base.c | 11 ++++++++--- - drivers/dahdi/dahdi_dynamic.c | 13 ++++++++----- - drivers/dahdi/dahdi_dynamic_ethmf.c | 11 ++++++++--- - drivers/dahdi/wctc4xxp/base.c | 8 +++++++- - drivers/dahdi/wcte12xp/base.c | 9 ++++++++- - drivers/dahdi/wcte13xp-base.c | 8 +++++++- - drivers/dahdi/wcte43x-base.c | 8 +++++++- - drivers/dahdi/xpp/xbus-core.c | 10 +++++++--- - include/dahdi/kernel.h | 10 ++++++++++ - 9 files changed, 70 insertions(+), 18 deletions(-) - -diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c -index 618754d..c473474 100644 ---- a/drivers/dahdi/dahdi-base.c -+++ b/drivers/dahdi/dahdi-base.c -@@ -10069,7 +10069,13 @@ static inline unsigned long msecs_processed(const struct core_timer *const ct) - return atomic_read(&ct->count) * DAHDI_MSECS_PER_CHUNK; - } - --static void coretimer_func(unsigned long param) -+static void coretimer_func( -+#ifdef init_timer /* Compatibility for pre 4.15 interface */ -+ unsigned long param -+#else -+ struct timer_list *t -+#endif -+) - { - unsigned long flags; - unsigned long ms_since_start; -@@ -10150,8 +10156,7 @@ static void coretimer_func(unsigned long param) - - static void coretimer_init(void) - { -- init_timer(&core_timer.timer); -- core_timer.timer.function = coretimer_func; -+ timer_setup(&core_timer.timer, coretimer_func, 0); - ktime_get_ts(&core_timer.start_interval); - atomic_set(&core_timer.count, 0); - atomic_set(&core_timer.shutdown, 0); -diff --git a/drivers/dahdi/dahdi_dynamic.c b/drivers/dahdi/dahdi_dynamic.c -index 0a37e2a..6727bd4 100644 ---- a/drivers/dahdi/dahdi_dynamic.c -+++ b/drivers/dahdi/dahdi_dynamic.c -@@ -831,7 +831,13 @@ EXPORT_SYMBOL(dahdi_dynamic_unregister_driver); - - static struct timer_list alarmcheck; - --static void check_for_red_alarm(unsigned long ignored) -+static void check_for_red_alarm( -+#ifdef init_timer /* Compatibility for pre 4.15 interface */ -+ unsigned long ignored -+#else -+ struct timer_list *ignored -+#endif -+) - { - int newalarm; - int alarmchanged = 0; -@@ -867,10 +873,7 @@ static const struct dahdi_dynamic_ops dahdi_dynamic_ops = { - static int dahdi_dynamic_init(void) - { - /* Start process to check for RED ALARM */ -- init_timer(&alarmcheck); -- alarmcheck.expires = 0; -- alarmcheck.data = 0; -- alarmcheck.function = check_for_red_alarm; -+ timer_setup(&alarmcheck, check_for_red_alarm, 0); - /* Check once per second */ - mod_timer(&alarmcheck, jiffies + 1 * HZ); - #ifdef ENABLE_TASKLETS -diff --git a/drivers/dahdi/dahdi_dynamic_ethmf.c b/drivers/dahdi/dahdi_dynamic_ethmf.c -index dec368b..4d7d2f1 100644 ---- a/drivers/dahdi/dahdi_dynamic_ethmf.c -+++ b/drivers/dahdi/dahdi_dynamic_ethmf.c -@@ -681,7 +681,13 @@ static int ethmf_delay_dec(void) - * Timer callback function to allow all spans to be added, prior to any of - * them being used. - */ --static void timer_callback(unsigned long param) -+static void timer_callback( -+#ifdef init_timer /* Compatibility for pre 4.15 interface */ -+ unsigned long ignored -+#else -+ struct timer_list *ignored -+#endif -+) - { - if (ethmf_delay_dec()) { - if (!atomic_read(&timer_deleted)) { -@@ -764,9 +770,8 @@ static const struct file_operations ztdethmf_proc_fops = { - - static int __init ztdethmf_init(void) - { -- init_timer(&timer); -+ timer_setup(&timer, &timer_callback, 0); - timer.expires = jiffies + HZ; -- timer.function = &timer_callback; - if (!timer_pending(&timer)) - add_timer(&timer); - -diff --git a/drivers/dahdi/wctc4xxp/base.c b/drivers/dahdi/wctc4xxp/base.c -index 0d76d6a..8e0b76b 100644 ---- a/drivers/dahdi/wctc4xxp/base.c -+++ b/drivers/dahdi/wctc4xxp/base.c -@@ -3701,9 +3701,15 @@ wctc4xxp_send_commands(struct wcdte *wc, struct list_head *to_send) - } - - static void -+#ifndef init_timer -+wctc4xxp_watchdog(struct timer_list *t) -+{ -+ struct wcdte *wc = from_timer(wc, t, watchdog); -+#else /* Compatibility for pre 4.15 interface */ - wctc4xxp_watchdog(unsigned long data) - { - struct wcdte *wc = (struct wcdte *)data; -+#endif - struct tcb *cmd, *temp; - LIST_HEAD(cmds_to_retry); - const int MAX_RETRIES = 5; -@@ -4095,7 +4101,7 @@ wctc4xxp_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) - wc->watchdog.data = (unsigned long)wc; - init_timer(&wc->watchdog); - # else -- setup_timer(&wc->watchdog, wctc4xxp_watchdog, (unsigned long)wc); -+ timer_setup(&wc->watchdog, wctc4xxp_watchdog, 0); - # endif - - /* ------------------------------------------------------------------ -diff --git a/drivers/dahdi/wcte12xp/base.c b/drivers/dahdi/wcte12xp/base.c -index c327c5f..77e2d2f 100644 ---- a/drivers/dahdi/wcte12xp/base.c -+++ b/drivers/dahdi/wcte12xp/base.c -@@ -2765,10 +2765,17 @@ static void vpm_check_func(struct work_struct *work) - return; - } - -+#ifndef init_timer -+static void te12xp_timer(struct timer_list *t) -+{ -+ unsigned long flags; -+ struct t1 *wc = from_timer(wc, t, timer); -+#else /* Compatibility for pre 4.15 interface */ - static void te12xp_timer(unsigned long data) - { - unsigned long flags; - struct t1 *wc = (struct t1 *)data; -+#endif - - if (unlikely(!test_bit(INITIALIZED, &wc->bit_flags))) - return; -@@ -2943,7 +2950,7 @@ static int __devinit te12xp_init_one(struct pci_dev *pdev, const struct pci_devi - spin_lock_init(&wc->reglock); - INIT_LIST_HEAD(&wc->active_cmds); - INIT_LIST_HEAD(&wc->pending_cmds); -- setup_timer(&wc->timer, te12xp_timer, (unsigned long)wc); -+ timer_setup(&wc->timer, te12xp_timer, 0); - - # if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20) - INIT_WORK(&wc->timer_work, timer_work_func, wc); -diff --git a/drivers/dahdi/wcte13xp-base.c b/drivers/dahdi/wcte13xp-base.c -index c5ebe9d..57e6dac 100644 ---- a/drivers/dahdi/wcte13xp-base.c -+++ b/drivers/dahdi/wcte13xp-base.c -@@ -2381,9 +2381,15 @@ static void te13x_handle_interrupt(struct wcxb *xb, u32 pending) - } - } - -+#ifndef init_timer -+static void te13xp_timer(struct timer_list *t) -+{ -+ struct t13x *wc = from_timer(wc, t, timer); -+#else /* Compatibility for pre 4.15 interface */ - static void te13xp_timer(unsigned long data) - { - struct t13x *wc = (struct t13x *)data; -+#endif - - if (unlikely(!test_bit(INITIALIZED, &wc->bit_flags))) - return; -@@ -2582,7 +2588,7 @@ static int __devinit te13xp_init_one(struct pci_dev *pdev, - wc->ledstate = -1; - spin_lock_init(&wc->reglock); - mutex_init(&wc->lock); -- setup_timer(&wc->timer, te13xp_timer, (unsigned long)wc); -+ timer_setup(&wc->timer, te13xp_timer, 0); - - # if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20) - INIT_WORK(&wc->timer_work, timer_work_func, wc); -diff --git a/drivers/dahdi/wcte43x-base.c b/drivers/dahdi/wcte43x-base.c -index 3e6159b..af39165 100644 ---- a/drivers/dahdi/wcte43x-base.c -+++ b/drivers/dahdi/wcte43x-base.c -@@ -3203,9 +3203,15 @@ static void t43x_handle_interrupt(struct wcxb *xb, u32 pending) - wc->intr_span = 0; - } - -+#ifndef init_timer -+static void t43x_timer(struct timer_list *t) -+{ -+ struct t43x *wc = from_timer(wc, t, timer); -+#else /* Compatibility for pre 4.15 interface */ - static void t43x_timer(unsigned long data) - { - struct t43x *wc = (struct t43x *)data; -+#endif - - if (!is_initialized(wc)) - return; -@@ -3431,7 +3437,7 @@ static int __devinit t43x_init_one(struct pci_dev *pdev, - goto fail_exit; - - mutex_init(&wc->lock); -- setup_timer(&wc->timer, t43x_timer, (unsigned long)wc); -+ timer_setup(&wc->timer, t43x_timer, 0); - - #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20) - INIT_WORK(&wc->timer_work, timer_work_func, wc); -diff --git a/drivers/dahdi/xpp/xbus-core.c b/drivers/dahdi/xpp/xbus-core.c -index ca129cd..5bd8853 100644 ---- a/drivers/dahdi/xpp/xbus-core.c -+++ b/drivers/dahdi/xpp/xbus-core.c -@@ -1350,9 +1350,15 @@ err: - return 0; - } - -+#ifndef init_timer -+static void xbus_command_timer(struct timer_list *t) -+{ -+ xbus_t *xbus = from_timer(xbus, t, command_timer); -+#else - static void xbus_command_timer(unsigned long param) - { - xbus_t *xbus = (xbus_t *)param; -+#endif - struct timeval now; - - BUG_ON(!xbus); -@@ -1368,8 +1374,6 @@ void xbus_set_command_timer(xbus_t *xbus, bool on) - if (on) { - if (!timer_pending(&xbus->command_timer)) { - XBUS_DBG(SYNC, xbus, "add_timer\n"); -- xbus->command_timer.function = xbus_command_timer; -- xbus->command_timer.data = (unsigned long)xbus; - xbus->command_timer.expires = jiffies + 1; - add_timer(&xbus->command_timer); - } -@@ -1642,7 +1646,7 @@ xbus_t *xbus_new(struct xbus_ops *ops, ushort max_send_size, - transport_init(xbus, ops, max_send_size, transport_device, priv); - spin_lock_init(&xbus->lock); - init_waitqueue_head(&xbus->command_queue_empty); -- init_timer(&xbus->command_timer); -+ timer_setup(&xbus->command_timer, xbus_command_timer, 0); - atomic_set(&xbus->pcm_rx_counter, 0); - xbus->min_tx_sync = INT_MAX; - xbus->min_rx_sync = INT_MAX; -diff --git a/include/dahdi/kernel.h b/include/dahdi/kernel.h -index c946fa3..bc07ef6 100644 ---- a/include/dahdi/kernel.h -+++ b/include/dahdi/kernel.h -@@ -1630,6 +1630,16 @@ struct mutex { - printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) - #endif - -+ -+#ifdef init_timer /* Compatibility for pre 4.15 interface */ -+#define timer_setup(timer, func, flags) \ -+ do { \ -+ init_timer(timer); \ -+ (timer)->function = (func); \ -+ } while (0) -+#endif -+ -+ - /* If KBUILD_MODNAME is not defined in a compilation unit, then the dev_dbg - * macro will not work properly. */ - #ifndef KBUILD_MODNAME --- -2.11.0 - diff --git a/dahdi-linux.spec b/dahdi-linux.spec index d1ca2cb..a144258 100644 --- a/dahdi-linux.spec +++ b/dahdi-linux.spec @@ -35,18 +35,18 @@ exit 1 %define _enable_debug_packages 0 %endif -%define rel 3 +%define rel 0.1 %define pname dahdi-linux %define FIRMWARE_URL http://downloads.digium.com/pub/telephony/firmware/releases Summary: DAHDI telephony device support Summary(pl.UTF-8): Obsługa urządzeń telefonicznych DAHDI Name: %{pname}%{?_pld_builder:%{?with_kernel:-kernel}}%{_alt_kernel} -Version: 2.11.1 +Version: 3.0.0 Release: %{rel}%{?_pld_builder:%{?with_kernel:@%{_kernel_ver_str}}} License: GPL v2 Group: Base/Kernel Source0: http://downloads.asterisk.org/pub/telephony/dahdi-linux/releases/dahdi-linux-%{version}.tar.gz -# Source0-md5: af96917e15eebc36519948133ec7e36b +# Source0-md5: 496baef9d2a3bec5a3380ade8efdc5e7 Source3: %{FIRMWARE_URL}/dahdi-fw-oct6114-064-1.05.01.tar.gz # Source3-md5: 88db9b7a07d8392736171b1b3e6bcc66 Source4: %{FIRMWARE_URL}/dahdi-fw-oct6114-128-1.05.01.tar.gz @@ -57,10 +57,6 @@ Source6: %{FIRMWARE_URL}/dahdi-fw-tc400m-MR6.12.tar.gz # Source6-md5: 2ea860bb8a9d8ede2858b9557b74ee3c Source7: %{FIRMWARE_URL}/dahdi-fw-hx8-2.06.tar.gz # Source7-md5: a7f3886942bb3e9fed349a41b3390c9f -Patch0: kernel-4.11.patch -Patch1: kernel-4.13.patch -Patch2: 0001-xpp-move-command_timer-functions-to-xbus-core.patch -Patch3: 0002-fix-building-with-4.15-init_timer-setup_timer.patch URL: http://www.asterisk.org/ %{?with_kernel:%{expand:%buildrequires_kernel kernel%%{_alt_kernel}-module-build >= 3:2.6.20.2}} BuildRequires: perl-base @@ -160,10 +156,6 @@ cd ../..\ %prep %setup -q -n %{pname}-%{version} -%patch0 -p1 -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 for a in %{SOURCE3} %{SOURCE4} %{SOURCE5} %{SOURCE6} %{SOURCE7}; do ln -s $a drivers/dahdi/firmware diff --git a/kernel-4.11.patch b/kernel-4.11.patch deleted file mode 100644 index 2a8cb60..0000000 --- a/kernel-4.11.patch +++ /dev/null @@ -1,141 +0,0 @@ -diff -ur dahdi-linux-2.11.1/drivers/dahdi/dahdi-base.c dahdi-linux-2.11.1-4.11/drivers/dahdi/dahdi-base.c ---- dahdi-linux-2.11.1/drivers/dahdi/dahdi-base.c 2016-03-01 23:03:59.000000000 +0100 -+++ dahdi-linux-2.11.1-4.11/drivers/dahdi/dahdi-base.c 2017-05-09 20:34:45.170079849 +0200 -@@ -47,6 +47,9 @@ - #include - #include - #include -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0) -+#include -+#endif - #include - #include - #include -diff -ur dahdi-linux-2.11.1/drivers/dahdi/dahdi_dynamic.c dahdi-linux-2.11.1-4.11/drivers/dahdi/dahdi_dynamic.c ---- dahdi-linux-2.11.1/drivers/dahdi/dahdi_dynamic.c 2016-03-01 23:03:59.000000000 +0100 -+++ dahdi-linux-2.11.1-4.11/drivers/dahdi/dahdi_dynamic.c 2017-05-09 20:38:03.809649973 +0200 -@@ -467,7 +467,11 @@ - - /* We shouldn't have more than the two references at this point. If - * we do, there are probably channels that are still opened. */ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,11,0) - if (atomic_read(&d->kref.refcount) > 2) { -+#else -+ if (kref_read(&d->kref) > 2) { -+#endif - dynamic_put(d); - return -EBUSY; - } -diff -ur dahdi-linux-2.11.1/drivers/dahdi/wcaxx-base.c dahdi-linux-2.11.1-4.11/drivers/dahdi/wcaxx-base.c ---- dahdi-linux-2.11.1/drivers/dahdi/wcaxx-base.c 2016-03-01 23:03:59.000000000 +0100 -+++ dahdi-linux-2.11.1-4.11/drivers/dahdi/wcaxx-base.c 2017-05-09 20:39:05.690553708 +0200 -@@ -28,6 +28,9 @@ - #include - #include - #include -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0) -+#include -+#endif - #include - #include - #include -diff -ur dahdi-linux-2.11.1/drivers/dahdi/wctc4xxp/base.c dahdi-linux-2.11.1-4.11/drivers/dahdi/wctc4xxp/base.c ---- dahdi-linux-2.11.1/drivers/dahdi/wctc4xxp/base.c 2016-03-01 23:03:59.000000000 +0100 -+++ dahdi-linux-2.11.1-4.11/drivers/dahdi/wctc4xxp/base.c 2017-05-09 20:40:14.041864392 +0200 -@@ -26,6 +26,10 @@ - #include - #include - #include -+#include -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0) -+#include -+#endif - #include - #include - #include -diff -ur dahdi-linux-2.11.1/drivers/dahdi/wctdm24xxp/base.c dahdi-linux-2.11.1-4.11/drivers/dahdi/wctdm24xxp/base.c ---- dahdi-linux-2.11.1/drivers/dahdi/wctdm24xxp/base.c 2016-03-01 23:03:59.000000000 +0100 -+++ dahdi-linux-2.11.1-4.11/drivers/dahdi/wctdm24xxp/base.c 2017-05-09 20:39:47.343067209 +0200 -@@ -44,6 +44,9 @@ - #include - #include - #include -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0) -+#include -+#endif - #include - #include - #include -diff -ur dahdi-linux-2.11.1/drivers/dahdi/wcte12xp/base.c dahdi-linux-2.11.1-4.11/drivers/dahdi/wcte12xp/base.c ---- dahdi-linux-2.11.1/drivers/dahdi/wcte12xp/base.c 2016-03-01 23:03:59.000000000 +0100 -+++ dahdi-linux-2.11.1-4.11/drivers/dahdi/wcte12xp/base.c 2017-05-09 20:40:31.216160114 +0200 -@@ -40,6 +40,10 @@ - #include - #include - #include -+#include -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0) -+#include -+#endif - #include - - #include -diff -ur dahdi-linux-2.11.1/drivers/dahdi/wcte43x-base.c dahdi-linux-2.11.1-4.11/drivers/dahdi/wcte43x-base.c ---- dahdi-linux-2.11.1/drivers/dahdi/wcte43x-base.c 2016-03-01 23:03:59.000000000 +0100 -+++ dahdi-linux-2.11.1-4.11/drivers/dahdi/wcte43x-base.c 2017-05-09 20:38:38.996830549 +0200 -@@ -33,6 +33,10 @@ - #include - #include - #include -+#include -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0) -+#include -+#endif - #include - #include - -diff -ur dahdi-linux-2.11.1/drivers/dahdi/xpp/xbus-core.c dahdi-linux-2.11.1-4.11/drivers/dahdi/xpp/xbus-core.c ---- dahdi-linux-2.11.1/drivers/dahdi/xpp/xbus-core.c 2016-03-01 23:03:59.000000000 +0100 -+++ dahdi-linux-2.11.1-4.11/drivers/dahdi/xpp/xbus-core.c 2017-05-09 20:41:27.973007253 +0200 -@@ -244,7 +244,11 @@ - { - struct kref *kref = &xbus->kref; - -+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,11,0) - return atomic_read(&kref->refcount); -+#else -+ return kref_read(kref); -+#endif - } - - /*------------------------- Frame Handling ------------------------*/ -diff -ur dahdi-linux-2.11.1/drivers/dahdi/xpp/xbus-sysfs.c dahdi-linux-2.11.1-4.11/drivers/dahdi/xpp/xbus-sysfs.c ---- dahdi-linux-2.11.1/drivers/dahdi/xpp/xbus-sysfs.c 2016-03-01 23:03:59.000000000 +0100 -+++ dahdi-linux-2.11.1-4.11/drivers/dahdi/xpp/xbus-sysfs.c 2017-05-09 20:42:09.972886067 +0200 -@@ -974,7 +974,11 @@ - return; - } - XBUS_DBG(DEVICES, xbus, "going to unregister: refcount=%d\n", -+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,11,0) - atomic_read(&astribank->kobj.kref.refcount)); -+#else -+ kref_read(&astribank->kobj.kref)); -+#endif - BUG_ON(dev_get_drvdata(astribank) != xbus); - device_unregister(astribank); - dev_set_drvdata(astribank, NULL); -diff -ur dahdi-linux-2.11.1/drivers/dahdi/xpp/xpp_dahdi.c dahdi-linux-2.11.1-4.11/drivers/dahdi/xpp/xpp_dahdi.c ---- dahdi-linux-2.11.1/drivers/dahdi/xpp/xpp_dahdi.c 2016-03-01 23:03:59.000000000 +0100 -+++ dahdi-linux-2.11.1-4.11/drivers/dahdi/xpp/xpp_dahdi.c 2017-05-09 20:42:55.336485638 +0200 -@@ -124,7 +124,11 @@ - { - struct kref *kref = &xpd->kref; - -+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,11,0) - return atomic_read(&kref->refcount); -+#else -+ return kref_read(kref); -+#endif - } - - xpd_t *get_xpd(const char *msg, xpd_t *xpd) diff --git a/kernel-4.13.patch b/kernel-4.13.patch deleted file mode 100644 index 824e880..0000000 --- a/kernel-4.13.patch +++ /dev/null @@ -1,299 +0,0 @@ -Index: dahdi-linux-2.11.1~dfsg/drivers/dahdi/dahdi-sysfs.c -=================================================================== ---- dahdi-linux-2.11.1~dfsg.orig/drivers/dahdi/dahdi-sysfs.c -+++ dahdi-linux-2.11.1~dfsg/drivers/dahdi/dahdi-sysfs.c -@@ -214,6 +214,7 @@ static BUS_ATTR_READER(linecompat_show, - return len; - } - -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) - static struct device_attribute span_dev_attrs[] = { - __ATTR_RO(name), - __ATTR_RO(desc), -@@ -230,6 +231,39 @@ static struct device_attribute span_dev_ - __ATTR_RO(linecompat), - __ATTR_NULL, - }; -+#else -+static DEVICE_ATTR_RO(name); -+static DEVICE_ATTR_RO(desc); -+static DEVICE_ATTR_RO(spantype); -+static DEVICE_ATTR_RO(local_spanno); -+static DEVICE_ATTR_RO(alarms); -+static DEVICE_ATTR_RO(lbo); -+static DEVICE_ATTR_RO(syncsrc); -+static DEVICE_ATTR_RO(is_digital); -+static DEVICE_ATTR_RO(is_sync_master); -+static DEVICE_ATTR_RO(basechan); -+static DEVICE_ATTR_RO(channels); -+static DEVICE_ATTR_RO(lineconfig); -+static DEVICE_ATTR_RO(linecompat); -+ -+static struct attribute *span_dev_attrs[] = { -+ &dev_attr_name.attr, -+ &dev_attr_desc.attr, -+ &dev_attr_spantype.attr, -+ &dev_attr_local_spanno.attr, -+ &dev_attr_alarms.attr, -+ &dev_attr_lbo.attr, -+ &dev_attr_syncsrc.attr, -+ &dev_attr_is_digital.attr, -+ &dev_attr_is_sync_master.attr, -+ &dev_attr_basechan.attr, -+ &dev_attr_channels.attr, -+ &dev_attr_lineconfig.attr, -+ &dev_attr_linecompat.attr, -+ NULL, -+}; -+ATTRIBUTE_GROUPS(span_dev); -+#endif - - static ssize_t master_span_show(struct device_driver *driver, char *buf) - { -@@ -270,10 +304,11 @@ static struct bus_type spans_bus_type = - .name = "dahdi_spans", - .match = span_match, - .uevent = span_uevent, -- .dev_attrs = span_dev_attrs, - #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) -+ .dev_attrs = span_dev_attrs, - .drv_attrs = dahdi_attrs, - #else -+ .dev_groups = span_dev_groups, - .drv_groups = dahdi_groups, - #endif - }; -@@ -690,6 +725,7 @@ dahdi_registration_time_show(struct devi - return count; - } - -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) - static struct device_attribute dahdi_device_attrs[] = { - __ATTR(manufacturer, S_IRUGO, dahdi_device_manufacturer_show, NULL), - __ATTR(type, S_IRUGO, dahdi_device_type_show, NULL), -@@ -704,11 +740,48 @@ static struct device_attribute dahdi_dev - __ATTR(registration_time, S_IRUGO, dahdi_registration_time_show, NULL), - __ATTR_NULL, - }; -+#else -+static DEVICE_ATTR(manufacturer, S_IRUGO, dahdi_device_manufacturer_show, NULL); -+static DEVICE_ATTR(type, S_IRUGO, dahdi_device_type_show, NULL); -+static DEVICE_ATTR(span_count, S_IRUGO, dahdi_device_span_count_show, NULL); -+static DEVICE_ATTR(hardware_id, S_IRUGO, dahdi_device_hardware_id_show, NULL); -+static DEVICE_ATTR(location, S_IRUGO, dahdi_device_location_show, NULL); -+static DEVICE_ATTR(auto_assign, S_IWUSR, NULL, dahdi_device_auto_assign); -+static DEVICE_ATTR(assign_span, S_IWUSR, NULL, dahdi_device_assign_span); -+static DEVICE_ATTR(unassign_span, S_IWUSR, NULL, dahdi_device_unassign_span); -+/* -+ * Using DEVICE_ATTR for spantype attribute here will conflict with the -+ * span device attribute definition above. Define it somewhat more -+ * manually to give it a unique name. -+ */ -+static struct device_attribute dahdi_dev_attr_spantype = -+ __ATTR(spantype, S_IWUSR | S_IRUGO, dahdi_spantype_show, dahdi_spantype_store); -+static DEVICE_ATTR(registration_time, S_IRUGO, dahdi_registration_time_show, NULL); -+ -+static struct attribute *dahdi_device_attrs[] = { -+ &dev_attr_manufacturer.attr, -+ &dev_attr_type.attr, -+ &dev_attr_span_count.attr, -+ &dev_attr_hardware_id.attr, -+ &dev_attr_location.attr, -+ &dev_attr_auto_assign.attr, -+ &dev_attr_assign_span.attr, -+ &dev_attr_unassign_span.attr, -+ &dahdi_dev_attr_spantype.attr, -+ &dev_attr_registration_time.attr, -+ NULL, -+}; -+ATTRIBUTE_GROUPS(dahdi_device); -+#endif - - static struct bus_type dahdi_device_bus = { - .name = "dahdi_devices", - .uevent = device_uevent, -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) - .dev_attrs = dahdi_device_attrs, -+#else -+ .dev_groups = dahdi_device_groups, -+#endif - }; - - static void dahdi_sysfs_cleanup(void) -Index: dahdi-linux-2.11.1~dfsg/drivers/dahdi/dahdi-sysfs-chan.c -=================================================================== ---- dahdi-linux-2.11.1~dfsg.orig/drivers/dahdi/dahdi-sysfs-chan.c -+++ dahdi-linux-2.11.1~dfsg/drivers/dahdi/dahdi-sysfs-chan.c -@@ -158,6 +158,7 @@ static BUS_ATTR_READER(ec_state_show, de - return len; - } - -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) - static struct device_attribute chan_dev_attrs[] = { - __ATTR_RO(name), - __ATTR_RO(channo), -@@ -174,6 +175,39 @@ static struct device_attribute chan_dev_ - __ATTR_RO(in_use), - __ATTR_NULL, - }; -+#else -+static DEVICE_ATTR_RO(name); -+static DEVICE_ATTR_RO(channo); -+static DEVICE_ATTR_RO(chanpos); -+static DEVICE_ATTR_RO(sig); -+static DEVICE_ATTR_RO(sigcap); -+static DEVICE_ATTR_RO(alarms); -+static DEVICE_ATTR_RO(ec_factory); -+static DEVICE_ATTR_RO(ec_state); -+static DEVICE_ATTR_RO(blocksize); -+#ifdef OPTIMIZE_CHANMUTE -+static DEVICE_ATTR_RO(chanmute); -+#endif -+static DEVICE_ATTR_RO(in_use); -+ -+static struct attribute *chan_dev_attrs[] = { -+ &dev_attr_name.attr, -+ &dev_attr_channo.attr, -+ &dev_attr_chanpos.attr, -+ &dev_attr_sig.attr, -+ &dev_attr_sigcap.attr, -+ &dev_attr_alarms.attr, -+ &dev_attr_ec_factory.attr, -+ &dev_attr_ec_state.attr, -+ &dev_attr_blocksize.attr, -+#ifdef OPTIMIZE_CHANMUTE -+ &dev_attr_chanmute.attr, -+#endif -+ &dev_attr_in_use.attr, -+ NULL, -+}; -+ATTRIBUTE_GROUPS(chan_dev); -+#endif - - static void chan_release(struct device *dev) - { -@@ -196,7 +230,11 @@ static int chan_match(struct device *dev - static struct bus_type chan_bus_type = { - .name = "dahdi_channels", - .match = chan_match, -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) - .dev_attrs = chan_dev_attrs, -+#else -+ .dev_groups = chan_dev_groups, -+#endif - }; - - static int chan_probe(struct device *dev) -Index: dahdi-linux-2.11.1~dfsg/drivers/dahdi/xpp/xbus-sysfs.c -=================================================================== ---- dahdi-linux-2.11.1~dfsg.orig/drivers/dahdi/xpp/xbus-sysfs.c -+++ dahdi-linux-2.11.1~dfsg/drivers/dahdi/xpp/xbus-sysfs.c -@@ -339,6 +339,7 @@ static DEVICE_ATTR_READER(dahdi_registra - return len; - } - -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) - static struct device_attribute xbus_dev_attrs[] = { - __ATTR_RO(connector), - __ATTR_RO(label), -@@ -358,6 +359,42 @@ static struct device_attribute xbus_dev_ - dahdi_registration_store), - __ATTR_NULL, - }; -+#else -+static DEVICE_ATTR_RO(connector); -+static DEVICE_ATTR_RO(label); -+static DEVICE_ATTR_RO(status); -+static DEVICE_ATTR_RO(timing); -+static DEVICE_ATTR_RO(refcount_xbus); -+static DEVICE_ATTR_RO(waitfor_xpds); -+static DEVICE_ATTR_RO(driftinfo); -+static DEVICE_ATTR(cls, S_IWUSR, NULL, cls_store); -+static DEVICE_ATTR(xbus_state, S_IRUGO | S_IWUSR, xbus_state_show, -+ xbus_state_store); -+#ifdef SAMPLE_TICKS -+static DEVICE_ATTR(samples, S_IWUSR | S_IRUGO, samples_show, samples_store); -+#endif -+static DEVICE_ATTR(dahdi_registration, S_IRUGO | S_IWUSR, -+ dahdi_registration_show, -+ dahdi_registration_store); -+ -+static struct attribute *xbus_dev_attrs[] = { -+ &dev_attr_connector.attr, -+ &dev_attr_label.attr, -+ &dev_attr_status.attr, -+ &dev_attr_timing.attr, -+ &dev_attr_refcount_xbus.attr, -+ &dev_attr_waitfor_xpds.attr, -+ &dev_attr_driftinfo.attr, -+ &dev_attr_cls.attr, -+ &dev_attr_xbus_state.attr, -+#ifdef SAMPLE_TICKS -+ &dev_attr_samples.attr, -+#endif -+ &dev_attr_dahdi_registration.attr, -+ NULL, -+}; -+ATTRIBUTE_GROUPS(xbus_dev); -+#endif - - static int astribank_match(struct device *dev, struct device_driver *driver) - { -@@ -457,10 +494,11 @@ static struct bus_type toplevel_bus_type - .name = "astribanks", - .match = astribank_match, - .uevent = astribank_uevent, -- .dev_attrs = xbus_dev_attrs, - #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) -+ .dev_attrs = xbus_dev_attrs, - .drv_attrs = xpp_attrs, - #else -+ .dev_groups = xbus_dev_groups, - .drv_groups = xpp_groups, - #endif - }; -@@ -744,6 +782,7 @@ static int xpd_match(struct device *dev, - return 1; - } - -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) - static struct device_attribute xpd_dev_attrs[] = { - __ATTR(chipregs, S_IRUGO | S_IWUSR, chipregs_show, chipregs_store), - __ATTR(blink, S_IRUGO | S_IWUSR, blink_show, blink_store), -@@ -754,11 +793,36 @@ static struct device_attribute xpd_dev_a - __ATTR_RO(refcount_xpd), - __ATTR_NULL, - }; -+#else -+DEVICE_ATTR(chipregs, S_IRUGO | S_IWUSR, chipregs_show, chipregs_store); -+DEVICE_ATTR(blink, S_IRUGO | S_IWUSR, blink_show, blink_store); -+DEVICE_ATTR(span, S_IRUGO | S_IWUSR, span_show, span_store); -+DEVICE_ATTR_RO(type); -+DEVICE_ATTR_RO(offhook); -+DEVICE_ATTR_RO(timing_priority); -+DEVICE_ATTR_RO(refcount_xpd); -+ -+static struct attribute *xpd_dev_attrs[] = { -+ &dev_attr_chipregs.attr, -+ &dev_attr_blink.attr, -+ &dev_attr_span.attr, -+ &dev_attr_type.attr, -+ &dev_attr_offhook.attr, -+ &dev_attr_timing_priority.attr, -+ &dev_attr_refcount_xpd.attr, -+ NULL, -+}; -+ATTRIBUTE_GROUPS(xpd_dev); -+#endif - - static struct bus_type xpd_type = { - .name = "xpds", - .match = xpd_match, -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) - .dev_attrs = xpd_dev_attrs, -+#else -+ .dev_groups = xpd_dev_groups, -+#endif - }; - - int xpd_driver_register(struct device_driver *driver) -- 2.43.0