dmaengine: Convert timers to use timer_setup()
authorKees Cook <keescook@chromium.org>
Tue, 24 Oct 2017 10:02:23 +0000 (03:02 -0700)
committerVinod Koul <vinod.koul@intel.com>
Tue, 24 Oct 2017 14:41:21 +0000 (20:11 +0530)
In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new timer_setup() and from_timer()
to pass the timer pointer explicitly.

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
drivers/dma/imx-dma.c
drivers/dma/ioat/dma.c
drivers/dma/ioat/dma.h
drivers/dma/ioat/init.c

index f681df8f0ed339bdcadb6fb273fffed5c3adcb2b..331f863c605ea928b766122a1226d598e6a0ec15 100644 (file)
@@ -364,9 +364,9 @@ static void imxdma_disable_hw(struct imxdma_channel *imxdmac)
        local_irq_restore(flags);
 }
 
-static void imxdma_watchdog(unsigned long data)
+static void imxdma_watchdog(struct timer_list *t)
 {
-       struct imxdma_channel *imxdmac = (struct imxdma_channel *)data;
+       struct imxdma_channel *imxdmac = from_timer(imxdmac, t, watchdog);
        struct imxdma_engine *imxdma = imxdmac->imxdma;
        int channel = imxdmac->channel;
 
@@ -1153,9 +1153,7 @@ static int __init imxdma_probe(struct platform_device *pdev)
                        }
 
                        imxdmac->irq = irq + i;
-                       init_timer(&imxdmac->watchdog);
-                       imxdmac->watchdog.function = &imxdma_watchdog;
-                       imxdmac->watchdog.data = (unsigned long)imxdmac;
+                       timer_setup(&imxdmac->watchdog, imxdma_watchdog, 0);
                }
 
                imxdmac->imxdma = imxdma;
index f70cc74032eaa9fd1d8da9b4203839e25befd1f6..58d4ccd33672081bcce087d8e24b828f53b83ac7 100644 (file)
@@ -474,7 +474,7 @@ int ioat_check_space_lock(struct ioatdma_chan *ioat_chan, int num_descs)
        if (time_is_before_jiffies(ioat_chan->timer.expires)
            && timer_pending(&ioat_chan->timer)) {
                mod_timer(&ioat_chan->timer, jiffies + COMPLETION_TIMEOUT);
-               ioat_timer_event((unsigned long)ioat_chan);
+               ioat_timer_event(&ioat_chan->timer);
        }
 
        return -ENOMEM;
@@ -862,9 +862,9 @@ static void check_active(struct ioatdma_chan *ioat_chan)
                mod_timer(&ioat_chan->timer, jiffies + IDLE_TIMEOUT);
 }
 
-void ioat_timer_event(unsigned long data)
+void ioat_timer_event(struct timer_list *t)
 {
-       struct ioatdma_chan *ioat_chan = to_ioat_chan((void *)data);
+       struct ioatdma_chan *ioat_chan = from_timer(ioat_chan, t, timer);
        dma_addr_t phys_complete;
        u64 status;
 
index 56200eefcf5eed792137a0ea2b9b4d5c295484ea..1ab42ec2b7ff12bf5634c422b93200b585be0a0a 100644 (file)
@@ -406,10 +406,9 @@ enum dma_status
 ioat_tx_status(struct dma_chan *c, dma_cookie_t cookie,
                struct dma_tx_state *txstate);
 void ioat_cleanup_event(unsigned long data);
-void ioat_timer_event(unsigned long data);
+void ioat_timer_event(struct timer_list *t);
 int ioat_check_space_lock(struct ioatdma_chan *ioat_chan, int num_descs);
 void ioat_issue_pending(struct dma_chan *chan);
-void ioat_timer_event(unsigned long data);
 
 /* IOAT Init functions */
 bool is_bwd_ioat(struct pci_dev *pdev);
index 93e006c3441d3f96e86de1199018efa41c63f8d0..2f31d3d0caa61821aa08aea360e06709bdb25d48 100644 (file)
@@ -760,7 +760,7 @@ ioat_init_channel(struct ioatdma_device *ioat_dma,
        dma_cookie_init(&ioat_chan->dma_chan);
        list_add_tail(&ioat_chan->dma_chan.device_node, &dma->channels);
        ioat_dma->idx[idx] = ioat_chan;
-       setup_timer(&ioat_chan->timer, ioat_timer_event, data);
+       timer_setup(&ioat_chan->timer, ioat_timer_event, 0);
        tasklet_init(&ioat_chan->cleanup_task, ioat_cleanup_event, data);
 }