]> git.baikalelectronics.ru Git - kernel.git/commitdiff
treewide: init_timer() -> setup_timer()
authorKees Cook <keescook@chromium.org>
Mon, 16 Oct 2017 20:15:39 +0000 (13:15 -0700)
committerKees Cook <keescook@chromium.org>
Tue, 21 Nov 2017 23:57:06 +0000 (15:57 -0800)
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>
31 files changed:
arch/arm/mach-iop32x/n2100.c
arch/blackfin/kernel/nmi.c
arch/sh/drivers/pci/common.c
arch/sh/drivers/push-switch.c
drivers/atm/firestream.c
drivers/atm/lanai.c
drivers/atm/nicstar.c
drivers/block/DAC960.c
drivers/block/umem.c
drivers/gpu/drm/omapdrm/dss/dsi.c
drivers/infiniband/hw/mthca/mthca_catas.c
drivers/isdn/i4l/isdn_common.c
drivers/isdn/i4l/isdn_net.c
drivers/media/platform/s5p-mfc/s5p_mfc.c
drivers/media/usb/au0828/au0828-dvb.c
drivers/net/wireless/intersil/hostap/hostap_ap.c
drivers/net/wireless/intersil/hostap/hostap_hw.c
drivers/nfc/pn533/pn533.c
drivers/nfc/st-nci/ndlc.c
drivers/nfc/st-nci/se.c
drivers/nfc/st21nfca/se.c
drivers/s390/block/dasd.c
drivers/s390/net/fsm.c
drivers/scsi/arcmsr/arcmsr_hba.c
drivers/scsi/arm/fas216.c
drivers/scsi/bfa/bfad.c
drivers/scsi/esas2r/esas2r_main.c
drivers/scsi/ncr53c8xx.c
drivers/scsi/sym53c8xx_2/sym_glue.c
drivers/usb/gadget/udc/omap_udc.c
kernel/time/clocksource.c

index c1cd80ecc21992b2778c20f03f04ea9c328e0a4e..4a64a11ba63ca07f67b05640fa41a03ab9638a4b 100644 (file)
@@ -336,8 +336,7 @@ static int __init n2100_request_gpios(void)
                        pr_err("could not set power GPIO as input\n");
        }
        /* Set up power button poll timer */
-       init_timer(&power_button_poll_timer);
-       power_button_poll_timer.function = power_button_poll;
+       setup_timer(&power_button_poll_timer, power_button_poll, 0UL);
        power_button_poll_timer.expires = jiffies + (HZ / 10);
        add_timer(&power_button_poll_timer);
        return 0;
index 1e714329fe8a186f59f7a6bf25de7393a14fb403..828f4fbdb58a17b11a5c8f84dddce9eea7d760c3 100644 (file)
@@ -180,8 +180,7 @@ static int __init init_nmi_wdt(void)
        nmi_wdt_start();
        nmi_active = true;
 
-       init_timer(&ntimer);
-       ntimer.function = nmi_wdt_timer;
+       setup_timer(&ntimer, nmi_wdt_timer, 0UL);
        ntimer.expires = jiffies + NMI_CHECK_TIMEOUT;
        add_timer(&ntimer);
 
index cae707f3472dc59fbc79d9fe8ecfeeb75806e666..0d7eb7b5ac8d00feed926b332500e43a0d55fb35 100644 (file)
@@ -106,15 +106,13 @@ static void pcibios_enable_serr(unsigned long __data)
 void pcibios_enable_timers(struct pci_channel *hose)
 {
        if (hose->err_irq) {
-               init_timer(&hose->err_timer);
-               hose->err_timer.data = (unsigned long)hose;
-               hose->err_timer.function = pcibios_enable_err;
+               setup_timer(&hose->err_timer, pcibios_enable_err,
+                           (unsigned long)hose);
        }
 
        if (hose->serr_irq) {
-               init_timer(&hose->serr_timer);
-               hose->serr_timer.data = (unsigned long)hose;
-               hose->serr_timer.function = pcibios_enable_serr;
+               setup_timer(&hose->serr_timer, pcibios_enable_serr,
+                           (unsigned long)hose);
        }
 }
 
index 5bfb341cc5c4ad71eefe29a8f5175f715d07c59b..2dc791507968aa79e93179200eb24e97782cef1c 100644 (file)
@@ -78,10 +78,7 @@ static int switch_drv_probe(struct platform_device *pdev)
        }
 
        INIT_WORK(&psw->work, switch_work_handler);
-       init_timer(&psw->debounce);
-
-       psw->debounce.function = switch_timer;
-       psw->debounce.data = (unsigned long)psw;
+       setup_timer(&psw->debounce, switch_timer, (unsigned long)psw);
 
        /* Workqueue API brain-damage */
        psw->pdev = pdev;
index 6b6368a565261b5037d5d5f83899a9d664671222..534001270be53014a2c8a1f51695476edfeec41e 100644 (file)
@@ -1885,9 +1885,7 @@ static int fs_init(struct fs_dev *dev)
        }
 
 #ifdef FS_POLL_FREQ
-       init_timer (&dev->timer);
-       dev->timer.data = (unsigned long) dev;
-       dev->timer.function = fs_poll;
+       setup_timer (&dev->timer, fs_poll, (unsigned long)dev);
        dev->timer.expires = jiffies + FS_POLL_FREQ;
        add_timer (&dev->timer);
 #endif
index 2351dad78ff58aec2d714059c73da094bb723641..87e8b5dfac397309424fd457bd38dedbb0504027 100644 (file)
@@ -1790,10 +1790,8 @@ static void lanai_timed_poll(unsigned long arg)
 
 static inline void lanai_timed_poll_start(struct lanai_dev *lanai)
 {
-       init_timer(&lanai->timer);
+       setup_timer(&lanai->timer, lanai_timed_poll, (unsigned long)lanai);
        lanai->timer.expires = jiffies + LANAI_POLL_PERIOD;
-       lanai->timer.data = (unsigned long) lanai;
-       lanai->timer.function = lanai_timed_poll;
        add_timer(&lanai->timer);
 }
 
index a9702836cbaeb10b233c6e1b7b818e527f2d1542..335447ed0ba4516b79e4fbf30970e194c5b0d0ee 100644 (file)
@@ -284,10 +284,8 @@ static int __init nicstar_init(void)
        XPRINTK("nicstar: nicstar_init() returned.\n");
 
        if (!error) {
-               init_timer(&ns_timer);
+               setup_timer(&ns_timer, ns_poll, 0UL);
                ns_timer.expires = jiffies + NS_POLL_PERIOD;
-               ns_timer.data = 0UL;
-               ns_timer.function = ns_poll;
                add_timer(&ns_timer);
        }
 
index 255591ab37168dd8d6f5c9780ce61e339be81810..6f14cdd6015ba6eec1c92f740953855aa828fcdc 100644 (file)
@@ -3079,11 +3079,10 @@ DAC960_InitializeController(DAC960_Controller_T *Controller)
       /*
        Initialize the Monitoring Timer.
       */
-      init_timer(&Controller->MonitoringTimer);
+      setup_timer(&Controller->MonitoringTimer,
+                  DAC960_MonitoringTimerFunction, (unsigned long)Controller);
       Controller->MonitoringTimer.expires =
        jiffies + DAC960_MonitoringTimerInterval;
-      Controller->MonitoringTimer.data = (unsigned long) Controller;
-      Controller->MonitoringTimer.function = DAC960_MonitoringTimerFunction;
       add_timer(&Controller->MonitoringTimer);
       Controller->ControllerInitialized = true;
       return true;
