@@ -, +, @@ --- 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 | 13 ++++++++++--- include/dahdi/kernel.h | 10 ++++++++++ 9 files changed, 73 insertions(+), 18 deletions(-) --- a/drivers/dahdi/dahdi-base.c +++ a/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); --- a/drivers/dahdi/dahdi_dynamic.c +++ a/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 --- a/drivers/dahdi/dahdi_dynamic_ethmf.c +++ a/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); --- a/drivers/dahdi/wctc4xxp/base.c +++ a/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 /* ------------------------------------------------------------------ --- a/drivers/dahdi/wcte12xp/base.c +++ a/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); --- a/drivers/dahdi/wcte13xp-base.c +++ a/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); --- a/drivers/dahdi/wcte43x-base.c +++ a/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); --- a/drivers/dahdi/xpp/xbus-core.c +++ a/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,10 @@ 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); +#ifdef init_timer + xbus->command_timer.data = (unsigned long)xbus; +#endif atomic_set(&xbus->pcm_rx_counter, 0); xbus->min_tx_sync = INT_MAX; xbus->min_rx_sync = INT_MAX; --- a/include/dahdi/kernel.h +++ a/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 --