Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 162e6376 authored by Kees Cook's avatar Kees Cook Committed by Mauro Carvalho Chehab
Browse files

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: default avatarKees Cook <keescook@chromium.org>
[hans.verkuil@cisco.com: dropped pci/ttpci/av7110_ir.c patch chunk]
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 3ddad1ae
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -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;
+10 −9
Original line number Diff line number Diff line
@@ -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);
+1 −0
Original line number Diff line number Diff line
@@ -122,6 +122,7 @@ struct bttv_format {

struct bttv_ir {
	struct rc_dev           *dev;
	struct bttv		*btv;
	struct timer_list       timer;

	char                    name[32];
+2 −2
Original line number Diff line number Diff line
@@ -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;

+1 −1
Original line number Diff line number Diff line
@@ -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);
Loading