index 0677d2514665c75c3c45c27b827b01d6f045fc07..b4d4ccfe758269d2c863bd0be12ff69bdf5cb585 100644 (file)
@@ -738,8 +738,7 @@ static void check_all_batteries(unsigned long ptr)
 
 static void init_battery_timer(void)
 {
-       init_timer(&battery_timer);
-       battery_timer.function = check_all_batteries;
+       setup_timer(&battery_timer, check_all_batteries, 0UL);
        battery_timer.expires = jiffies + (HZ * 60);
        add_timer(&battery_timer);
 }
index b56a05730314ffe0257d157ea27d44859829fb40..cea744e4d9bd27c17f4e264a0991d33e638bc2cb 100644 (file)
@@ -5449,9 +5449,7 @@ static int dsi_bind(struct device *dev, struct device *master, void *data)
                             dsi_framedone_timeout_work_callback);
 
 #ifdef DSI_CATCH_MISSING_TE
-       init_timer(&dsi->te_timer);
-       dsi->te_timer.function = dsi_te_timeout;
-       dsi->te_timer.data = 0;
+       setup_timer(&dsi->te_timer, dsi_te_timeout, 0);
 #endif
 
        dsi_mem = platform_get_resource_byname(dsidev, IORESOURCE_MEM, "proto");
index f6474c24f193c4edb379dd37847093b7fb217321..23cc08d5c24e6cc2c12c82d88f084f80083065e5 100644 (file)
@@ -149,7 +149,7 @@ void mthca_start_catas_poll(struct mthca_dev *dev)
 {
        phys_addr_t addr;
 
-       init_timer(&dev->catas_err.timer);
+       setup_timer(&dev->catas_err.timer, poll_catas, (unsigned long)dev);
        dev->catas_err.map  = NULL;
 
        addr = pci_resource_start(dev->pdev, 0) +
@@ -164,8 +164,6 @@ void mthca_start_catas_poll(struct mthca_dev *dev)
                return;
        }
 
-       dev->catas_err.timer.data     = (unsigned long) dev;
-       dev->catas_err.timer.function = poll_catas;
        dev->catas_err.timer.expires  = jiffies + MTHCA_CATAS_POLL_INTERVAL;
        INIT_LIST_HEAD(&dev->catas_err.list);
        add_timer(&dev->catas_err.timer);
index 38a5bb764c7b55cb8b742639e49756e413b4ab26..3fa2f7b31131a8a2e70dd3f2b92c47232b22eb6d 100644 (file)
@@ -2294,8 +2294,7 @@ static int __init isdn_init(void)
                printk(KERN_WARNING "isdn: Could not allocate device-struct.\n");
                return -EIO;
        }
-       init_timer(&dev->timer);
-       dev->timer.function = isdn_timer_funct;
+       setup_timer(&dev->timer, isdn_timer_funct, 0UL);
        spin_lock_init(&dev->lock);
        spin_lock_init(&dev->timerlock);
 #ifdef MODULE
index f63a110b7bcb2d2257869484bd9b894d94b9b5d2..59d40160cab20393ed4b0ec219632290f43c6e7c 100644 (file)
@@ -1615,9 +1615,9 @@ isdn_net_ciscohdlck_connected(isdn_net_local *lp)
        /* send slarp request because interface/seq.no.s reset */
        isdn_net_ciscohdlck_slarp_send_request(lp);
 
-       init_timer(&lp->cisco_timer);
-       lp->cisco_timer.data = (unsigned long) lp;
-       lp->cisco_timer.function = isdn_net_ciscohdlck_slarp_send_keepalive;
+       setup_timer(&lp->cisco_timer,
+                   isdn_net_ciscohdlck_slarp_send_keepalive,
+                   (unsigned long)lp);
        lp->cisco_timer.expires = jiffies + lp->cisco_keepalive_period * HZ;
        add_timer(&lp->cisco_timer);
 }
index 1839a86cc2a557dde0dd590eda4dadf1bc5d0815..e179b33d3775a76818f4effbec1eb9140f57186c 100644 (file)
@@ -1314,9 +1314,8 @@ static int s5p_mfc_probe(struct platform_device *pdev)
        dev->hw_lock = 0;
        INIT_WORK(&dev->watchdog_work, s5p_mfc_watchdog_worker);
        atomic_set(&dev->watchdog_cnt, 0);
