]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
video: fbdev: pxa3xx_gcu: Convert timers to use timer_setup()
authorKees Cook <keescook@chromium.org>
Fri, 10 Nov 2017 15:34:51 +0000 (16:34 +0100)
committerBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Fri, 10 Nov 2017 15:34:51 +0000 (16:34 +0100)
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.

This also fixes the use of the "priv" variable in QERROR(), since it was
pointing to struct timer_list, not struct pxa3xx_gcu_priv.

Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
Cc: Himanshu Jha <himanshujha199640@gmail.com>
[b.zolnierkie: trivial build fixup]
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
drivers/video/fbdev/pxa3xx-gcu.c

index 3366076f9e0f49f7cfdf8a2e7851c6fc1a012ecd..55fbb432c05352271380f25fd5da5c5502a7af51 100644 (file)
@@ -512,24 +512,26 @@ pxa3xx_gcu_mmap(struct file *file, struct vm_area_struct *vma)
 
 #ifdef PXA3XX_GCU_DEBUG_TIMER
 static struct timer_list pxa3xx_gcu_debug_timer;
+static struct pxa3xx_gcu_priv *debug_timer_priv;
 
-static void pxa3xx_gcu_debug_timedout(unsigned long ptr)
+static void pxa3xx_gcu_debug_timedout(struct timer_list *unused)
 {
-       struct pxa3xx_gcu_priv *priv = (struct pxa3xx_gcu_priv *) ptr;
+       struct pxa3xx_gcu_priv *priv = debug_timer_priv;
 
        QERROR("Timer DUMP");
 
-       /* init the timer structure */
-       setup_timer(&pxa3xx_gcu_debug_timer, pxa3xx_gcu_debug_timedout, ptr);
        mod_timer(&pxa3xx_gcu_debug_timer, jiffies + 5 * HZ);
 }
 
-static void pxa3xx_gcu_init_debug_timer(void)
+static void pxa3xx_gcu_init_debug_timer(struct pxa3xx_gcu_priv *priv)
 {
-       pxa3xx_gcu_debug_timedout((unsigned long) &pxa3xx_gcu_debug_timer);
+       /* init the timer structure */
+       debug_timer_priv = priv;
+       timer_setup(&pxa3xx_gcu_debug_timer, pxa3xx_gcu_debug_timedout, 0);
+       pxa3xx_gcu_debug_timedout(NULL);
 }
 #else
-static inline void pxa3xx_gcu_init_debug_timer(void) {}
+static inline void pxa3xx_gcu_init_debug_timer(struct pxa3xx_gcu_priv *priv) {}
 #endif
 
 static int
@@ -666,7 +668,7 @@ static int pxa3xx_gcu_probe(struct platform_device *pdev)
        platform_set_drvdata(pdev, priv);
        priv->resource_mem = r;
        pxa3xx_gcu_reset(priv);
-       pxa3xx_gcu_init_debug_timer();
+       pxa3xx_gcu_init_debug_timer(priv);
 
        dev_info(dev, "registered @0x%p, DMA 0x%p (%d bytes), IRQ %d\n",
                        (void *) r->start, (void *) priv->shared_phys,