diff -Nru dahdi-linux-2.10.2~dfsg/debian/changelog dahdi-linux-2.10.2~dfsg/debian/changelog --- dahdi-linux-2.10.2~dfsg/debian/changelog 2017-10-27 09:44:47.000000000 -0200 +++ dahdi-linux-2.10.2~dfsg/debian/changelog 2018-06-29 10:58:53.000000000 -0300 @@ -1,3 +1,11 @@ +dahdi-linux (1:2.10.2~dfsg-1ubuntu3) xenial; urgency=medium + + * Linux 4.15 compatibility (LP: #1779331) + - d/p/kernel-compat-4.15_0001-xpp-move-command_timer-functions-to-xbus-core.patch + - d/p/kernel-compat-4.15_0002-fix-building-with-4.15-init_timer-setup_timer.patch + + -- Marcelo Henrique Cerri Fri, 29 Jun 2018 10:58:53 -0300 + dahdi-linux (1:2.10.2~dfsg-1ubuntu2) xenial; urgency=medium * Linux 4.11 and 4.13 compatibility (LP: #1724866) diff -Nru dahdi-linux-2.10.2~dfsg/debian/patches/kernel-compat-4.15_0001-xpp-move-command_timer-functions-to-xbus-core.patch dahdi-linux-2.10.2~dfsg/debian/patches/kernel-compat-4.15_0001-xpp-move-command_timer-functions-to-xbus-core.patch --- dahdi-linux-2.10.2~dfsg/debian/patches/kernel-compat-4.15_0001-xpp-move-command_timer-functions-to-xbus-core.patch 1969-12-31 21:00:00.000000000 -0300 +++ dahdi-linux-2.10.2~dfsg/debian/patches/kernel-compat-4.15_0001-xpp-move-command_timer-functions-to-xbus-core.patch 2018-06-27 11:03:18.000000000 -0300 @@ -0,0 +1,90 @@ +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(-) + +--- a/drivers/dahdi/xpp/xbus-core.c ++++ b/drivers/dahdi/xpp/xbus-core.c +@@ -1304,6 +1304,36 @@ + 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; +--- a/drivers/dahdi/xpp/xbus-pcm.c ++++ b/drivers/dahdi/xpp/xbus-pcm.c +@@ -353,36 +353,6 @@ + (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 + */ diff -Nru dahdi-linux-2.10.2~dfsg/debian/patches/kernel-compat-4.15_0002-fix-building-with-4.15-init_timer-setup_timer.patch dahdi-linux-2.10.2~dfsg/debian/patches/kernel-compat-4.15_0002-fix-building-with-4.15-init_timer-setup_timer.patch --- dahdi-linux-2.10.2~dfsg/debian/patches/kernel-compat-4.15_0002-fix-building-with-4.15-init_timer-setup_timer.patch 1969-12-31 21:00:00.000000000 -0300 +++ dahdi-linux-2.10.2~dfsg/debian/patches/kernel-compat-4.15_0002-fix-building-with-4.15-init_timer-setup_timer.patch 2018-06-27 11:03:45.000000000 -0300 @@ -0,0 +1,275 @@ +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(-) + +--- a/drivers/dahdi/dahdi-base.c ++++ b/drivers/dahdi/dahdi-base.c +@@ -10063,7 +10063,13 @@ + 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; +@@ -10144,8 +10150,7 @@ + + 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); +--- a/drivers/dahdi/dahdi_dynamic.c ++++ b/drivers/dahdi/dahdi_dynamic.c +@@ -831,7 +831,13 @@ + + 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 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 +--- a/drivers/dahdi/dahdi_dynamic_ethmf.c ++++ b/drivers/dahdi/dahdi_dynamic_ethmf.c +@@ -681,7 +681,13 @@ + * 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 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); + +--- a/drivers/dahdi/wctc4xxp/base.c ++++ b/drivers/dahdi/wctc4xxp/base.c +@@ -3701,9 +3701,15 @@ + } + + 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 @@ + 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 + + /* ------------------------------------------------------------------ +--- a/drivers/dahdi/wcte12xp/base.c ++++ b/drivers/dahdi/wcte12xp/base.c +@@ -2766,10 +2766,17 @@ + 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; +@@ -2944,7 +2951,7 @@ + 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); +--- a/drivers/dahdi/wcte13xp-base.c ++++ b/drivers/dahdi/wcte13xp-base.c +@@ -2381,9 +2381,15 @@ + } + } + ++#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 @@ + 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); +--- a/drivers/dahdi/wcte43x-base.c ++++ b/drivers/dahdi/wcte43x-base.c +@@ -3205,9 +3205,15 @@ + 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; +@@ -3433,7 +3439,7 @@ + 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); +--- a/drivers/dahdi/xpp/xbus-core.c ++++ b/drivers/dahdi/xpp/xbus-core.c +@@ -1304,9 +1304,15 @@ + 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); +@@ -1322,8 +1328,6 @@ + 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); + } +@@ -1596,7 +1600,7 @@ + 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; +--- a/include/dahdi/kernel.h ++++ b/include/dahdi/kernel.h +@@ -1642,6 +1642,16 @@ + 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 diff -Nru dahdi-linux-2.10.2~dfsg/debian/patches/series dahdi-linux-2.10.2~dfsg/debian/patches/series --- dahdi-linux-2.10.2~dfsg/debian/patches/series 2017-10-27 09:43:18.000000000 -0200 +++ dahdi-linux-2.10.2~dfsg/debian/patches/series 2018-06-27 11:03:45.000000000 -0300 @@ -10,3 +10,5 @@ oslec-echo-in-kernel.diff kernel-compat-4.11.patch kernel-compat-4.13.patch +kernel-compat-4.15_0001-xpp-move-command_timer-functions-to-xbus-core.patch +kernel-compat-4.15_0002-fix-building-with-4.15-init_timer-setup_timer.patch