-       init_timer(&dev->watchdog_timer);
-       dev->watchdog_timer.data = (unsigned long)dev;
-       dev->watchdog_timer.function = s5p_mfc_watchdog;
+       setup_timer(&dev->watchdog_timer, s5p_mfc_watchdog,
+                   (unsigned long)dev);
 
        ret = v4l2_device_register(&pdev->dev, &dev->v4l2_dev);
        if (ret)
index 34dc7e062471c651192f7d5a01ff2780fc28f64e..d701c04b3783ff5783dd85687d77eaff5b0ead69 100644 (file)
@@ -648,9 +648,8 @@ int au0828_dvb_register(struct au0828_dev *dev)
                return ret;
        }
 
-       dev->bulk_timeout.function = au0828_bulk_timeout;
-       dev->bulk_timeout.data = (unsigned long) dev;
-       init_timer(&dev->bulk_timeout);
+       setup_timer(&dev->bulk_timeout, au0828_bulk_timeout,
+                   (unsigned long)dev);
 
        return 0;
 }
index 1a8d8db80b05405de0a2f1a7160c56cb2fd0fdc3..f9d04731469214bc3b20ad58fcc82954091c8828 100644 (file)
@@ -1189,10 +1189,8 @@ static struct sta_info * ap_add_sta(struct ap_data *ap, u8 *addr)
        }
 
 #ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT
-       init_timer(&sta->timer);
+       setup_timer(&sta->timer, ap_handle_timer, (unsigned long)sta);
        sta->timer.expires = jiffies + ap->max_inactivity;
-       sta->timer.data = (unsigned long) sta;
-       sta->timer.function = ap_handle_timer;
        if (!ap->local->hostapd)
                add_timer(&sta->timer);
 #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */
index 72b46eaf3de21ce1e6b6b43064f4488a61e2c4f5..8177fd6f65c142cfdbdbc67049e7379f718fa1ed 100644 (file)
@@ -3225,13 +3225,10 @@ while (0)
 
        lib80211_crypt_info_init(&local->crypt_info, dev->name, &local->lock);
 
-       init_timer(&local->passive_scan_timer);
-       local->passive_scan_timer.data = (unsigned long) local;
-       local->passive_scan_timer.function = hostap_passive_scan;
-
-       init_timer(&local->tick_timer);
-       local->tick_timer.data = (unsigned long) local;
-       local->tick_timer.function = hostap_tick_timer;
+       setup_timer(&local->passive_scan_timer, hostap_passive_scan,
+                   (unsigned long)local);
+       setup_timer(&local->tick_timer, hostap_tick_timer,
+                   (unsigned long)local);
        local->tick_timer.expires = jiffies + 2 * HZ;
        add_timer(&local->tick_timer);
 
