Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

treewide: init_timer() -> setup_timer()

This mechanically converts all remaining cases of ancient open-coded timer
setup with the old setup_timer() API, which is the first step in timer
conversions. This has no behavioral changes, since it ultimately just
changes the order of assignment to fields of struct timer_list when
finding variations of:

init_timer(&t);
f.function = timer_callback;
t.data = timer_callback_arg;

to be converted into:

setup_timer(&t, timer_callback, timer_callback_arg);

The conversion is done with the following Coccinelle script, which
is an improved version of scripts/cocci/api/setup_timer.cocci, in the
following ways:
- assignments-before-init_timer() cases
- limit the .data case removal to the specific struct timer_list instance
- handling calls by dereference (timer->field vs timer.field)

spatch --very-quiet --all-includes --include-headers \
-I ./arch/x86/include -I ./arch/x86/include/generated \
-I ./include -I ./arch/x86/include/uapi \
-I ./arch/x86/include/generated/uapi -I ./include/uapi \
-I ./include/generated/uapi --include ./include/linux/kconfig.h \
--dir . \
--cocci-file ~/src/data/setup_timer.cocci

@fix_address_of@
expression e;
@@

init_timer(
-&(e)
+&e
, ...)

// Match the common cases first to avoid Coccinelle parsing loops with
// "... when" clauses.

@match_immediate_function_data_after_init_timer@
expression e, func, da;
@@

-init_timer
+setup_timer
( \(&e\|e\)
+, func, da
);
(
-\(e.function\|e->function\) = func;
-\(e.data\|e->data\) = da;
|
-\(e.data\|e->data\) = da;
-\(e.function\|e->function\) = func;
)

@match_immediate_function_data_before_init_timer@
expression e, func, da;
@@

(
-\(e.function\|e->function\) = func;
-\(e.data\|e->data\) = da;
|
-\(e.data\|e->data\) = da;
-\(e.function\|e->function\) = func;
)
-init_timer
+setup_timer
( \(&e\|e\)
+, func, da
);

@match_function_and_data_after_init_timer@
expression e, e2, e3, e4, e5, func, da;
@@

-init_timer
+setup_timer
( \(&e\|e\)
+, func, da
);
... when != func = e2
when != da = e3
(
-e.function = func;
... when != da = e4
-e.data = da;
|
-e->function = func;
... when != da = e4
-e->data = da;
|
-e.data = da;
... when != func = e5
-e.function = func;
|
-e->data = da;
... when != func = e5
-e->function = func;
)

@match_function_and_data_before_init_timer@
expression e, e2, e3, e4, e5, func, da;
@@
(
-e.function = func;
... when != da = e4
-e.data = da;
|
-e->function = func;
... when != da = e4
-e->data = da;
|
-e.data = da;
... when != func = e5
-e.function = func;
|
-e->data = da;
... when != func = e5
-e->function = func;
)
... when != func = e2
when != da = e3
-init_timer
+setup_timer
( \(&e\|e\)
+, func, da
);

@r1 exists@
expression t;
identifier f;
position p;
@@

f(...) { ... when any
init_timer@p(\(&t\|t\))
... when any
}

@r2 exists@
expression r1.t;
identifier g != r1.f;
expression e8;
@@

g(...) { ... when any
\(t.data\|t->data\) = e8
... when any
}

// It is dangerous to use setup_timer if data field is initialized
// in another function.
@script:python depends on r2@
p << r1.p;
@@

cocci.include_match(False)

@r3@
expression r1.t, func, e7;
position r1.p;
@@

(
-init_timer@p(&t);
+setup_timer(&t, func, 0UL);
... when != func = e7
-t.function = func;
|
-t.function = func;
... when != func = e7
-init_timer@p(&t);
+setup_timer(&t, func, 0UL);
|
-init_timer@p(t);
+setup_timer(t, func, 0UL);
... when != func = e7
-t->function = func;
|
-t->function = func;
... when != func = e7
-init_timer@p(t);
+setup_timer(t, func, 0UL);
)

Signed-off-by: Kees Cook <keescook@chromium.org>

