Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752088AbdHaXaq (ORCPT ); Thu, 31 Aug 2017 19:30:46 -0400 Received: from mail-pf0-f175.google.com ([209.85.192.175]:35032 "EHLO mail-pf0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751968AbdHaXaH (ORCPT ); Thu, 31 Aug 2017 19:30:07 -0400 X-Google-Smtp-Source: ADKCNb7riuxlsI6h0WkQcugK/BcloZGmRlZfUWiAHc1QPiCHkKE13P98rFEbLtgfAMthfgalrMM4Pw== From: Kees Cook To: Thomas Gleixner Cc: Kees Cook , linux-kernel@vger.kernel.org Subject: [PATCH 14/31] timer: Collapse cross-function single-assignment .data into setup_timer() Date: Thu, 31 Aug 2017 16:29:26 -0700 Message-Id: <1504222183-61202-15-git-send-email-keescook@chromium.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1504222183-61202-1-git-send-email-keescook@chromium.org> References: <1504222183-61202-1-git-send-email-keescook@chromium.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 42235 Lines: 1077 While the setup_timer.cocci script can safely find many init_timer() to setup_timer() conversions, it is forced to ignore any that touch the .data field in separate functions. In many cases, .data is only set once before starting the timer and never changed again. These can all be converted into the regular setup_timer() call, after manual inspection. Signed-off-by: Kees Cook --- drivers/block/swim3.c | 3 +-- drivers/char/hw_random/xgene-rng.c | 5 ++--- drivers/char/pcmcia/cm4040_cs.c | 7 +++---- drivers/i2c/busses/i2c-pnx.c | 1 - drivers/infiniband/hw/cxgb3/iwch_cm.c | 6 ++---- drivers/infiniband/hw/cxgb4/cm.c | 8 +++----- drivers/infiniband/hw/nes/nes_nic.c | 2 +- drivers/infiniband/hw/nes/nes_verbs.c | 1 - drivers/isdn/isdnloop/isdnloop.c | 12 ++++-------- drivers/md/dm-raid1.c | 4 +--- drivers/media/dvb-core/dmxdev.c | 5 ++--- drivers/net/ethernet/3com/3c574_cs.c | 4 +--- drivers/net/ethernet/apple/bmac.c | 4 +--- drivers/net/ethernet/apple/mace.c | 4 +--- drivers/net/ethernet/seeq/ether3.c | 4 +--- drivers/net/ethernet/sgi/ioc3-eth.c | 4 +--- drivers/net/ethernet/sun/sunbmac.c | 5 +---- drivers/net/ethernet/sun/sunhme.c | 6 ++---- drivers/net/hamradio/6pack.c | 8 +------- drivers/net/hamradio/scc.c | 8 ++------ drivers/net/usb/sierra_net.c | 4 +--- drivers/net/wireless/intel/iwlegacy/3945-rs.c | 6 ++---- drivers/net/wireless/ray_cs.c | 6 +----- drivers/net/xen-netback/interface.c | 3 ++- drivers/net/xen-netback/netback.c | 2 -- drivers/pci/hotplug/pciehp_hpc.c | 8 +++----- drivers/pci/hotplug/shpchp_hpc.c | 6 ++---- drivers/s390/cio/eadm_sch.c | 8 ++++---- drivers/scsi/aic94xx/aic94xx_hwi.c | 1 - drivers/scsi/aic94xx/aic94xx_hwi.h | 2 +- drivers/scsi/aic94xx/aic94xx_tmf.c | 1 - drivers/scsi/gdth.c | 4 +--- drivers/scsi/hisi_sas/hisi_sas_main.c | 2 +- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 1 - drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 2 +- drivers/scsi/libiscsi.c | 4 +--- drivers/scsi/smartpqi/smartpqi_init.c | 5 ++--- drivers/tty/serial/8250/8250_core.c | 5 +---- drivers/tty/serial/bfin_uart.c | 5 ++--- drivers/tty/serial/m32r_sio.c | 4 +--- net/irda/irttp.c | 6 +----- net/rose/rose_loopback.c | 7 ++----- 42 files changed, 59 insertions(+), 134 deletions(-) diff --git a/drivers/block/swim3.c b/drivers/block/swim3.c index 9f931f8f6b4c..45c5cc91b274 100644 --- a/drivers/block/swim3.c +++ b/drivers/block/swim3.c @@ -398,7 +398,6 @@ static void set_timeout(struct floppy_state *fs, int nticks, del_timer(&fs->timeout); fs->timeout.expires = jiffies + nticks; fs->timeout.function = proc; - fs->timeout.data = (unsigned long) fs; add_timer(&fs->timeout); fs->timeout_pending = 1; } @@ -1182,7 +1181,7 @@ static int swim3_add_device(struct macio_dev *mdev, int index) return -EBUSY; } - init_timer(&fs->timeout); + setup_timer(&fs->timeout, NULL, (unsigned long)fs); swim3_info("SWIM3 floppy controller %s\n", mdev->media_bay ? "in media bay" : ""); diff --git a/drivers/char/hw_random/xgene-rng.c b/drivers/char/hw_random/xgene-rng.c index 3c77645405e5..3f0746be2237 100644 --- a/drivers/char/hw_random/xgene-rng.c +++ b/drivers/char/hw_random/xgene-rng.c @@ -113,8 +113,6 @@ static void xgene_rng_expired_timer(unsigned long arg) static void xgene_rng_start_timer(struct xgene_rng_dev *ctx) { - ctx->failure_timer.data = (unsigned long) ctx; - ctx->failure_timer.function = xgene_rng_expired_timer; ctx->failure_timer.expires = jiffies + 120 * HZ; add_timer(&ctx->failure_timer); } @@ -292,7 +290,8 @@ static int xgene_rng_init(struct hwrng *rng) struct xgene_rng_dev *ctx = (struct xgene_rng_dev *) rng->priv; ctx->failure_cnt = 0; - init_timer(&ctx->failure_timer); + setup_timer(&ctx->failure_timer, xgene_rng_expired_timer, + (unsigned long)ctx); ctx->revision = readl(ctx->csr_base + RNG_EIP_REV); diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c index 382c864814d9..9f671e1617dd 100644 --- a/drivers/char/pcmcia/cm4040_cs.c +++ b/drivers/char/pcmcia/cm4040_cs.c @@ -104,9 +104,9 @@ static inline unsigned char xinb(unsigned short port) /* poll the device fifo status register. not to be confused with * the poll syscall. */ -static void cm4040_do_poll(unsigned long dummy) +static void cm4040_do_poll(unsigned long data) { - struct reader_dev *dev = (struct reader_dev *) dummy; + struct reader_dev *dev = (struct reader_dev *)data; unsigned int obs = xinb(dev->p_dev->resource[0]->start + REG_OFFSET_BUFFER_STATUS); @@ -465,7 +465,6 @@ static int cm4040_open(struct inode *inode, struct file *filp) link->open = 1; - dev->poll_timer.data = (unsigned long) dev; mod_timer(&dev->poll_timer, jiffies + POLL_PERIOD); DEBUGP(2, dev, "<- cm4040_open (successfully)\n"); @@ -585,7 +584,7 @@ static int reader_probe(struct pcmcia_device *link) init_waitqueue_head(&dev->poll_wait); init_waitqueue_head(&dev->read_wait); init_waitqueue_head(&dev->write_wait); - setup_timer(&dev->poll_timer, cm4040_do_poll, 0); + setup_timer(&dev->poll_timer, cm4040_do_poll, (unsigned long)dev); ret = reader_config(link, i); if (ret) { diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c index fd5f9d2bf6d9..0e44250f36ac 100644 --- a/drivers/i2c/busses/i2c-pnx.c +++ b/drivers/i2c/busses/i2c-pnx.c @@ -112,7 +112,6 @@ static inline void i2c_pnx_arm_timer(struct i2c_pnx_algo_data *alg_data) jiffies, expires); timer->expires = jiffies + expires; - timer->data = (unsigned long)alg_data; add_timer(timer); } diff --git a/drivers/infiniband/hw/cxgb3/iwch_cm.c b/drivers/infiniband/hw/cxgb3/iwch_cm.c index 86975370a4c0..e9a1d1ee36fc 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_cm.c +++ b/drivers/infiniband/hw/cxgb3/iwch_cm.c @@ -119,8 +119,6 @@ static void start_ep_timer(struct iwch_ep *ep) } else get_ep(&ep->com); ep->timer.expires = jiffies + ep_timeout_secs * HZ; - ep->timer.data = (unsigned long)ep; - ep->timer.function = ep_timeout; add_timer(&ep->timer); } @@ -1399,7 +1397,7 @@ static int pass_accept_req(struct t3cdev *tdev, struct sk_buff *skb, void *ctx) child_ep->l2t = l2t; child_ep->dst = dst; child_ep->hwtid = hwtid; - init_timer(&child_ep->timer); + setup_timer(&child_ep->timer, ep_timeout, (unsigned long)child_ep); cxgb3_insert_tid(tdev, &t3c_client, child_ep, hwtid); accept_cr(child_ep, req->peer_ip, skb); goto out; @@ -1899,7 +1897,7 @@ int iwch_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) err = -ENOMEM; goto out; } - init_timer(&ep->timer); + setup_timer(&ep->timer, ep_timeout, (unsigned long)ep); ep->plen = conn_param->private_data_len; if (ep->plen) memcpy(ep->mpa_pkt + sizeof(struct mpa_message), diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c index e49b34c3b136..2a36bdc8bb6f 100644 --- a/drivers/infiniband/hw/cxgb4/cm.c +++ b/drivers/infiniband/hw/cxgb4/cm.c @@ -189,8 +189,6 @@ static void start_ep_timer(struct c4iw_ep *ep) clear_bit(TIMEOUT, &ep->com.flags); c4iw_get_ep(&ep->com); ep->timer.expires = jiffies + ep_timeout_secs * HZ; - ep->timer.data = (unsigned long)ep; - ep->timer.function = ep_timeout; add_timer(&ep->timer); } @@ -2101,7 +2099,7 @@ static int c4iw_reconnect(struct c4iw_ep *ep) __u8 *ra; pr_debug("%s qp %p cm_id %p\n", __func__, ep->com.qp, ep->com.cm_id); - init_timer(&ep->timer); + setup_timer(&ep->timer, ep_timeout, (unsigned long)ep); c4iw_init_wr_wait(&ep->com.wr_wait); /* When MPA revision is different on nodes, the node with MPA_rev=2 @@ -2574,7 +2572,7 @@ static int pass_accept_req(struct c4iw_dev *dev, struct sk_buff *skb) pr_debug("%s tx_chan %u smac_idx %u rss_qid %u\n", __func__, child_ep->tx_chan, child_ep->smac_idx, child_ep->rss_qid); - init_timer(&child_ep->timer); + setup_timer(&child_ep->timer, ep_timeout, (unsigned long)child_ep); cxgb4_insert_tid(t, child_ep, hwtid, child_ep->com.local_addr.ss_family); insert_ep_tid(child_ep); @@ -3200,7 +3198,7 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) goto fail1; } - init_timer(&ep->timer); + setup_timer(&ep->timer, ep_timeout, (unsigned long)ep); ep->plen = conn_param->private_data_len; if (ep->plen) memcpy(ep->mpa_pkt + sizeof(struct mpa_message), diff --git a/drivers/infiniband/hw/nes/nes_nic.c b/drivers/infiniband/hw/nes/nes_nic.c index e4fb0ad4140c..13b6155418e9 100644 --- a/drivers/infiniband/hw/nes/nes_nic.c +++ b/drivers/infiniband/hw/nes/nes_nic.c @@ -1746,7 +1746,7 @@ struct net_device *nes_netdev_init(struct nes_device *nesdev, nesvnic->rdma_enabled = 0; } nesvnic->nic_cq.cq_number = nesvnic->nic.qp_id; - setup_timer(&nesvnic->event_timer, NULL, 0UL); + setup_timer(&nesvnic->event_timer, NULL, (unsigned long)nesvnic); spin_lock_init(&nesvnic->tx_lock); spin_lock_init(&nesvnic->port_ibevent_lock); nesdev->netdev[nesdev->netdev_count] = netdev; diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c index 25dcd7573df9..4a6d5cacb36e 100644 --- a/drivers/infiniband/hw/nes/nes_verbs.c +++ b/drivers/infiniband/hw/nes/nes_verbs.c @@ -3827,7 +3827,6 @@ void nes_port_ibevent(struct nes_vnic *nesvnic) ib_dispatch_event(&event); nesvnic->last_dispatched_event = event.event; nesvnic->event_timer.function = nes_handle_delayed_event; - nesvnic->event_timer.data = (unsigned long) nesvnic; nesvnic->event_timer.expires = jiffies + NES_EVENT_DELAY; add_timer(&nesvnic->event_timer); } else { diff --git a/drivers/isdn/isdnloop/isdnloop.c b/drivers/isdn/isdnloop/isdnloop.c index c7381e67ae8c..9d5e523afc1e 100644 --- a/drivers/isdn/isdnloop/isdnloop.c +++ b/drivers/isdn/isdnloop/isdnloop.c @@ -373,8 +373,6 @@ isdnloop_polldchan(unsigned long data) card->flags |= ISDNLOOP_FLAGS_RBTIMER; spin_lock_irqsave(&card->isdnloop_lock, flags); del_timer(&card->rb_timer); - card->rb_timer.function = isdnloop_pollbchan; - card->rb_timer.data = (unsigned long) card; card->rb_timer.expires = jiffies + ISDNLOOP_TIMER_BCREAD; add_timer(&card->rb_timer); spin_unlock_irqrestore(&card->isdnloop_lock, flags); @@ -617,13 +615,10 @@ isdnloop_start_ctimer(isdnloop_card *card, int ch) unsigned long flags; spin_lock_irqsave(&card->isdnloop_lock, flags); - init_timer(&card->c_timer[ch]); + setup_timer(&card->c_timer[ch], + ch ? isdnloop_atimeout1 : isdnloop_atimeout0, + (unsigned long)card); card->c_timer[ch].expires = jiffies + ISDNLOOP_TIMER_ALERTWAIT; - if (ch) - card->c_timer[ch].function = isdnloop_atimeout1; - else - card->c_timer[ch].function = isdnloop_atimeout0; - card->c_timer[ch].data = (unsigned long) card; add_timer(&card->c_timer[ch]); spin_unlock_irqrestore(&card->isdnloop_lock, flags); } @@ -1464,6 +1459,7 @@ isdnloop_initcard(char *id) } skb_queue_head_init(&card->dqueue); spin_lock_init(&card->isdnloop_lock); + setup_timer(&card->rb_timer, isdnloop_pollbchan, (unsigned long) card); card->next = cards; cards = card; if (!register_isdn(&card->interface)) { diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c index a4fbd911d566..c934e8394b40 100644 --- a/drivers/md/dm-raid1.c +++ b/drivers/md/dm-raid1.c @@ -108,8 +108,6 @@ static void delayed_wake(struct mirror_set *ms) return; ms->timer.expires = jiffies + HZ / 5; - ms->timer.data = (unsigned long) ms; - ms->timer.function = delayed_wake_fn; add_timer(&ms->timer); } @@ -1133,7 +1131,7 @@ static int mirror_ctr(struct dm_target *ti, unsigned int argc, char **argv) goto err_free_context; } INIT_WORK(&ms->kmirrord_work, do_mirror); - init_timer(&ms->timer); + setup_timer(&ms->timer, delayed_wake_fn, (unsigned long)ms); ms->timer_pending = 0; INIT_WORK(&ms->trigger_event, trigger_event); diff --git a/drivers/media/dvb-core/dmxdev.c b/drivers/media/dvb-core/dmxdev.c index 45e91add73ba..289a814fe203 100644 --- a/drivers/media/dvb-core/dmxdev.c +++ b/drivers/media/dvb-core/dmxdev.c @@ -346,8 +346,6 @@ static void dvb_dmxdev_filter_timer(struct dmxdev_filter *dmxdevfilter) del_timer(&dmxdevfilter->timer); if (para->timeout) { - dmxdevfilter->timer.function = dvb_dmxdev_filter_timeout; - dmxdevfilter->timer.data = (unsigned long)dmxdevfilter; dmxdevfilter->timer.expires = jiffies + 1 + (HZ / 2 + HZ * para->timeout) / 1000; add_timer(&dmxdevfilter->timer); @@ -754,7 +752,8 @@ static int dvb_demux_open(struct inode *inode, struct file *file) dvb_ringbuffer_init(&dmxdevfilter->buffer, NULL, 8192); dmxdevfilter->type = DMXDEV_TYPE_NONE; dvb_dmxdev_filter_state_set(dmxdevfilter, DMXDEV_STATE_ALLOCATED); - init_timer(&dmxdevfilter->timer); + setup_timer(&dmxdevfilter->timer, dvb_dmxdev_filter_timeout, + (unsigned long)dmxdevfilter); dvbdev->users++; diff --git a/drivers/net/ethernet/3com/3c574_cs.c b/drivers/net/ethernet/3com/3c574_cs.c index 47c844cc9d27..7c99f77af4a5 100644 --- a/drivers/net/ethernet/3com/3c574_cs.c +++ b/drivers/net/ethernet/3com/3c574_cs.c @@ -377,7 +377,7 @@ static int tc574_config(struct pcmcia_device *link) lp->autoselect = config & Autoselect ? 1 : 0; } - init_timer(&lp->media); + setup_timer(&lp->media, media_check, (unsigned long)dev); { int phy; @@ -681,8 +681,6 @@ static int el3_open(struct net_device *dev) netif_start_queue(dev); tc574_reset(dev); - lp->media.function = media_check; - lp->media.data = (unsigned long) dev; lp->media.expires = jiffies + HZ; add_timer(&lp->media); diff --git a/drivers/net/ethernet/apple/bmac.c b/drivers/net/ethernet/apple/bmac.c index eac740c476ce..022b54c27835 100644 --- a/drivers/net/ethernet/apple/bmac.c +++ b/drivers/net/ethernet/apple/bmac.c @@ -555,8 +555,6 @@ static inline void bmac_set_timeout(struct net_device *dev) if (bp->timeout_active) del_timer(&bp->tx_timeout); bp->tx_timeout.expires = jiffies + TX_TIMEOUT; - bp->tx_timeout.function = bmac_tx_timeout; - bp->tx_timeout.data = (unsigned long) dev; add_timer(&bp->tx_timeout); bp->timeout_active = 1; spin_unlock_irqrestore(&bp->lock, flags); @@ -1321,7 +1319,7 @@ static int bmac_probe(struct macio_dev *mdev, const struct of_device_id *match) bp->queue = (struct sk_buff_head *)(bp->rx_cmds + N_RX_RING + 1); skb_queue_head_init(bp->queue); - init_timer(&bp->tx_timeout); + setup_timer(&bp->tx_timeout, bmac_tx_timeout, (unsigned long)dev); ret = request_irq(dev->irq, bmac_misc_intr, 0, "BMAC-misc", dev); if (ret) { diff --git a/drivers/net/ethernet/apple/mace.c b/drivers/net/ethernet/apple/mace.c index 96dd5300e0e5..e9baaaf2ed5e 100644 --- a/drivers/net/ethernet/apple/mace.c +++ b/drivers/net/ethernet/apple/mace.c @@ -196,7 +196,7 @@ static int mace_probe(struct macio_dev *mdev, const struct of_device_id *match) memset((char *) mp->tx_cmds, 0, (NCMDS_TX*N_TX_RING + N_RX_RING + 2) * sizeof(struct dbdma_cmd)); - init_timer(&mp->tx_timeout); + setup_timer(&mp->tx_timeout, mace_tx_timeout, (unsigned long)dev); spin_lock_init(&mp->lock); mp->timeout_active = 0; @@ -521,8 +521,6 @@ static inline void mace_set_timeout(struct net_device *dev) if (mp->timeout_active) del_timer(&mp->tx_timeout); mp->tx_timeout.expires = jiffies + TX_TIMEOUT; - mp->tx_timeout.function = mace_tx_timeout; - mp->tx_timeout.data = (unsigned long) dev; add_timer(&mp->tx_timeout); mp->timeout_active = 1; } diff --git a/drivers/net/ethernet/seeq/ether3.c b/drivers/net/ethernet/seeq/ether3.c index 244c1e171017..4f49b66727ee 100644 --- a/drivers/net/ethernet/seeq/ether3.c +++ b/drivers/net/ethernet/seeq/ether3.c @@ -183,8 +183,6 @@ static inline void ether3_ledon(struct net_device *dev) { del_timer(&priv(dev)->timer); priv(dev)->timer.expires = jiffies + HZ / 50; /* leave on for 1/50th second */ - priv(dev)->timer.data = (unsigned long)dev; - priv(dev)->timer.function = ether3_ledoff; add_timer(&priv(dev)->timer); if (priv(dev)->regs.config2 & CFG2_CTRLO) ether3_outw(priv(dev)->regs.config2 &= ~CFG2_CTRLO, REG_CONFIG2); @@ -783,7 +781,7 @@ ether3_probe(struct expansion_card *ec, const struct ecard_id *id) ether3_addr(dev->dev_addr, ec); - init_timer(&priv(dev)->timer); + setup_timer(&priv(dev)->timer, ether3_ledoff, (unsigned long)dev); /* Reset card... */ diff --git a/drivers/net/ethernet/sgi/ioc3-eth.c b/drivers/net/ethernet/sgi/ioc3-eth.c index 9c0488e0f08e..bdefc805ce5b 100644 --- a/drivers/net/ethernet/sgi/ioc3-eth.c +++ b/drivers/net/ethernet/sgi/ioc3-eth.c @@ -818,8 +818,6 @@ static int ioc3_mii_init(struct ioc3_private *ip) static void ioc3_mii_start(struct ioc3_private *ip) { ip->ioc3_timer.expires = jiffies + (12 * HZ)/10; /* 1.2 sec. */ - ip->ioc3_timer.data = (unsigned long) ip; - ip->ioc3_timer.function = ioc3_timer; add_timer(&ip->ioc3_timer); } @@ -1291,7 +1289,7 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *ent) #endif spin_lock_init(&ip->ioc3_lock); - init_timer(&ip->ioc3_timer); + setup_timer(&ip->ioc3_timer, ioc3_timer, (unsigned long)ip); ioc3_stop(ip); ioc3_init(dev); diff --git a/drivers/net/ethernet/sun/sunbmac.c b/drivers/net/ethernet/sun/sunbmac.c index 3189722110c2..2826a8195373 100644 --- a/drivers/net/ethernet/sun/sunbmac.c +++ b/drivers/net/ethernet/sun/sunbmac.c @@ -613,8 +613,6 @@ static void bigmac_begin_auto_negotiation(struct bigmac *bp) bp->timer_state = ltrywait; bp->timer_ticks = 0; bp->bigmac_timer.expires = jiffies + (12 * HZ) / 10; - bp->bigmac_timer.data = (unsigned long) bp; - bp->bigmac_timer.function = bigmac_timer; add_timer(&bp->bigmac_timer); } @@ -921,7 +919,6 @@ static int bigmac_open(struct net_device *dev) printk(KERN_ERR "BIGMAC: Can't order irq %d to go.\n", dev->irq); return ret; } - init_timer(&bp->bigmac_timer); ret = bigmac_init_hw(bp, 0); if (ret) free_irq(dev->irq, bp); @@ -1172,7 +1169,7 @@ static int bigmac_ether_init(struct platform_device *op, "board-version", 1); /* Init auto-negotiation timer state. */ - init_timer(&bp->bigmac_timer); + setup_timer(&bp->bigmac_timer, bigmac_timer, (unsigned long)bp); bp->timer_state = asleep; bp->timer_ticks = 0; diff --git a/drivers/net/ethernet/sun/sunhme.c b/drivers/net/ethernet/sun/sunhme.c index 9e983e1d8249..59f838603238 100644 --- a/drivers/net/ethernet/sun/sunhme.c +++ b/drivers/net/ethernet/sun/sunhme.c @@ -1413,8 +1413,6 @@ happy_meal_begin_auto_negotiation(struct happy_meal *hp, hp->timer_ticks = 0; hp->happy_timer.expires = jiffies + (12 * HZ)/10; /* 1.2 sec. */ - hp->happy_timer.data = (unsigned long) hp; - hp->happy_timer.function = happy_meal_timer; add_timer(&hp->happy_timer); } @@ -2819,7 +2817,7 @@ static int happy_meal_sbus_probe_one(struct platform_device *op, int is_qfe) hp->timer_state = asleep; hp->timer_ticks = 0; - init_timer(&hp->happy_timer); + setup_timer(&hp->happy_timer, happy_meal_timer, (unsigned long)hp); hp->dev = dev; dev->netdev_ops = &hme_netdev_ops; @@ -3133,7 +3131,7 @@ static int happy_meal_pci_probe(struct pci_dev *pdev, hp->timer_state = asleep; hp->timer_ticks = 0; - init_timer(&hp->happy_timer); + setup_timer(&hp->happy_timer, happy_meal_timer, (unsigned long)hp); hp->irq = pdev->irq; hp->dev = dev; diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c index 97fe8dfb602d..d7c615595092 100644 --- a/drivers/net/hamradio/6pack.c +++ b/drivers/net/hamradio/6pack.c @@ -526,8 +526,6 @@ static void resync_tnc(unsigned long channel) /* Start resync timer again -- the TNC might be still absent */ del_timer(&sp->resync_t); - sp->resync_t.data = (unsigned long) sp; - sp->resync_t.function = resync_tnc; sp->resync_t.expires = jiffies + SIXP_RESYNC_TIMEOUT; add_timer(&sp->resync_t); } @@ -541,8 +539,6 @@ static inline int tnc_init(struct sixpack *sp) sp->tty->ops->write(sp->tty, &inbyte, 1); del_timer(&sp->resync_t); - sp->resync_t.data = (unsigned long) sp; - sp->resync_t.function = resync_tnc; sp->resync_t.expires = jiffies + SIXP_RESYNC_TIMEOUT; add_timer(&sp->resync_t); @@ -625,7 +621,7 @@ static int sixpack_open(struct tty_struct *tty) setup_timer(&sp->tx_t, sp_xmit_on_air, (unsigned long)sp); - init_timer(&sp->resync_t); + setup_timer(&sp->resync_t, resync_tnc, (unsigned long)sp); spin_unlock_bh(&sp->lock); @@ -926,8 +922,6 @@ static void decode_prio_command(struct sixpack *sp, unsigned char cmd) if (sp->tnc_state == TNC_IN_SYNC) { del_timer(&sp->resync_t); - sp->resync_t.data = (unsigned long) sp; - sp->resync_t.function = resync_tnc; sp->resync_t.expires = jiffies + SIXP_INIT_RESYNC_TIMEOUT; add_timer(&sp->resync_t); } diff --git a/drivers/net/hamradio/scc.c b/drivers/net/hamradio/scc.c index 295f267b73ea..c7ce37260348 100644 --- a/drivers/net/hamradio/scc.c +++ b/drivers/net/hamradio/scc.c @@ -1002,7 +1002,6 @@ static void __scc_start_tx_timer(struct scc_channel *scc, void (*handler)(unsign } else if (when != TIMER_OFF) { - scc->tx_t.data = (unsigned long) scc; scc->tx_t.function = handler; scc->tx_t.expires = jiffies + (when*HZ)/100; add_timer(&scc->tx_t); @@ -1027,7 +1026,6 @@ static void scc_start_defer(struct scc_channel *scc) if (scc->kiss.maxdefer != 0 && scc->kiss.maxdefer != TIMER_OFF) { - scc->tx_wdog.data = (unsigned long) scc; scc->tx_wdog.function = t_busy; scc->tx_wdog.expires = jiffies + HZ*scc->kiss.maxdefer; add_timer(&scc->tx_wdog); @@ -1044,7 +1042,6 @@ static void scc_start_maxkeyup(struct scc_channel *scc) if (scc->kiss.maxkeyup != 0 && scc->kiss.maxkeyup != TIMER_OFF) { - scc->tx_wdog.data = (unsigned long) scc; scc->tx_wdog.function = t_maxkeyup; scc->tx_wdog.expires = jiffies + HZ*scc->kiss.maxkeyup; add_timer(&scc->tx_wdog); @@ -1426,7 +1423,6 @@ scc_start_calibrate(struct scc_channel *scc, int duration, unsigned char pattern del_timer(&scc->tx_wdog); - scc->tx_wdog.data = (unsigned long) scc; scc->tx_wdog.function = scc_stop_calibrate; scc->tx_wdog.expires = jiffies + HZ*duration; add_timer(&scc->tx_wdog); @@ -1522,8 +1518,8 @@ static int scc_net_alloc(const char *name, struct scc_channel *scc) dev->ml_priv = scc; scc->dev = dev; spin_lock_init(&scc->lock); - init_timer(&scc->tx_t); - init_timer(&scc->tx_wdog); + setup_timer(&scc->tx_t, NULL, (unsigned long)scc); + setup_timer(&scc->tx_wdog, NULL, (unsigned long)scc); err = register_netdevice(dev); if (err) { diff --git a/drivers/net/usb/sierra_net.c b/drivers/net/usb/sierra_net.c index 2110ab3513f0..fc81d63f7e10 100644 --- a/drivers/net/usb/sierra_net.c +++ b/drivers/net/usb/sierra_net.c @@ -475,8 +475,6 @@ static void sierra_net_dosync(struct usbnet *dev) "Send SYNC failed, status %d\n", status); /* Now, start a timer and make sure we get the Restart Indication */ - priv->sync_timer.function = sierra_sync_timer; - priv->sync_timer.data = (unsigned long) dev; priv->sync_timer.expires = jiffies + SIERRA_NET_SYNCDELAY; add_timer(&priv->sync_timer); } @@ -752,7 +750,7 @@ static int sierra_net_bind(struct usbnet *dev, struct usb_interface *intf) INIT_WORK(&priv->sierra_net_kevent, sierra_net_kevent); /* Only need to do this once */ - init_timer(&priv->sync_timer); + setup_timer(&priv->sync_timer, sierra_sync_timer, (unsigned long)dev); /* verify fw attributes */ status = sierra_net_get_fw_attr(dev, &fwattr); diff --git a/drivers/net/wireless/intel/iwlegacy/3945-rs.c b/drivers/net/wireless/intel/iwlegacy/3945-rs.c index b2f35dfbc01b..ac9444831f3c 100644 --- a/drivers/net/wireless/intel/iwlegacy/3945-rs.c +++ b/drivers/net/wireless/intel/iwlegacy/3945-rs.c @@ -360,9 +360,6 @@ il3945_rs_rate_init(struct il_priv *il, struct ieee80211_sta *sta, u8 sta_id) rs_sta->flush_time = RATE_FLUSH; rs_sta->last_tx_packets = 0; - rs_sta->rate_scale_flush.data = (unsigned long)rs_sta; - rs_sta->rate_scale_flush.function = il3945_bg_rate_scale_flush; - for (i = 0; i < RATE_COUNT_3945; i++) il3945_clear_win(&rs_sta->win[i]); @@ -415,7 +412,8 @@ il3945_rs_alloc_sta(void *il_priv, struct ieee80211_sta *sta, gfp_t gfp) rs_sta = &psta->rs_sta; spin_lock_init(&rs_sta->lock); - init_timer(&rs_sta->rate_scale_flush); + setup_timer(&rs_sta->rate_scale_flush, il3945_bg_rate_scale_flush, + (unsigned long)rs_sta); D_RATE("leave\n"); diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c index 170cd504e8ff..38069f0f26f5 100644 --- a/drivers/net/wireless/ray_cs.c +++ b/drivers/net/wireless/ray_cs.c @@ -323,7 +323,7 @@ static int ray_probe(struct pcmcia_device *p_dev) dev_dbg(&p_dev->dev, "ray_cs ray_attach calling ether_setup.)\n"); netif_stop_queue(dev); - init_timer(&local->timer); + setup_timer(&local->timer, NULL, (unsigned long)local); this_device = p_dev; return ray_config(p_dev); @@ -570,7 +570,6 @@ static int dl_startup_params(struct net_device *dev) local->card_status = CARD_DL_PARAM; /* Start kernel timer to wait for dl startup to complete. */ local->timer.expires = jiffies + HZ / 2; - local->timer.data = (long)local; local->timer.function = verify_dl_startup; add_timer(&local->timer); dev_dbg(&link->dev, @@ -1945,7 +1944,6 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id) del_timer(&local->timer); local->timer.expires = jiffies + HZ * 5; - local->timer.data = (long)local; if (status == CCS_START_NETWORK) { dev_dbg(&link->dev, "ray_cs interrupt network \"%s\" start failed\n", @@ -2425,7 +2423,6 @@ static void authenticate(ray_dev_t *local) local->timer.function = authenticate_timeout; } local->timer.expires = jiffies + HZ * 2; - local->timer.data = (long)local; add_timer(&local->timer); local->authentication_state = AWAITING_RESPONSE; } /* end authenticate */ @@ -2506,7 +2503,6 @@ static void associate(ray_dev_t *local) del_timer(&local->timer); local->timer.expires = jiffies + HZ * 2; - local->timer.data = (long)local; local->timer.function = join_net; add_timer(&local->timer); local->card_status = CARD_ASSOC_FAILED; diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c index 4a133027dd14..4ccc0b1b1e16 100644 --- a/drivers/net/xen-netback/interface.c +++ b/drivers/net/xen-netback/interface.c @@ -520,7 +520,8 @@ int xenvif_init_queue(struct xenvif_queue *queue) queue->credit_bytes = queue->remaining_credit = ~0UL; queue->credit_usec = 0UL; - setup_timer(&queue->credit_timeout, xenvif_tx_credit_callback, 0UL); + setup_timer(&queue->credit_timeout, xenvif_tx_credit_callback, + (unsigned long)queue); queue->credit_window_start = get_jiffies_64(); queue->rx_queue_max = XENVIF_RX_QUEUE_BYTES; diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c index 5042ff8d449a..711334b29d89 100644 --- a/drivers/net/xen-netback/netback.c +++ b/drivers/net/xen-netback/netback.c @@ -700,8 +700,6 @@ static bool tx_credit_exceeded(struct xenvif_queue *queue, unsigned size) /* Still too big to send right now? Set a callback. */ if (size > queue->remaining_credit) { - queue->credit_timeout.data = - (unsigned long)queue; mod_timer(&queue->credit_timeout, next_credit); queue->credit_window_start = next_credit; diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index 026830a138ae..4259144650a1 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c @@ -57,7 +57,6 @@ static void int_poll_timeout(unsigned long data) /* Poll for interrupt events. regs == NULL => polling */ pcie_isr(0, ctrl); - init_timer(&ctrl->poll_timer); if (!pciehp_poll_time) pciehp_poll_time = 2; /* default polling interval is 2 sec */ @@ -71,8 +70,6 @@ static void start_int_poll_timer(struct controller *ctrl, int sec) if ((sec <= 0) || (sec > 60)) sec = 2; - ctrl->poll_timer.function = &int_poll_timeout; - ctrl->poll_timer.data = (unsigned long)ctrl; ctrl->poll_timer.expires = jiffies + sec * HZ; add_timer(&ctrl->poll_timer); } @@ -83,7 +80,8 @@ static inline int pciehp_request_irq(struct controller *ctrl) /* Install interrupt polling timer. Start with 10 sec delay */ if (pciehp_poll_mode) { - init_timer(&ctrl->poll_timer); + setup_timer(&ctrl->poll_timer, int_poll_timeout, + (unsigned long)ctrl); start_int_poll_timer(ctrl, 10); return 0; } @@ -756,7 +754,7 @@ int pciehp_reset_slot(struct slot *slot, int probe) ctrl_dbg(ctrl, "%s: SLOTCTRL %x write cmd %x\n", __func__, pci_pcie_cap(ctrl->pcie->port) + PCI_EXP_SLTCTL, ctrl_mask); if (pciehp_poll_mode) - int_poll_timeout(ctrl->poll_timer.data); + int_poll_timeout((unsigned long)&ctrl); return 0; } diff --git a/drivers/pci/hotplug/shpchp_hpc.c b/drivers/pci/hotplug/shpchp_hpc.c index de0ea474fb73..3b831bc60c85 100644 --- a/drivers/pci/hotplug/shpchp_hpc.c +++ b/drivers/pci/hotplug/shpchp_hpc.c @@ -236,7 +236,6 @@ static void int_poll_timeout(unsigned long data) /* Poll for interrupt events. regs == NULL => polling */ shpc_isr(0, ctrl); - init_timer(&ctrl->poll_timer); if (!shpchp_poll_time) shpchp_poll_time = 2; /* default polling interval is 2 sec */ @@ -252,8 +251,6 @@ static void start_int_poll_timer(struct controller *ctrl, int sec) if ((sec <= 0) || (sec > 60)) sec = 2; - ctrl->poll_timer.function = &int_poll_timeout; - ctrl->poll_timer.data = (unsigned long)ctrl; ctrl->poll_timer.expires = jiffies + sec * HZ; add_timer(&ctrl->poll_timer); } @@ -1054,7 +1051,8 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev) if (shpchp_poll_mode) { /* Install interrupt polling timer. Start with 10 sec delay */ - init_timer(&ctrl->poll_timer); + setup_timer(&ctrl->poll_timer, int_poll_timeout, + (unsigned long)ctrl); start_int_poll_timer(ctrl, 10); } else { /* Installs the interrupt handler */ diff --git a/drivers/s390/cio/eadm_sch.c b/drivers/s390/cio/eadm_sch.c index 0f11f3bcac82..835a69453a50 100644 --- a/drivers/s390/cio/eadm_sch.c +++ b/drivers/s390/cio/eadm_sch.c @@ -102,7 +102,8 @@ static int eadm_subchannel_clear(struct subchannel *sch) static void eadm_subchannel_timeout(unsigned long data) { - struct subchannel *sch = (struct subchannel *) data; + struct eadm_private *private = (struct eadm_private *)data; + struct subchannel *sch = private->sch; spin_lock_irq(sch->lock); EADM_LOG(1, "timeout"); @@ -124,8 +125,6 @@ static void eadm_subchannel_set_timeout(struct subchannel *sch, int expires) if (mod_timer(&private->timer, jiffies + expires)) return; } - private->timer.function = eadm_subchannel_timeout; - private->timer.data = (unsigned long) sch; private->timer.expires = jiffies + expires; add_timer(&private->timer); } @@ -230,7 +229,8 @@ static int eadm_subchannel_probe(struct subchannel *sch) return -ENOMEM; INIT_LIST_HEAD(&private->head); - init_timer(&private->timer); + setup_timer(&private->timer, eadm_subchannel_timeout, + (unsigned long)private); spin_lock_irq(sch->lock); set_eadm_private(sch, private); diff --git a/drivers/scsi/aic94xx/aic94xx_hwi.c b/drivers/scsi/aic94xx/aic94xx_hwi.c index f2671a8fa7e3..ad4d266bd465 100644 --- a/drivers/scsi/aic94xx/aic94xx_hwi.c +++ b/drivers/scsi/aic94xx/aic94xx_hwi.c @@ -1178,7 +1178,6 @@ static void asd_start_scb_timers(struct list_head *list) struct asd_ascb *ascb; list_for_each_entry(ascb, list, list) { if (!ascb->uldd_timer) { - ascb->timer.data = (unsigned long) ascb; ascb->timer.function = asd_ascb_timedout; ascb->timer.expires = jiffies + AIC94XX_SCB_TIMEOUT; add_timer(&ascb->timer); diff --git a/drivers/scsi/aic94xx/aic94xx_hwi.h b/drivers/scsi/aic94xx/aic94xx_hwi.h index c62db2c7735b..0cb942f56613 100644 --- a/drivers/scsi/aic94xx/aic94xx_hwi.h +++ b/drivers/scsi/aic94xx/aic94xx_hwi.h @@ -291,7 +291,7 @@ static inline void asd_init_ascb(struct asd_ha_struct *asd_ha, INIT_LIST_HEAD(&ascb->list); ascb->scb = ascb->dma_scb.vaddr; ascb->ha = asd_ha; - setup_timer(&ascb->timer, NULL, 0UL); + setup_timer(&ascb->timer, NULL, (unsigned long)ascb); ascb->tc_index = -1; } diff --git a/drivers/scsi/aic94xx/aic94xx_tmf.c b/drivers/scsi/aic94xx/aic94xx_tmf.c index d4c35df3d4ae..c56e233d5653 100644 --- a/drivers/scsi/aic94xx/aic94xx_tmf.c +++ b/drivers/scsi/aic94xx/aic94xx_tmf.c @@ -42,7 +42,6 @@ static int asd_enqueue_internal(struct asd_ascb *ascb, ascb->tasklet_complete = tasklet_complete; ascb->uldd_timer = 1; - ascb->timer.data = (unsigned long) ascb; ascb->timer.function = timed_out; ascb->timer.expires = jiffies + AIC94XX_SCB_TIMEOUT; diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c index facc7271f932..a0a48149d618 100644 --- a/drivers/scsi/gdth.c +++ b/drivers/scsi/gdth.c @@ -3743,8 +3743,6 @@ static void gdth_timer_init(void) gdth_timer_running = 1; TRACE2(("gdth_detect(): Initializing timer !\n")); gdth_timer.expires = jiffies + HZ; - gdth_timer.data = 0L; - gdth_timer.function = gdth_timeout; add_timer(&gdth_timer); } #else @@ -5165,7 +5163,7 @@ static int __init gdth_init(void) /* initializations */ gdth_polling = TRUE; gdth_clear_events(); - init_timer(&gdth_timer); + setup_timer(&gdth_timer, gdth_timeout, 0); /* As default we do not probe for EISA or ISA controllers */ if (probe_eisa_isa) { diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index 4022c3f8295f..e5696eb6b9d9 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -1802,7 +1802,7 @@ static struct Scsi_Host *hisi_sas_shost_alloc(struct platform_device *pdev, hisi_hba->shost = shost; SHOST_TO_SAS_HA(shost) = &hisi_hba->sha; - init_timer(&hisi_hba->timer); + setup_timer(&hisi_hba->timer, NULL, (unsigned long)&hisi_hba); if (hisi_sas_get_fw_info(hisi_hba) < 0) goto err_out; diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c index 2bfea7082e3a..113fc5ef996c 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c @@ -1160,7 +1160,6 @@ static void link_timeout_disable_link(unsigned long data) static void set_link_timer_quirk(struct hisi_hba *hisi_hba) { - hisi_hba->timer.data = (unsigned long)hisi_hba; hisi_hba->timer.function = link_timeout_disable_link; hisi_hba->timer.expires = jiffies + msecs_to_jiffies(1000); add_timer(&hisi_hba->timer); diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index 83d2dca1c650..0ae80dca51cf 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -1661,7 +1661,7 @@ hisi_sas_shost_alloc_pci(struct pci_dev *pdev) hisi_hba->shost = shost; SHOST_TO_SAS_HA(shost) = &hisi_hba->sha; - init_timer(&hisi_hba->timer); + setup_timer(&hisi_hba->timer, NULL, (unsigned long)&hisi_hba); if (hisi_sas_get_fw_info(hisi_hba) < 0) goto err_out; diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index ec57e2d614d8..7ea1e48a5ac7 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -1838,8 +1838,6 @@ static int iscsi_exec_task_mgmt_fn(struct iscsi_conn *conn, } conn->tmfcmd_pdus_cnt++; conn->tmf_timer.expires = timeout * HZ + jiffies; - conn->tmf_timer.function = iscsi_tmf_timedout; - conn->tmf_timer.data = (unsigned long)conn; add_timer(&conn->tmf_timer); ISCSI_DBG_EH(session, "tmf set timeout\n"); @@ -2938,7 +2936,7 @@ iscsi_conn_setup(struct iscsi_cls_session *cls_session, int dd_size, goto login_task_data_alloc_fail; conn->login_task->data = conn->data = data; - init_timer(&conn->tmf_timer); + setup_timer(&conn->tmf_timer, iscsi_tmf_timedout, (unsigned long)conn); init_waitqueue_head(&conn->ehwait); return cls_conn; diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c index cb8f886e705c..5b475616580a 100644 --- a/drivers/scsi/smartpqi/smartpqi_init.c +++ b/drivers/scsi/smartpqi/smartpqi_init.c @@ -2901,8 +2901,6 @@ static void pqi_start_heartbeat_timer(struct pqi_ctrl_info *ctrl_info) ctrl_info->heartbeat_timer.expires = jiffies + PQI_HEARTBEAT_TIMER_INTERVAL; - ctrl_info->heartbeat_timer.data = (unsigned long)ctrl_info; - ctrl_info->heartbeat_timer.function = pqi_heartbeat_timer_handler; add_timer(&ctrl_info->heartbeat_timer); } @@ -6425,7 +6423,8 @@ static struct pqi_ctrl_info *pqi_alloc_ctrl_info(int numa_node) INIT_DELAYED_WORK(&ctrl_info->rescan_work, pqi_rescan_worker); INIT_DELAYED_WORK(&ctrl_info->update_time_work, pqi_update_time_worker); - init_timer(&ctrl_info->heartbeat_timer); + setup_timer(&ctrl_info->heartbeat_timer, pqi_heartbeat_timer_handler, + (unsigned long)ctrl_info); INIT_WORK(&ctrl_info->ctrl_offline_work, pqi_ctrl_offline_worker); sema_init(&ctrl_info->sync_request_sem, diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c index b5def356af63..248b0d52f506 100644 --- a/drivers/tty/serial/8250/8250_core.c +++ b/drivers/tty/serial/8250/8250_core.c @@ -330,7 +330,6 @@ static int univ8250_setup_irq(struct uart_8250_port *up) pr_debug("ttyS%d - using backup timer\n", serial_index(port)); up->timer.function = serial8250_backup_timeout; - up->timer.data = (unsigned long)up; mod_timer(&up->timer, jiffies + uart_poll_timeout(port) + HZ / 5); } @@ -341,7 +340,6 @@ static int univ8250_setup_irq(struct uart_8250_port *up) * driver used to do this with IRQ0. */ if (!port->irq) { - up->timer.data = (unsigned long)up; mod_timer(&up->timer, jiffies + uart_poll_timeout(port)); } else retval = serial_link_irq_chain(up); @@ -520,8 +518,7 @@ static void __init serial8250_isa_init_ports(void) base_ops = port->ops; port->ops = &univ8250_port_ops; - init_timer(&up->timer); - up->timer.function = serial8250_timeout; + setup_timer(&up->timer, serial8250_timeout, (unsigned long)up); up->ops = &univ8250_driver_ops; diff --git a/drivers/tty/serial/bfin_uart.c b/drivers/tty/serial/bfin_uart.c index 293ecbb00684..167b5f25de90 100644 --- a/drivers/tty/serial/bfin_uart.c +++ b/drivers/tty/serial/bfin_uart.c @@ -624,8 +624,6 @@ static int bfin_serial_startup(struct uart_port *port) set_dma_start_addr(uart->rx_dma_channel, (unsigned long)uart->rx_dma_buf.buf); enable_dma(uart->rx_dma_channel); - uart->rx_dma_timer.data = (unsigned long)(uart); - uart->rx_dma_timer.function = (void *)bfin_serial_rx_dma_timeout; uart->rx_dma_timer.expires = jiffies + DMA_RX_FLUSH_JIFFIES; add_timer(&(uart->rx_dma_timer)); #else @@ -1316,7 +1314,8 @@ static int bfin_serial_probe(struct platform_device *pdev) } uart->rx_dma_channel = res->start; - init_timer(&(uart->rx_dma_timer)); + setup_timer(&uart->rx_dma_timer, bfin_serial_rx_dma_timeout, + (unsigned long)uart); #endif #if defined(SERIAL_BFIN_CTSRTS) || \ diff --git a/drivers/tty/serial/m32r_sio.c b/drivers/tty/serial/m32r_sio.c index 218b7118e85d..c970ea6f43cc 100644 --- a/drivers/tty/serial/m32r_sio.c +++ b/drivers/tty/serial/m32r_sio.c @@ -576,7 +576,6 @@ static int m32r_sio_startup(struct uart_port *port) timeout = timeout > 6 ? (timeout / 2 - 2) : 1; - up->timer.data = (unsigned long)up; mod_timer(&up->timer, jiffies + timeout); } else { retval = serial_link_irq_chain(up); @@ -907,8 +906,7 @@ static void __init m32r_sio_register_ports(struct uart_driver *drv) up->port.line = i; up->port.ops = &m32r_sio_pops; - init_timer(&up->timer); - up->timer.function = m32r_sio_timeout; + setup_timer(&up->timer, m32r_sio_timeout, (unsigned long)up); uart_add_one_port(drv, &up->port); } diff --git a/net/irda/irttp.c b/net/irda/irttp.c index b6ab41d5b3a3..a1530d9fdb9c 100644 --- a/net/irda/irttp.c +++ b/net/irda/irttp.c @@ -374,7 +374,7 @@ static int irttp_param_max_sdu_size(void *instance, irda_param_t *param, static void irttp_init_tsap(struct tsap_cb *tsap) { spin_lock_init(&tsap->lock); - init_timer(&tsap->todo_timer); + setup_timer(&tsap->todo_timer, irttp_todo_expired, (unsigned long)tsap); skb_queue_head_init(&tsap->rx_queue); skb_queue_head_init(&tsap->tx_queue); @@ -410,10 +410,6 @@ struct tsap_cb *irttp_open_tsap(__u8 stsap_sel, int credit, notify_t *notify) /* Initialize internal objects */ irttp_init_tsap(self); - /* Initialise todo timer */ - self->todo_timer.data = (unsigned long) self; - self->todo_timer.function = &irttp_todo_expired; - /* Initialize callbacks for IrLMP to use */ irda_notify_init(&ttp_notify); ttp_notify.connect_confirm = irttp_connect_confirm; diff --git a/net/rose/rose_loopback.c b/net/rose/rose_loopback.c index 344456206b70..dd9353173612 100644 --- a/net/rose/rose_loopback.c +++ b/net/rose/rose_loopback.c @@ -19,12 +19,13 @@ static struct sk_buff_head loopback_queue; static struct timer_list loopback_timer; static void rose_set_loopback_timer(void); +static void rose_loopback_timer(unsigned long); void rose_loopback_init(void) { skb_queue_head_init(&loopback_queue); - init_timer(&loopback_timer); + setup_timer(&loopback_timer, rose_loopback_timer, 0UL); } static int rose_loopback_running(void) @@ -50,14 +51,10 @@ int rose_loopback_queue(struct sk_buff *skb, struct rose_neigh *neigh) return 1; } -static void rose_loopback_timer(unsigned long); - static void rose_set_loopback_timer(void) { del_timer(&loopback_timer); - loopback_timer.data = 0; - loopback_timer.function = &rose_loopback_timer; loopback_timer.expires = jiffies + 10; add_timer(&loopback_timer); -- 2.7.4