diff options
author | Frank Schaefer <fschaefer.oss@googlemail.com> | 2013-01-13 08:20:45 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-02-05 17:43:16 -0500 |
commit | 9b4539bebb86310afdc5563653ec4475ae110088 (patch) | |
tree | 4c6f154da88212a29dc7abdc14bd5a75d29feb35 /drivers/media | |
parent | 1d968cdaaec2ea994b2656c00b5a4f10d4159fe8 (diff) |
[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: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/usb/em28xx/em28xx-input.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/drivers/media/usb/em28xx/em28xx-input.c b/drivers/media/usb/em28xx/em28xx-input.c index 63b97285ddbd..1bef990b3f18 100644 --- a/drivers/media/usb/em28xx/em28xx-input.c +++ b/drivers/media/usb/em28xx/em28xx-input.c | |||
@@ -338,19 +338,14 @@ static void em28xx_ir_handle_key(struct em28xx_IR *ir) | |||
338 | } | 338 | } |
339 | } | 339 | } |
340 | 340 | ||
341 | static void em28xx_i2c_ir_work(struct work_struct *work) | ||
342 | { | ||
343 | struct em28xx_IR *ir = container_of(work, struct em28xx_IR, work.work); | ||
344 | |||
345 | em28xx_i2c_ir_handle_key(ir); | ||
346 | schedule_delayed_work(&ir->work, msecs_to_jiffies(ir->polling)); | ||
347 | } | ||
348 | |||
349 | static void em28xx_ir_work(struct work_struct *work) | 341 | static void em28xx_ir_work(struct work_struct *work) |
350 | { | 342 | { |
351 | struct em28xx_IR *ir = container_of(work, struct em28xx_IR, work.work); | 343 | struct em28xx_IR *ir = container_of(work, struct em28xx_IR, work.work); |
352 | 344 | ||
353 | em28xx_ir_handle_key(ir); | 345 | if (ir->i2c_dev_addr) /* external i2c device */ |
346 | em28xx_i2c_ir_handle_key(ir); | ||
347 | else /* internal device */ | ||
348 | em28xx_ir_handle_key(ir); | ||
354 | schedule_delayed_work(&ir->work, msecs_to_jiffies(ir->polling)); | 349 | schedule_delayed_work(&ir->work, msecs_to_jiffies(ir->polling)); |
355 | } | 350 | } |
356 | 351 | ||
@@ -358,10 +353,7 @@ static int em28xx_ir_start(struct rc_dev *rc) | |||
358 | { | 353 | { |
359 | struct em28xx_IR *ir = rc->priv; | 354 | struct em28xx_IR *ir = rc->priv; |
360 | 355 | ||
361 | if (ir->i2c_dev_addr) /* external i2c device */ | 356 | INIT_DELAYED_WORK(&ir->work, em28xx_ir_work); |
362 | INIT_DELAYED_WORK(&ir->work, em28xx_i2c_ir_work); | ||
363 | else /* internal device */ | ||
364 | INIT_DELAYED_WORK(&ir->work, em28xx_ir_work); | ||
365 | schedule_delayed_work(&ir->work, 0); | 357 | schedule_delayed_work(&ir->work, 0); |
366 | 358 | ||
367 | return 0; | 359 | return 0; |