+55 -113
+1 -2
arch/arm/mach-iop32x/n2100.c
··· 336 336 pr_err("could not set power GPIO as input\n"); 337 337 } 338 338 /* Set up power button poll timer */ 339 - init_timer(&power_button_poll_timer); 340 - power_button_poll_timer.function = power_button_poll; 339 + setup_timer(&power_button_poll_timer, power_button_poll, 0UL); 341 340 power_button_poll_timer.expires = jiffies + (HZ / 10); 342 341 add_timer(&power_button_poll_timer); 343 342 return 0;
+1 -2
arch/blackfin/kernel/nmi.c
··· 180 180 nmi_wdt_start(); 181 181 nmi_active = true; 182 182 183 - init_timer(&ntimer); 184 - ntimer.function = nmi_wdt_timer; 183 + setup_timer(&ntimer, nmi_wdt_timer, 0UL); 185 184 ntimer.expires = jiffies + NMI_CHECK_TIMEOUT; 186 185 add_timer(&ntimer); 187 186
+4 -6
arch/sh/drivers/pci/common.c
··· 106 106 void pcibios_enable_timers(struct pci_channel *hose) 107 107 { 108 108 if (hose->err_irq) { 109 - init_timer(&hose->err_timer); 110 - hose->err_timer.data = (unsigned long)hose; 111 - hose->err_timer.function = pcibios_enable_err; 109 + setup_timer(&hose->err_timer, pcibios_enable_err, 110 + (unsigned long)hose); 112 111 } 113 112 114 113 if (hose->serr_irq) { 115 - init_timer(&hose->serr_timer); 116 - hose->serr_timer.data = (unsigned long)hose; 117 - hose->serr_timer.function = pcibios_enable_serr; 114 + setup_timer(&hose->serr_timer, pcibios_enable_serr, 115 + (unsigned long)hose); 118 116 } 119 117 } 120 118
+1 -4
arch/sh/drivers/push-switch.c
··· 78 78 } 79 79 80 80 INIT_WORK(&psw->work, switch_work_handler); 81 - init_timer(&psw->debounce); 82 - 83 - psw->debounce.function = switch_timer; 84 - psw->debounce.data = (unsigned long)psw; 81 + setup_timer(&psw->debounce, switch_timer, (unsigned long)psw); 85 82 86 83 /* Workqueue API brain-damage */ 87 84 psw->pdev = pdev;
+1 -3
drivers/atm/firestream.c
··· 1885 1885 } 1886 1886 1887 1887 #ifdef FS_POLL_FREQ 1888 - init_timer (&dev->timer); 1889 - dev->timer.data = (unsigned long) dev; 1890 - dev->timer.function = fs_poll; 1888 + setup_timer (&dev->timer, fs_poll, (unsigned long)dev); 1891 1889 dev->timer.expires = jiffies + FS_POLL_FREQ; 1892 1890 add_timer (&dev->timer); 1893 1891 #endif
+1 -3
drivers/atm/lanai.c
··· 1790 1790 1791 1791 static inline void lanai_timed_poll_start(struct lanai_dev *lanai) 1792 1792 { 1793 - init_timer(&lanai->timer); 1793 + setup_timer(&lanai->timer, lanai_timed_poll, (unsigned long)lanai); 1794 1794 lanai->timer.expires = jiffies + LANAI_POLL_PERIOD; 1795 - lanai->timer.data = (unsigned long) lanai; 1796 - lanai->timer.function = lanai_timed_poll; 1797 1795 add_timer(&lanai->timer); 1798 1796 } 1799 1797
+1 -3
drivers/atm/nicstar.c
··· 284 284 XPRINTK("nicstar: nicstar_init() returned.\n"); 285 285 286 286 if (!error) { 287 - init_timer(&ns_timer); 287 + setup_timer(&ns_timer, ns_poll, 0UL); 288 288 ns_timer.expires = jiffies + NS_POLL_PERIOD; 289 - ns_timer.data = 0UL; 290 - ns_timer.function = ns_poll; 291 289 add_timer(&ns_timer); 292 290 } 293 291
+2 -3
drivers/block/DAC960.c
··· 3079 3079 /* 3080 3080 Initialize the Monitoring Timer. 3081 3081 */ 3082 - init_timer(&Controller->MonitoringTimer); 3082 + setup_timer(&Controller->MonitoringTimer, 3083 + DAC960_MonitoringTimerFunction, (unsigned long)Controller); 3083 3084 Controller->MonitoringTimer.expires = 3084 3085 jiffies + DAC960_MonitoringTimerInterval; 3085 - Controller->MonitoringTimer.data = (unsigned long) Controller; 3086 - Controller->MonitoringTimer.function = DAC960_MonitoringTimerFunction; 3087 3086 add_timer(&Controller->MonitoringTimer); 3088 3087 Controller->ControllerInitialized = true; 3089 3088 return true;
+1 -2
drivers/block/umem.c
··· 738 738 739 739 static void init_battery_timer(void) 740 740 { 741 - init_timer(&battery_timer); 742 - battery_timer.function = check_all_batteries; 741 + setup_timer(&battery_timer, check_all_batteries, 0UL); 743 742 battery_timer.expires = jiffies + (HZ * 60); 744 743 add_timer(&battery_timer); 745 744 }
+1 -3
drivers/gpu/drm/omapdrm/dss/dsi.c
··· 5449 5449 dsi_framedone_timeout_work_callback); 5450 5450 5451 5451 #ifdef DSI_CATCH_MISSING_TE 5452 - init_timer(&dsi->te_timer); 5453 - dsi->te_timer.function = dsi_te_timeout; 5454 - dsi->te_timer.data = 0; 5452 + setup_timer(&dsi->te_timer, dsi_te_timeout, 0); 5455 5453 #endif 5456 5454 5457 5455 dsi_mem = platform_get_resource_byname(dsidev, IORESOURCE_MEM, "proto");
+1 -3
drivers/infiniband/hw/mthca/mthca_catas.c
··· 149 149 { 150 150 phys_addr_t addr; 151 151 152 - init_timer(&dev->catas_err.timer); 152 + setup_timer(&dev->catas_err.timer, poll_catas, (unsigned long)dev); 153 153 dev->catas_err.map = NULL; 154 154 155 155 addr = pci_resource_start(dev->pdev, 0) + ··· 164 164 return; 165 165 } 166 166 167 - dev->catas_err.timer.data = (unsigned long) dev; 168 - dev->catas_err.timer.function = poll_catas; 169 167 dev->catas_err.timer.expires = jiffies + MTHCA_CATAS_POLL_INTERVAL; 170 168 INIT_LIST_HEAD(&dev->catas_err.list); 171 169 add_timer(&dev->catas_err.timer);
+1 -2
drivers/isdn/i4l/isdn_common.c
··· 2294 2294 printk(KERN_WARNING "isdn: Could not allocate device-struct.\n"); 2295 2295 return -EIO; 2296 2296 } 2297 - init_timer(&dev->timer); 2298 - dev->timer.function = isdn_timer_funct; 2297 + setup_timer(&dev->timer, isdn_timer_funct, 0UL); 2299 2298 spin_lock_init(&dev->lock); 2300 2299 spin_lock_init(&dev->timerlock); 2301 2300 #ifdef MODULE
+3 -3
drivers/isdn/i4l/isdn_net.c
··· 1615 1615 /* send slarp request because interface/seq.no.s reset */ 1616 1616 isdn_net_ciscohdlck_slarp_send_request(lp); 1617 1617 1618 - init_timer(&lp->cisco_timer); 1619 - lp->cisco_timer.data = (unsigned long) lp; 1620 - lp->cisco_timer.function = isdn_net_ciscohdlck_slarp_send_keepalive; 1618 + setup_timer(&lp->cisco_timer, 1619 + isdn_net_ciscohdlck_slarp_send_keepalive, 1620 + (unsigned long)lp); 1621 1621 lp->cisco_timer.expires = jiffies + lp->cisco_keepalive_period * HZ; 1622 1622 add_timer(&lp->cisco_timer); 1623 1623 }
+2 -3
drivers/media/platform/s5p-mfc/s5p_mfc.c
··· 1314 1314 dev->hw_lock = 0; 1315 1315 INIT_WORK(&dev->watchdog_work, s5p_mfc_watchdog_worker); 1316 1316 atomic_set(&dev->watchdog_cnt, 0); 1317 - init_timer(&dev->watchdog_timer); 1318 - dev->watchdog_timer.data = (unsigned long)dev; 1319 - dev->watchdog_timer.function = s5p_mfc_watchdog; 1317 + setup_timer(&dev->watchdog_timer, s5p_mfc_watchdog, 1318 + (unsigned long)dev); 1320 1319 1321 1320 ret = v4l2_device_register(&pdev->dev, &dev->v4l2_dev); 1322 1321 if (ret)
+2 -3
drivers/media/usb/au0828/au0828-dvb.c
··· 648 648 return ret; 649 649 } 650 650 651 - dev->bulk_timeout.function = au0828_bulk_timeout; 652 - dev->bulk_timeout.data = (unsigned long) dev; 653 - init_timer(&dev->bulk_timeout); 651 + setup_timer(&dev->bulk_timeout, au0828_bulk_timeout, 652 + (unsigned long)dev); 654 653 655 654 return 0; 656 655 }
+1 -3
drivers/net/wireless/intersil/hostap/hostap_ap.c
··· 1189 1189 } 1190 1190 1191 1191 #ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT 1192 - init_timer(&sta->timer); 1192 + setup_timer(&sta->timer, ap_handle_timer, (unsigned long)sta); 1193 1193 sta->timer.expires = jiffies + ap->max_inactivity; 1194 - sta->timer.data = (unsigned long) sta; 1195 - sta->timer.function = ap_handle_timer; 1196 1194 if (!ap->local->hostapd) 1197 1195 add_timer(&sta->timer); 1198 1196 #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */
+4 -7
drivers/net/wireless/intersil/hostap/hostap_hw.c
··· 3225 3225 3226 3226 lib80211_crypt_info_init(&local->crypt_info, dev->name, &local->lock); 3227 3227 3228 - init_timer(&local->passive_scan_timer); 3229 - local->passive_scan_timer.data = (unsigned long) local; 3230 - local->passive_scan_timer.function = hostap_passive_scan; 3231 - 3232 - init_timer(&local->tick_timer); 3233 - local->tick_timer.data = (unsigned long) local; 3234 - local->tick_timer.function = hostap_tick_timer; 3228 + setup_timer(&local->passive_scan_timer, hostap_passive_scan, 3229 + (unsigned long)local); 3230 + setup_timer(&local->tick_timer, hostap_tick_timer, 3231 + (unsigned long)local); 3235 3232 local->tick_timer.expires = jiffies + 2 * HZ; 3236 3233 add_timer(&local->tick_timer); 3237 3234
+2 -3
drivers/nfc/pn533/pn533.c
··· 2632 2632 if (priv->wq == NULL) 2633 2633 goto error; 2634 2634 2635 - init_timer(&priv->listen_timer); 2636 - priv->listen_timer.data = (unsigned long) priv; 2637 - priv->listen_timer.function = pn533_listen_mode_timer; 2635 + setup_timer(&priv->listen_timer, pn533_listen_mode_timer, 2636 + (unsigned long)priv); 2638 2637 2639 2638 skb_queue_head_init(&priv->resp_q); 2640 2639 skb_queue_head_init(&priv->fragment_skb);
+2 -7
drivers/nfc/st-nci/ndlc.c
··· 282 282 *ndlc_id = ndlc; 283 283 284 284 /* initialize timers */ 285 - init_timer(&ndlc->t1_timer); 286 - ndlc->t1_timer.data = (unsigned long)ndlc; 287 - ndlc->t1_timer.function = ndlc_t1_timeout; 288 - 289 - init_timer(&ndlc->t2_timer); 290 - ndlc->t2_timer.data = (unsigned long)ndlc; 291 - ndlc->t2_timer.function = ndlc_t2_timeout; 285 + setup_timer(&ndlc->t1_timer, ndlc_t1_timeout, (unsigned long)ndlc); 286 + setup_timer(&ndlc->t2_timer, ndlc_t2_timeout, (unsigned long)ndlc); 292 287 293 288 skb_queue_head_init(&ndlc->rcv_q); 294 289 skb_queue_head_init(&ndlc->send_q);
+4 -7
drivers/nfc/st-nci/se.c
··· 725 725 726 726 init_completion(&info->se_info.req_completion); 727 727 /* initialize timers */ 728 - init_timer(&info->se_info.bwi_timer); 729 - info->se_info.bwi_timer.data = (unsigned long)info; 730 - info->se_info.bwi_timer.function = st_nci_se_wt_timeout; 728 + setup_timer(&info->se_info.bwi_timer, st_nci_se_wt_timeout, 729 + (unsigned long)info); 731 730 info->se_info.bwi_active = false; 732 731 733 - init_timer(&info->se_info.se_active_timer); 734 - info->se_info.se_active_timer.data = (unsigned long)info; 735 - info->se_info.se_active_timer.function = 736 - st_nci_se_activation_timeout; 732 + setup_timer(&info->se_info.se_active_timer, 733 + st_nci_se_activation_timeout, (unsigned long)info); 737 734 info->se_info.se_active = false; 738 735 739 736 info->se_info.xch_error = false;
+4 -6
drivers/nfc/st21nfca/se.c
··· 392 392 393 393 init_completion(&info->se_info.req_completion); 394 394 /* initialize timers */ 395 - init_timer(&info->se_info.bwi_timer); 396 - info->se_info.bwi_timer.data = (unsigned long)info; 397 - info->se_info.bwi_timer.function = st21nfca_se_wt_timeout; 395 + setup_timer(&info->se_info.bwi_timer, st21nfca_se_wt_timeout, 396 + (unsigned long)info); 398 397 info->se_info.bwi_active = false; 399 398 400 - init_timer(&info->se_info.se_active_timer); 401 - info->se_info.se_active_timer.data = (unsigned long)info; 402 - info->se_info.se_active_timer.function = st21nfca_se_activation_timeout; 399 + setup_timer(&info->se_info.se_active_timer, 400 + st21nfca_se_activation_timeout, (unsigned long)info); 403 401 info->se_info.se_active = false; 404 402 405 403 info->se_info.count_pipes = 0;
+3 -6
drivers/s390/block/dasd.c
··· 119 119 (void (*)(unsigned long)) dasd_device_tasklet, 120 120 (unsigned long) device); 121 121 INIT_LIST_HEAD(&device->ccw_queue); 122 - init_timer(&device->timer); 123 - device->timer.function = dasd_device_timeout; 124 - device->timer.data = (unsigned long) device; 122 + setup_timer(&device->timer, dasd_device_timeout, 123 + (unsigned long)device); 125 124 INIT_WORK(&device->kick_work, do_kick_device); 126 125 INIT_WORK(&device->restore_device, do_restore_device); 127 126 INIT_WORK(&device->reload_device, do_reload_device); ··· 162 163 (unsigned long) block); 163 164 INIT_LIST_HEAD(&block->ccw_queue); 164 165 spin_lock_init(&block->queue_lock); 165 - init_timer(&block->timer); 166 - block->timer.function = dasd_block_timeout; 167 - block->timer.data = (unsigned long) block; 166 + setup_timer(&block->timer, dasd_block_timeout, (unsigned long)block); 168 167 spin_lock_init(&block->profile.lock); 169 168 170 169 return block;
+1 -3
drivers/s390/net/fsm.c
··· 142 142 fsm_settimer(fsm_instance *fi, fsm_timer *this) 143 143 { 144 144 this->fi = fi; 145 - this->tl.function = (void *)fsm_expire_timer; 146 - this->tl.data = (long)this; 147 145 #if FSM_TIMER_DEBUG 148 146 printk(KERN_DEBUG "fsm(%s): Create timer %p\n", fi->name, 149 147 this); 150 148 #endif 151 - init_timer(&this->tl); 149 + setup_timer(&this->tl, (void *)fsm_expire_timer, (long)this); 152 150 } 153 151 154 152 void
+4 -6
drivers/scsi/arcmsr/arcmsr_hba.c
··· 837 837 atomic_set(&acb->rq_map_token, 16); 838 838 atomic_set(&acb->ante_token_value, 16); 839 839 acb->fw_flag = FW_NORMAL; 840 - init_timer(&acb->eternal_timer); 840 + setup_timer(&acb->eternal_timer, &arcmsr_request_device_map, 841 + (unsigned long)acb); 841 842 acb->eternal_timer.expires = jiffies + msecs_to_jiffies(6 * HZ); 842 - acb->eternal_timer.data = (unsigned long) acb; 843 - acb->eternal_timer.function = &arcmsr_request_device_map; 844 843 add_timer(&acb->eternal_timer); 845 844 if(arcmsr_alloc_sysfs_attr(acb)) 846 845 goto out_free_sysfs; ··· 929 930 atomic_set(&acb->rq_map_token, 16); 930 931 atomic_set(&acb->ante_token_value, 16); 931 932 acb->fw_flag = FW_NORMAL; 932 - init_timer(&acb->eternal_timer); 933 + setup_timer(&acb->eternal_timer, &arcmsr_request_device_map, 934 + (unsigned long)acb); 933 935 acb->eternal_timer.expires = jiffies + msecs_to_jiffies(6 * HZ); 934 - acb->eternal_timer.data = (unsigned long) acb; 935 - acb->eternal_timer.function = &arcmsr_request_device_map; 936 936 add_timer(&acb->eternal_timer); 937 937 return 0; 938 938 controller_stop:
+1 -3
drivers/scsi/arm/fas216.c
··· 2849 2849 info->rst_dev_status = -1; 2850 2850 info->rst_bus_status = -1; 2851 2851 init_waitqueue_head(&info->eh_wait); 2852 - init_timer(&info->eh_timer); 2853 - info->eh_timer.data = (unsigned long)info; 2854 - info->eh_timer.function = fas216_eh_timer; 2852 + setup_timer(&info->eh_timer, fas216_eh_timer, (unsigned long)info); 2855 2853 2856 2854 spin_lock_init(&info->host_lock); 2857 2855
+1 -3
drivers/scsi/bfa/bfad.c
··· 719 719 void 720 720 bfad_init_timer(struct bfad_s *bfad) 721 721 { 722 - init_timer(&bfad->hal_tmo); 723 - bfad->hal_tmo.function = bfad_bfa_tmo; 724 - bfad->hal_tmo.data = (unsigned long)bfad; 722 + setup_timer(&bfad->hal_tmo, bfad_bfa_tmo, (unsigned long)bfad); 725 723 726 724 mod_timer(&bfad->hal_tmo, 727 725 jiffies + msecs_to_jiffies(BFA_TIMER_FREQ));
+1 -3
drivers/scsi/esas2r/esas2r_main.c
··· 1635 1635 1636 1636 void esas2r_kickoff_timer(struct esas2r_adapter *a) 1637 1637 { 1638 - init_timer(&a->timer); 1638 + setup_timer(&a->timer, esas2r_timer_callback, (unsigned long)a); 1639 1639 1640 - a->timer.function = esas2r_timer_callback; 1641 - a->timer.data = (unsigned long)a; 1642 1640 a->timer.expires = jiffies + 1643 1641 msecs_to_jiffies(100); 1644 1642
+1 -3
drivers/scsi/ncr53c8xx.c
··· 8357 8357 if (!np->scripth0) 8358 8358 goto attach_error; 8359 8359 8360 - init_timer(&np->timer); 8361 - np->timer.data = (unsigned long) np; 8362 - np->timer.function = ncr53c8xx_timeout; 8360 + setup_timer(&np->timer, ncr53c8xx_timeout, (unsigned long)np); 8363 8361 8364 8362 /* Try to map the controller chip to virtual and physical memory. */ 8365 8363
+1 -3
drivers/scsi/sym53c8xx_2/sym_glue.c
··· 1351 1351 /* 1352 1352 * Start the timer daemon 1353 1353 */ 1354 - init_timer(&np->s.timer); 1355 - np->s.timer.data = (unsigned long) np; 1356 - np->s.timer.function = sym53c8xx_timer; 1354 + setup_timer(&np->s.timer, sym53c8xx_timer, (unsigned long)np); 1357 1355 np->s.lasttime=0; 1358 1356 sym_timer (np); 1359 1357
+1 -3
drivers/usb/gadget/udc/omap_udc.c
··· 2542 2542 } 2543 2543 if (dbuf && addr) 2544 2544 epn_rxtx |= UDC_EPN_RX_DB; 2545 - init_timer(&ep->timer); 2546 - ep->timer.function = pio_out_timer; 2547 - ep->timer.data = (unsigned long) ep; 2545 + setup_timer(&ep->timer, pio_out_timer, (unsigned long)ep); 2548 2546 } 2549 2547 if (addr) 2550 2548 epn_rxtx |= UDC_EPN_RX_VALID;
+1 -2
kernel/time/clocksource.c
··· 290 290 { 291 291 if (watchdog_running || !watchdog || list_empty(&watchdog_list)) 292 292 return; 293 - init_timer(&watchdog_timer); 294 - watchdog_timer.function = clocksource_watchdog; 293 + setup_timer(&watchdog_timer, clocksource_watchdog, 0UL); 295 294 watchdog_timer.expires = jiffies + WATCHDOG_INTERVAL; 296 295 add_timer_on(&watchdog_timer, cpumask_first(cpu_online_mask)); 297 296 watchdog_running = 1;