diff options
-rw-r--r-- | drivers/media/video/em28xx/em28xx-input.c | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/drivers/media/video/em28xx/em28xx-input.c b/drivers/media/video/em28xx/em28xx-input.c index dd6d528998b1..6759cd5570dd 100644 --- a/drivers/media/video/em28xx/em28xx-input.c +++ b/drivers/media/video/em28xx/em28xx-input.c | |||
@@ -292,18 +292,15 @@ static void em28xx_ir_handle_key(struct em28xx_IR *ir) | |||
292 | 292 | ||
293 | /* read the registers containing the IR status */ | 293 | /* read the registers containing the IR status */ |
294 | result = ir->get_key(ir, &poll_result); | 294 | result = ir->get_key(ir, &poll_result); |
295 | if (result < 0) { | 295 | if (unlikely(result < 0)) { |
296 | dprintk("ir->get_key() failed %d\n", result); | 296 | dprintk("ir->get_key() failed %d\n", result); |
297 | return; | 297 | return; |
298 | } | 298 | } |
299 | 299 | ||
300 | dprintk("ir->get_key result tb=%02x rc=%02x lr=%02x data=%02x%02x\n", | 300 | if (unlikely(poll_result.read_count != ir->last_readcount)) { |
301 | poll_result.toggle_bit, poll_result.read_count, | 301 | dprintk("%s: toggle: %d, count: %d, key 0x%02x%02x\n", __func__, |
302 | ir->last_readcount, poll_result.rc_address, | 302 | poll_result.toggle_bit, poll_result.read_count, |
303 | poll_result.rc_data[0]); | 303 | poll_result.rc_address, poll_result.rc_data[0]); |
304 | |||
305 | if (poll_result.read_count > 0 && | ||
306 | poll_result.read_count != ir->last_readcount) { | ||
307 | if (ir->full_code) | 304 | if (ir->full_code) |
308 | ir_keydown(ir->input, | 305 | ir_keydown(ir->input, |
309 | poll_result.rc_address << 8 | | 306 | poll_result.rc_address << 8 | |
@@ -313,17 +310,17 @@ static void em28xx_ir_handle_key(struct em28xx_IR *ir) | |||
313 | ir_keydown(ir->input, | 310 | ir_keydown(ir->input, |
314 | poll_result.rc_data[0], | 311 | poll_result.rc_data[0], |
315 | poll_result.toggle_bit); | 312 | poll_result.toggle_bit); |
316 | } | ||
317 | 313 | ||
318 | if (ir->dev->chip_id == CHIP_ID_EM2874) | 314 | if (ir->dev->chip_id == CHIP_ID_EM2874) |
319 | /* The em2874 clears the readcount field every time the | 315 | /* The em2874 clears the readcount field every time the |
320 | register is read. The em2860/2880 datasheet says that it | 316 | register is read. The em2860/2880 datasheet says that it |
321 | is supposed to clear the readcount, but it doesn't. So with | 317 | is supposed to clear the readcount, but it doesn't. So with |
322 | the em2874, we are looking for a non-zero read count as | 318 | the em2874, we are looking for a non-zero read count as |
323 | opposed to a readcount that is incrementing */ | 319 | opposed to a readcount that is incrementing */ |
324 | ir->last_readcount = 0; | 320 | ir->last_readcount = 0; |
325 | else | 321 | else |
326 | ir->last_readcount = poll_result.read_count; | 322 | ir->last_readcount = poll_result.read_count; |
323 | } | ||
327 | } | 324 | } |
328 | 325 | ||
329 | static void em28xx_ir_work(struct work_struct *work) | 326 | static void em28xx_ir_work(struct work_struct *work) |