index c05cb637ba9234371b24d4f7ede54ff7b4a6f0c3..2effa5ff70822449b40ab028c2c2d6bd3ff4b0ed 100644 (file)
@@ -2632,9 +2632,8 @@ struct pn533 *pn533_register_device(u32 device_type,
        if (priv->wq == NULL)
                goto error;
 
-       init_timer(&priv->listen_timer);
-       priv->listen_timer.data = (unsigned long) priv;
-       priv->listen_timer.function = pn533_listen_mode_timer;
+       setup_timer(&priv->listen_timer, pn533_listen_mode_timer,
+                   (unsigned long)priv);
 
        skb_queue_head_init(&priv->resp_q);
        skb_queue_head_init(&priv->fragment_skb);
index 9477994cf97534fe38b6b1e70b603c932081de6e..93a7536a9af9978a891483c1fc02d4e65f95b2a5 100644 (file)
@@ -282,13 +282,8 @@ int ndlc_probe(void *phy_id, struct nfc_phy_ops *phy_ops, struct device *dev,
        *ndlc_id = ndlc;
 
        /* initialize timers */
-       init_timer(&ndlc->t1_timer);
-       ndlc->t1_timer.data = (unsigned long)ndlc;
-       ndlc->t1_timer.function = ndlc_t1_timeout;
-
-       init_timer(&ndlc->t2_timer);
-       ndlc->t2_timer.data = (unsigned long)ndlc;
-       ndlc->t2_timer.function = ndlc_t2_timeout;
+       setup_timer(&ndlc->t1_timer, ndlc_t1_timeout, (unsigned long)ndlc);
+       setup_timer(&ndlc->t2_timer, ndlc_t2_timeout, (unsigned long)ndlc);
 
        skb_queue_head_init(&ndlc->rcv_q);
        skb_queue_head_init(&ndlc->send_q);
index 56f2112e0cd840d789ec23b8db8ba1f2a52103ae..bd7c1e83169cac2ad98b938389a390d0b03a478a 100644 (file)
@@ -725,15 +725,12 @@ int st_nci_se_init(struct nci_dev *ndev, struct st_nci_se_status *se_status)
 
        init_completion(&info->se_info.req_completion);
        /* initialize timers */
-       init_timer(&info->se_info.bwi_timer);
-       info->se_info.bwi_timer.data = (unsigned long)info;
-       info->se_info.bwi_timer.function = st_nci_se_wt_timeout;
+       setup_timer(&info->se_info.bwi_timer, st_nci_se_wt_timeout,
+                   (unsigned long)info);
        info->se_info.bwi_active = false;
 
-       init_timer(&info->se_info.se_active_timer);
-       info->se_info.se_active_timer.data = (unsigned long)info;
-       info->se_info.se_active_timer.function =
-                       st_nci_se_activation_timeout;
+       setup_timer(&info->se_info.se_active_timer,
+                   st_nci_se_activation_timeout, (unsigned long)info);
        info->se_info.se_active = false;
 
        info->se_info.xch_error = false;
index 3a98563d4a121ddc99223ca367ee44a51f8fd92b..b2285455f77da23f893e0c0ba576148faac5f5cf 100644 (file)
@@ -392,14 +392,12 @@ void st21nfca_se_init(struct nfc_hci_dev *hdev)
 
        init_completion(&info->se_info.req_completion);
        /* initialize timers */
-       init_timer(&info->se_info.bwi_timer);
-       info->se_info.bwi_timer.data = (unsigned long)info;
-       info->se_info.bwi_timer.function = st21nfca_se_wt_timeout;
+       setup_timer(&info->se_info.bwi_timer, st21nfca_se_wt_timeout,
+                   (unsigned long)info);
        info->se_info.bwi_active = false;
 
-       init_timer(&info->se_info.se_active_timer);
-       info->se_info.se_active_timer.data = (unsigned long)info;
-       info->se_info.se_active_timer.function = st21nfca_se_activation_timeout;
+       setup_timer(&info->se_info.se_active_timer,
+                   st21nfca_se_activation_timeout, (unsigned long)info);
        info->se_info.se_active = false;
 
        info->se_info.count_pipes = 0;
index 29f35e29d4801f83aa74b0a590bdb4412a9caa7c..adba91318768e62317e95615f509b46da299df83 100644 (file)
@@ -119,9 +119,8 @@ struct dasd_device *dasd_alloc_device(void)
                     (void (*)(unsigned long)) dasd_device_tasklet,
                     (unsigned long) device);
        INIT_LIST_HEAD(&device->ccw_queue);
-       init_timer(&device->timer);
-       device->timer.function = dasd_device_timeout;
-       device->timer.data = (unsigned long) device;
+       setup_timer(&device->timer, dasd_device_timeout,
+                   (unsigned long)device);
        INIT_WORK(&device->kick_work, do_kick_device);
        INIT_WORK(&device->restore_device, do_restore_device);
        INIT_WORK(&device->reload_device, do_reload_device);
@@ -163,9 +162,7 @@ struct dasd_block *dasd_alloc_block(void)
                     (unsigned long) block);
        INIT_LIST_HEAD(&block->ccw_queue);
        spin_lock_init(&block->queue_lock);
