diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-04-07 22:57:04 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-05-19 12:57:00 -0300 |
commit | c373cabfbbb7631526003f17d470c0d1e5915a4c (patch) | |
tree | a7182689854e29355ed7f3934fe53e29699b7be9 /drivers | |
parent | 9b09df51b8c2b4615376e5ada3e2eb7eeed3cf5d (diff) | |
download | kernel_goldelico_gta04-c373cabfbbb7631526003f17d470c0d1e5915a4c.zip kernel_goldelico_gta04-c373cabfbbb7631526003f17d470c0d1e5915a4c.tar.gz kernel_goldelico_gta04-c373cabfbbb7631526003f17d470c0d1e5915a4c.tar.bz2 |
V4L/DVB: em28xx: fix a regression caused by the rc-map changes
The patch that adds the rc-map changes didn't take into account that an
a table with IR_TYPE_UNKNOWN would make change_protocol to return -EINVAL.
As this function is fundamental to initialize some data, including a
callback to the getkey function, this caused the driver to stop working,
hanging the machine most of the times.
The fix were simply to add a handler for the IR type, but, to avoid further
issues, explicitly call change_protocol and handle the error before
initializing the IR. Also, let input_dev to start/stop IR handling,
after the opening of the input device.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/em28xx/em28xx-input.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/drivers/media/video/em28xx/em28xx-input.c b/drivers/media/video/em28xx/em28xx-input.c index e2772a1..5c3fd94 100644 --- a/drivers/media/video/em28xx/em28xx-input.c +++ b/drivers/media/video/em28xx/em28xx-input.c @@ -362,14 +362,20 @@ static void em28xx_ir_work(struct work_struct *work) schedule_delayed_work(&ir->work, msecs_to_jiffies(ir->polling)); } -static void em28xx_ir_start(struct em28xx_IR *ir) +static int em28xx_ir_start(void *priv) { + struct em28xx_IR *ir = priv; + INIT_DELAYED_WORK(&ir->work, em28xx_ir_work); schedule_delayed_work(&ir->work, 0); + + return 0; } -static void em28xx_ir_stop(struct em28xx_IR *ir) +static void em28xx_ir_stop(void *priv) { + struct em28xx_IR *ir = priv; + cancel_delayed_work_sync(&ir->work); } @@ -389,7 +395,7 @@ int em28xx_ir_change_protocol(void *priv, u64 ir_type) dev->board.xclk &= ~EM28XX_XCLK_IR_RC5_MODE; ir_config = EM2874_IR_NEC; ir->full_code = 1; - } else + } else if (ir_type != IR_TYPE_UNKNOWN) rc = -EINVAL; em28xx_write_reg_bits(dev, EM28XX_R0F_XCLK, dev->board.xclk, @@ -442,6 +448,13 @@ int em28xx_ir_init(struct em28xx *dev) ir->props.allowed_protos = IR_TYPE_RC5 | IR_TYPE_NEC; ir->props.priv = ir; ir->props.change_protocol = em28xx_ir_change_protocol; + ir->props.open = em28xx_ir_start; + ir->props.close = em28xx_ir_stop; + + /* By default, keep protocol field untouched */ + err = em28xx_ir_change_protocol(ir, IR_TYPE_UNKNOWN); + if (err) + goto err_out_free; /* This is how often we ask the chip for IR information */ ir->polling = 100; /* ms */ @@ -468,7 +481,6 @@ int em28xx_ir_init(struct em28xx *dev) input_dev->dev.parent = &dev->udev->dev; - em28xx_ir_start(ir); /* all done */ err = ir_input_register(ir->input, dev->board.ir_codes, @@ -478,7 +490,6 @@ int em28xx_ir_init(struct em28xx *dev) return 0; err_out_stop: - em28xx_ir_stop(ir); dev->ir = NULL; err_out_free: kfree(ir); |