Commit 1e7126b4 authored by Kees Cook's avatar Kees Cook Committed by Mauro Carvalho Chehab

media: saa7134: Convert timers to use timer_setup()

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.

Cc: Geliang Tang <geliangtang@gmail.com>
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 60793f4d
...@@ -338,9 +338,9 @@ void saa7134_buffer_next(struct saa7134_dev *dev, ...@@ -338,9 +338,9 @@ void saa7134_buffer_next(struct saa7134_dev *dev,
} }
} }
void saa7134_buffer_timeout(unsigned long data) void saa7134_buffer_timeout(struct timer_list *t)
{ {
struct saa7134_dmaqueue *q = (struct saa7134_dmaqueue *)data; struct saa7134_dmaqueue *q = from_timer(q, t, timeout);
struct saa7134_dev *dev = q->dev; struct saa7134_dev *dev = q->dev;
unsigned long flags; unsigned long flags;
...@@ -378,7 +378,7 @@ void saa7134_stop_streaming(struct saa7134_dev *dev, struct saa7134_dmaqueue *q) ...@@ -378,7 +378,7 @@ void saa7134_stop_streaming(struct saa7134_dev *dev, struct saa7134_dmaqueue *q)
} }
} }
spin_unlock_irqrestore(&dev->slock, flags); spin_unlock_irqrestore(&dev->slock, flags);
saa7134_buffer_timeout((unsigned long)q); /* also calls del_timer(&q->timeout) */ saa7134_buffer_timeout(&q->timeout); /* also calls del_timer(&q->timeout) */
} }
EXPORT_SYMBOL_GPL(saa7134_stop_streaming); EXPORT_SYMBOL_GPL(saa7134_stop_streaming);
......
...@@ -447,10 +447,10 @@ void saa7134_input_irq(struct saa7134_dev *dev) ...@@ -447,10 +447,10 @@ void saa7134_input_irq(struct saa7134_dev *dev)
} }
} }
static void saa7134_input_timer(unsigned long data) static void saa7134_input_timer(struct timer_list *t)
{ {
struct saa7134_dev *dev = (struct saa7134_dev *)data; struct saa7134_card_ir *ir = from_timer(ir, t, timer);
struct saa7134_card_ir *ir = dev->remote; struct saa7134_dev *dev = ir->dev->priv;
build_key(dev); build_key(dev);
mod_timer(&ir->timer, jiffies + msecs_to_jiffies(ir->polling)); mod_timer(&ir->timer, jiffies + msecs_to_jiffies(ir->polling));
...@@ -507,8 +507,7 @@ static int __saa7134_ir_start(void *priv) ...@@ -507,8 +507,7 @@ static int __saa7134_ir_start(void *priv)
ir->running = true; ir->running = true;
if (ir->polling) { if (ir->polling) {
setup_timer(&ir->timer, saa7134_input_timer, timer_setup(&ir->timer, saa7134_input_timer, 0);
(unsigned long)dev);
ir->timer.expires = jiffies + HZ; ir->timer.expires = jiffies + HZ;
add_timer(&ir->timer); add_timer(&ir->timer);
} }
......
...@@ -223,8 +223,7 @@ int saa7134_ts_init1(struct saa7134_dev *dev) ...@@ -223,8 +223,7 @@ int saa7134_ts_init1(struct saa7134_dev *dev)
dev->ts.nr_packets = ts_nr_packets; dev->ts.nr_packets = ts_nr_packets;
INIT_LIST_HEAD(&dev->ts_q.queue); INIT_LIST_HEAD(&dev->ts_q.queue);
setup_timer(&dev->ts_q.timeout, saa7134_buffer_timeout, timer_setup(&dev->ts_q.timeout, saa7134_buffer_timeout, 0);
(unsigned long)(&dev->ts_q));
dev->ts_q.dev = dev; dev->ts_q.dev = dev;
dev->ts_q.need_two = 1; dev->ts_q.need_two = 1;
dev->ts_started = 0; dev->ts_started = 0;
......
...@@ -181,8 +181,7 @@ const struct vb2_ops saa7134_vbi_qops = { ...@@ -181,8 +181,7 @@ const struct vb2_ops saa7134_vbi_qops = {
int saa7134_vbi_init1(struct saa7134_dev *dev) int saa7134_vbi_init1(struct saa7134_dev *dev)
{ {
INIT_LIST_HEAD(&dev->vbi_q.queue); INIT_LIST_HEAD(&dev->vbi_q.queue);
setup_timer(&dev->vbi_q.timeout, saa7134_buffer_timeout, timer_setup(&dev->vbi_q.timeout, saa7134_buffer_timeout, 0);
(unsigned long)(&dev->vbi_q));
dev->vbi_q.dev = dev; dev->vbi_q.dev = dev;
if (vbibufs < 2) if (vbibufs < 2)
......
...@@ -2145,8 +2145,7 @@ int saa7134_video_init1(struct saa7134_dev *dev) ...@@ -2145,8 +2145,7 @@ int saa7134_video_init1(struct saa7134_dev *dev)
dev->automute = 0; dev->automute = 0;
INIT_LIST_HEAD(&dev->video_q.queue); INIT_LIST_HEAD(&dev->video_q.queue);
setup_timer(&dev->video_q.timeout, saa7134_buffer_timeout, timer_setup(&dev->video_q.timeout, saa7134_buffer_timeout, 0);
(unsigned long)(&dev->video_q));
dev->video_q.dev = dev; dev->video_q.dev = dev;
dev->fmt = format_by_fourcc(V4L2_PIX_FMT_BGR24); dev->fmt = format_by_fourcc(V4L2_PIX_FMT_BGR24);
dev->width = 720; dev->width = 720;
......
...@@ -773,7 +773,7 @@ int saa7134_buffer_queue(struct saa7134_dev *dev, struct saa7134_dmaqueue *q, ...@@ -773,7 +773,7 @@ int saa7134_buffer_queue(struct saa7134_dev *dev, struct saa7134_dmaqueue *q,
void saa7134_buffer_finish(struct saa7134_dev *dev, struct saa7134_dmaqueue *q, void saa7134_buffer_finish(struct saa7134_dev *dev, struct saa7134_dmaqueue *q,
unsigned int state); unsigned int state);
void saa7134_buffer_next(struct saa7134_dev *dev, struct saa7134_dmaqueue *q); void saa7134_buffer_next(struct saa7134_dev *dev, struct saa7134_dmaqueue *q);
void saa7134_buffer_timeout(unsigned long data); void saa7134_buffer_timeout(struct timer_list *t);
void saa7134_stop_streaming(struct saa7134_dev *dev, struct saa7134_dmaqueue *q); void saa7134_stop_streaming(struct saa7134_dev *dev, struct saa7134_dmaqueue *q);
int saa7134_set_dmabits(struct saa7134_dev *dev); int saa7134_set_dmabits(struct saa7134_dev *dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment