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

Commit 9b4539be authored by Frank Schaefer's avatar Frank Schaefer Committed by Mauro Carvalho Chehab
Browse files

[media] em28xx: input: use common work_struct callback function for IR RC key polling



Remove em28xx_i2c_ir_work() and check the device type in the common callback
function em28xx_ir_work() instead. Simplifies em28xx_ir_start().
Reduces the code size with a minor performance drawback.

Signed-off-by: default avatarFrank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 1d968cda
Loading
Loading
Loading
Loading
+5 −13
Original line number Diff line number Diff line
@@ -338,18 +338,13 @@ static void em28xx_ir_handle_key(struct em28xx_IR *ir)
	}
}

static void em28xx_i2c_ir_work(struct work_struct *work)
{
	struct em28xx_IR *ir = container_of(work, struct em28xx_IR, work.work);

	em28xx_i2c_ir_handle_key(ir);
	schedule_delayed_work(&ir->work, msecs_to_jiffies(ir->polling));
}

static void em28xx_ir_work(struct work_struct *work)
{
	struct em28xx_IR *ir = container_of(work, struct em28xx_IR, work.work);

	if (ir->i2c_dev_addr) /* external i2c device */
		em28xx_i2c_ir_handle_key(ir);
	else /* internal device */
		em28xx_ir_handle_key(ir);
	schedule_delayed_work(&ir->work, msecs_to_jiffies(ir->polling));
}
@@ -358,9 +353,6 @@ static int em28xx_ir_start(struct rc_dev *rc)
{
	struct em28xx_IR *ir = rc->priv;

	if (ir->i2c_dev_addr) /* external i2c device */
		INIT_DELAYED_WORK(&ir->work, em28xx_i2c_ir_work);
	else /* internal device */
	INIT_DELAYED_WORK(&ir->work, em28xx_ir_work);
	schedule_delayed_work(&ir->work, 0);