media: pci: 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: Andy Walls <awalls@md.metrocast.net> Cc: Sergey Kozlov <serjk@netup.ru> Cc: Abylay Ospan <aospan@netup.ru> Cc: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Cc: Arvind Yadav <arvind.yadav.cs@gmail.com> Cc: Geliang Tang <geliangtang@gmail.com> Cc: Sean Young <sean@mess.org> Cc: "Pali Rohár" <pali.rohar@gmail.com> Signed-off-by: Kees Cook <keescook@chromium.org> [hans.verkuil@cisco.com: dropped pci/ttpci/av7110_ir.c patch chunk] Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
This commit is contained in:
parent
3ddad1ae10
commit
162e6376ac
|
@ -3652,9 +3652,9 @@ bttv_irq_wakeup_vbi(struct bttv *btv, struct bttv_buffer *wakeup,
|
|||
wake_up(&wakeup->vb.done);
|
||||
}
|
||||
|
||||
static void bttv_irq_timeout(unsigned long data)
|
||||
static void bttv_irq_timeout(struct timer_list *t)
|
||||
{
|
||||
struct bttv *btv = (struct bttv *)data;
|
||||
struct bttv *btv = from_timer(btv, t, timeout);
|
||||
struct bttv_buffer_set old,new;
|
||||
struct bttv_buffer *ovbi;
|
||||
struct bttv_buffer *item;
|
||||
|
@ -4043,7 +4043,7 @@ static int bttv_probe(struct pci_dev *dev, const struct pci_device_id *pci_id)
|
|||
INIT_LIST_HEAD(&btv->capture);
|
||||
INIT_LIST_HEAD(&btv->vcapture);
|
||||
|
||||
setup_timer(&btv->timeout, bttv_irq_timeout, (unsigned long)btv);
|
||||
timer_setup(&btv->timeout, bttv_irq_timeout, 0);
|
||||
|
||||
btv->i2c_rc = -1;
|
||||
btv->tuner_type = UNSET;
|
||||
|
|
|
@ -133,10 +133,10 @@ void bttv_input_irq(struct bttv *btv)
|
|||
ir_handle_key(btv);
|
||||
}
|
||||
|
||||
static void bttv_input_timer(unsigned long data)
|
||||
static void bttv_input_timer(struct timer_list *t)
|
||||
{
|
||||
struct bttv *btv = (struct bttv*)data;
|
||||
struct bttv_ir *ir = btv->remote;
|
||||
struct bttv_ir *ir = from_timer(ir, t, timer);
|
||||
struct bttv *btv = ir->btv;
|
||||
|
||||
if (btv->c.type == BTTV_BOARD_ENLTV_FM_2)
|
||||
ir_enltv_handle_key(btv);
|
||||
|
@ -189,9 +189,9 @@ static u32 bttv_rc5_decode(unsigned int code)
|
|||
return rc5;
|
||||
}
|
||||
|
||||
static void bttv_rc5_timer_end(unsigned long data)
|
||||
static void bttv_rc5_timer_end(struct timer_list *t)
|
||||
{
|
||||
struct bttv_ir *ir = (struct bttv_ir *)data;
|
||||
struct bttv_ir *ir = from_timer(ir, t, timer);
|
||||
ktime_t tv;
|
||||
u32 gap, rc5, scancode;
|
||||
u8 toggle, command, system;
|
||||
|
@ -296,15 +296,15 @@ static int bttv_rc5_irq(struct bttv *btv)
|
|||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
static void bttv_ir_start(struct bttv *btv, struct bttv_ir *ir)
|
||||
static void bttv_ir_start(struct bttv_ir *ir)
|
||||
{
|
||||
if (ir->polling) {
|
||||
setup_timer(&ir->timer, bttv_input_timer, (unsigned long)btv);
|
||||
timer_setup(&ir->timer, bttv_input_timer, 0);
|
||||
ir->timer.expires = jiffies + msecs_to_jiffies(1000);
|
||||
add_timer(&ir->timer);
|
||||
} else if (ir->rc5_gpio) {
|
||||
/* set timer_end for code completion */
|
||||
setup_timer(&ir->timer, bttv_rc5_timer_end, (unsigned long)ir);
|
||||
timer_setup(&ir->timer, bttv_rc5_timer_end, 0);
|
||||
ir->shift_by = 1;
|
||||
ir->rc5_remote_gap = ir_rc5_remote_gap;
|
||||
}
|
||||
|
@ -531,6 +531,7 @@ int bttv_input_init(struct bttv *btv)
|
|||
|
||||
/* init input device */
|
||||
ir->dev = rc;
|
||||
ir->btv = btv;
|
||||
|
||||
snprintf(ir->name, sizeof(ir->name), "bttv IR (card=%d)",
|
||||
btv->c.type);
|
||||
|
@ -553,7 +554,7 @@ int bttv_input_init(struct bttv *btv)
|
|||
rc->driver_name = MODULE_NAME;
|
||||
|
||||
btv->remote = ir;
|
||||
bttv_ir_start(btv, ir);
|
||||
bttv_ir_start(ir);
|
||||
|
||||
/* all done */
|
||||
err = rc_register_device(rc);
|
||||
|
|
|
@ -122,6 +122,7 @@ struct bttv_format {
|
|||
|
||||
struct bttv_ir {
|
||||
struct rc_dev *dev;
|
||||
struct bttv *btv;
|
||||
struct timer_list timer;
|
||||
|
||||
char name[32];
|
||||
|
|
|
@ -684,9 +684,9 @@ int cx18_v4l2_mmap(struct file *file, struct vm_area_struct *vma)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
void cx18_vb_timeout(unsigned long data)
|
||||
void cx18_vb_timeout(struct timer_list *t)
|
||||
{
|
||||
struct cx18_stream *s = (struct cx18_stream *)data;
|
||||
struct cx18_stream *s = from_timer(s, t, vb_timeout);
|
||||
struct cx18_videobuf_buffer *buf;
|
||||
unsigned long flags;
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ void cx18_stop_capture(struct cx18_open_id *id, int gop_end);
|
|||
void cx18_mute(struct cx18 *cx);
|
||||
void cx18_unmute(struct cx18 *cx);
|
||||
int cx18_v4l2_mmap(struct file *file, struct vm_area_struct *vma);
|
||||
void cx18_vb_timeout(unsigned long data);
|
||||
void cx18_vb_timeout(struct timer_list *t);
|
||||
|
||||
/* Shared with cx18-alsa module */
|
||||
int cx18_claim_stream(struct cx18_open_id *id, int type);
|
||||
|
|
|
@ -282,7 +282,7 @@ static void cx18_stream_init(struct cx18 *cx, int type)
|
|||
INIT_WORK(&s->out_work_order, cx18_out_work_handler);
|
||||
|
||||
INIT_LIST_HEAD(&s->vb_capture);
|
||||
setup_timer(&s->vb_timeout, cx18_vb_timeout, (unsigned long)s);
|
||||
timer_setup(&s->vb_timeout, cx18_vb_timeout, 0);
|
||||
spin_lock_init(&s->vb_lock);
|
||||
if (type == CX18_ENC_STREAM_TYPE_YUV) {
|
||||
spin_lock_init(&s->vbuf_q_lock);
|
||||
|
|
|
@ -770,8 +770,7 @@ static int ivtv_init_struct1(struct ivtv *itv)
|
|||
init_waitqueue_head(&itv->event_waitq);
|
||||
init_waitqueue_head(&itv->vsync_waitq);
|
||||
init_waitqueue_head(&itv->dma_waitq);
|
||||
setup_timer(&itv->dma_timer, ivtv_unfinished_dma,
|
||||
(unsigned long)itv);
|
||||
timer_setup(&itv->dma_timer, ivtv_unfinished_dma, 0);
|
||||
|
||||
itv->cur_dma_stream = -1;
|
||||
itv->cur_pio_stream = -1;
|
||||
|
|
|
@ -1074,9 +1074,9 @@ irqreturn_t ivtv_irq_handler(int irq, void *dev_id)
|
|||
return vsync_force ? IRQ_NONE : IRQ_HANDLED;
|
||||
}
|
||||
|
||||
void ivtv_unfinished_dma(unsigned long arg)
|
||||
void ivtv_unfinished_dma(struct timer_list *t)
|
||||
{
|
||||
struct ivtv *itv = (struct ivtv *)arg;
|
||||
struct ivtv *itv = from_timer(itv, t, dma_timer);
|
||||
|
||||
if (!test_bit(IVTV_F_I_DMA, &itv->i_flags))
|
||||
return;
|
||||
|
|
|
@ -48,6 +48,6 @@ irqreturn_t ivtv_irq_handler(int irq, void *dev_id);
|
|||
|
||||
void ivtv_irq_work_handler(struct kthread_work *work);
|
||||
void ivtv_dma_stream_dec_prepare(struct ivtv_stream *s, u32 offset, int lock);
|
||||
void ivtv_unfinished_dma(unsigned long arg);
|
||||
void ivtv_unfinished_dma(struct timer_list *t);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -638,9 +638,9 @@ static void netup_unidvb_queue_cleanup(struct netup_dma *dma)
|
|||
spin_unlock_irqrestore(&dma->lock, flags);
|
||||
}
|
||||
|
||||
static void netup_unidvb_dma_timeout(unsigned long data)
|
||||
static void netup_unidvb_dma_timeout(struct timer_list *t)
|
||||
{
|
||||
struct netup_dma *dma = (struct netup_dma *)data;
|
||||
struct netup_dma *dma = from_timer(dma, t, timeout);
|
||||
struct netup_unidvb_dev *ndev = dma->ndev;
|
||||
|
||||
dev_dbg(&ndev->pci_dev->dev, "%s()\n", __func__);
|
||||
|
@ -664,8 +664,7 @@ static int netup_unidvb_dma_init(struct netup_unidvb_dev *ndev, int num)
|
|||
spin_lock_init(&dma->lock);
|
||||
INIT_WORK(&dma->work, netup_unidvb_dma_worker);
|
||||
INIT_LIST_HEAD(&dma->free_buffers);
|
||||
setup_timer(&dma->timeout, netup_unidvb_dma_timeout,
|
||||
(unsigned long)dma);
|
||||
timer_setup(&dma->timeout, netup_unidvb_dma_timeout, 0);
|
||||
dma->ring_buffer_size = ndev->dma_size / 2;
|
||||
dma->addr_virt = ndev->dma_virt + dma->ring_buffer_size * num;
|
||||
dma->addr_phys = (dma_addr_t)((u64)ndev->dma_phys +
|
||||
|
|
|
@ -126,9 +126,9 @@ void tw686x_enable_channel(struct tw686x_dev *dev, unsigned int channel)
|
|||
* channels "too fast" which makes some TW686x devices very
|
||||
* angry and freeze the CPU (see note 1).
|
||||
*/
|
||||
static void tw686x_dma_delay(unsigned long data)
|
||||
static void tw686x_dma_delay(struct timer_list *t)
|
||||
{
|
||||
struct tw686x_dev *dev = (struct tw686x_dev *)data;
|
||||
struct tw686x_dev *dev = from_timer(dev, t, dma_delay_timer);
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&dev->lock, flags);
|
||||
|
@ -325,8 +325,7 @@ static int tw686x_probe(struct pci_dev *pci_dev,
|
|||
goto iounmap;
|
||||
}
|
||||
|
||||
setup_timer(&dev->dma_delay_timer,
|
||||
tw686x_dma_delay, (unsigned long) dev);
|
||||
timer_setup(&dev->dma_delay_timer, tw686x_dma_delay, 0);
|
||||
|
||||
/*
|
||||
* This must be set right before initializing v4l2_dev.
|
||||
|
|
Loading…
Reference in New Issue