-       init_timer(&block->timer);
-       block->timer.function = dasd_block_timeout;
-       block->timer.data = (unsigned long) block;
+       setup_timer(&block->timer, dasd_block_timeout, (unsigned long)block);
        spin_lock_init(&block->profile.lock);
 
        return block;
index 8c14c6c3ad3d65fa5f0524d49720c1d3321246f3..16b81be1f07a58c96779d74d66595ee625757944 100644 (file)
@@ -142,13 +142,11 @@ void
 fsm_settimer(fsm_instance *fi, fsm_timer *this)
 {
        this->fi = fi;
-       this->tl.function = (void *)fsm_expire_timer;
-       this->tl.data = (long)this;
 #if FSM_TIMER_DEBUG
        printk(KERN_DEBUG "fsm(%s): Create timer %p\n", fi->name,
               this);
 #endif
-       init_timer(&this->tl);
+       setup_timer(&this->tl, (void *)fsm_expire_timer, (long)this);
 }
 
 void
index af032c46ec0e1950deecbc69a33c24035bb4ecae..a54b6c11b505a8ab51d0b455e0ec7b333b1298ca 100644 (file)
@@ -837,10 +837,9 @@ static int arcmsr_probe(struct pci_dev *pdev, const struct pci_device_id *id)
        atomic_set(&acb->rq_map_token, 16);
        atomic_set(&acb->ante_token_value, 16);
        acb->fw_flag = FW_NORMAL;
-       init_timer(&acb->eternal_timer);
+       setup_timer(&acb->eternal_timer, &arcmsr_request_device_map,
+                   (unsigned long)acb);
        acb->eternal_timer.expires = jiffies + msecs_to_jiffies(6 * HZ);
-       acb->eternal_timer.data = (unsigned long) acb;
-       acb->eternal_timer.function = &arcmsr_request_device_map;
        add_timer(&acb->eternal_timer);
        if(arcmsr_alloc_sysfs_attr(acb))
                goto out_free_sysfs;
@@ -930,10 +929,9 @@ static int arcmsr_resume(struct pci_dev *pdev)
        atomic_set(&acb->rq_map_token, 16);
        atomic_set(&acb->ante_token_value, 16);
        acb->fw_flag = FW_NORMAL;
-       init_timer(&acb->eternal_timer);
+       setup_timer(&acb->eternal_timer, &arcmsr_request_device_map,
+                   (unsigned long)acb);
        acb->eternal_timer.expires = jiffies + msecs_to_jiffies(6 * HZ);
-       acb->eternal_timer.data = (unsigned long) acb;
-       acb->eternal_timer.function = &arcmsr_request_device_map;
        add_timer(&acb->eternal_timer);
        return 0;
 controller_stop:
index 24388795ee9a30ea933a3c11b60009fcff7b656f..7304d5a4fc4f411b1ca79048f5b5386ed63e5322 100644 (file)
@@ -2849,9 +2849,7 @@ int fas216_init(struct Scsi_Host *host)
        info->rst_dev_status = -1;
        info->rst_bus_status = -1;
        init_waitqueue_head(&info->eh_wait);
-       init_timer(&info->eh_timer);
-       info->eh_timer.data  = (unsigned long)info;
-       info->eh_timer.function = fas216_eh_timer;
+       setup_timer(&info->eh_timer, fas216_eh_timer, (unsigned long)info);
        
        spin_lock_init(&info->host_lock);
 
index 5caf5f3ff642282ee13776e9df9ca9a18f494536..d10826a6972502920a8ba8aa24633626a066c39d 100644 (file)
@@ -719,9 +719,7 @@ bfad_bfa_tmo(unsigned long data)
 void
 bfad_init_timer(struct bfad_s *bfad)
 {
-       init_timer(&bfad->hal_tmo);
-       bfad->hal_tmo.function = bfad_bfa_tmo;
-       bfad->hal_tmo.data = (unsigned long)bfad;
+       setup_timer(&bfad->hal_tmo, bfad_bfa_tmo, (unsigned long)bfad);
 
        mod_timer(&bfad->hal_tmo,
                  jiffies + msecs_to_jiffies(BFA_TIMER_FREQ));
index 81f226be3e3b72067b87fe6d2553f91e7783b62f..af4af504a97f1fb1ad70ae3ef090b13f7a828826 100644 (file)
@@ -1635,10 +1635,8 @@ static void esas2r_timer_callback(unsigned long context);
 
 void esas2r_kickoff_timer(struct esas2r_adapter *a)
 {
-       init_timer(&a->timer);
+       setup_timer(&a->timer, esas2r_timer_callback, (unsigned long)a);
 
-       a->timer.function = esas2r_timer_callback;
-       a->timer.data = (unsigned long)a;
        a->timer.expires = jiffies +
                           msecs_to_jiffies(100);
 
index 5b93ed810f6ef099e265a5e45305ef26224ee4bd..017216f5e919e1d088e41fb29b692ee3e6681e0e 100644 (file)
@@ -8357,9 +8357,7 @@ struct Scsi_Host * __init ncr_attach(struct scsi_host_template *tpnt,
        if (!np->scripth0)
                goto attach_error;
 
-       init_timer(&np->timer);
-       np->timer.data     = (unsigned long) np;
-       np->timer.function = ncr53c8xx_timeout;
+       setup_timer(&np->timer, ncr53c8xx_timeout, (unsigned long)np);
 
        /* Try to map the controller chip to virtual and physical memory. */
 
index d32e3ba8863e86ef9e6ca55c5311697683050c16..285397d425582cf5a0926bc3bed374d838ef4d63 100644 (file)
@@ -1351,9 +1351,7 @@ static struct Scsi_Host *sym_attach(struct scsi_host_template *tpnt, int unit,
        /*
         *  Start the timer daemon
         */
-       init_timer(&np->s.timer);
-       np->s.timer.data     = (unsigned long) np;
-       np->s.timer.function = sym53c8xx_timer;
+       setup_timer(&np->s.timer, sym53c8xx_timer, (unsigned long)np);
        np->s.lasttime=0;
        sym_timer (np);
 
index fc7f810baef79e8a107dd8105656b4283b22f0d0..fb8c4bff584cb6f27229f2b074108f7884c6416c 100644 (file)
@@ -2542,9 +2542,7 @@ omap_ep_setup(char *name, u8 addr, u8 type,
                }
                if (dbuf && addr)
                        epn_rxtx |= UDC_EPN_RX_DB;
-               init_timer(&ep->timer);
-               ep->timer.function = pio_out_timer;
-               ep->timer.data = (unsigned long) ep;
+               setup_timer(&ep->timer, pio_out_timer, (unsigned long)ep);
        }
        if (addr)
                epn_rxtx |= UDC_EPN_RX_VALID;
index 03918a19cf2da854bcefa9f8188daa53a7db82f4..5b51d5ba2a857791d55cda2670c27a90086c9b01 100644 (file)
@@ -290,8 +290,7 @@ static inline void clocksource_start_watchdog(void)
 {
        if (watchdog_running || !watchdog || list_empty(&watchdog_list))
                return;
-       init_timer(&watchdog_timer);
-       watchdog_timer.function = clocksource_watchdog;
+       setup_timer(&watchdog_timer, clocksource_watchdog, 0UL);
        watchdog_timer.expires = jiffies + WATCHDOG_INTERVAL;
        add_timer_on(&watchdog_timer, cpumask_first(cpu_online_mask));
        watchdog_running = 1;