From: "Frank Schäfer" <fschaefer.oss@googlemail.com>
To: mchehab@redhat.com
Cc: linux-media@vger.kernel.org,
"Frank Schäfer" <fschaefer.oss@googlemail.com>
Subject: [PATCH 7/7] em28xx: input: use common work_struct callback function for IR RC key polling
Date: Sun, 13 Jan 2013 15:20:45 +0100 [thread overview]
Message-ID: <1358086845-6989-7-git-send-email-fschaefer.oss@googlemail.com> (raw)
In-Reply-To: <1358086845-6989-1-git-send-email-fschaefer.oss@googlemail.com>
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>
---
drivers/media/usb/em28xx/em28xx-input.c | 18 +++++-------------
1 Datei geändert, 5 Zeilen hinzugefügt(+), 13 Zeilen entfernt(-)
diff --git a/drivers/media/usb/em28xx/em28xx-input.c b/drivers/media/usb/em28xx/em28xx-input.c
index 2a49cc1..6ff6775 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)
}
}
-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);
- em28xx_ir_handle_key(ir);
+ 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,10 +353,7 @@ 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);
+ INIT_DELAYED_WORK(&ir->work, em28xx_ir_work);
schedule_delayed_work(&ir->work, 0);
return 0;
--
1.7.10.4
prev parent reply other threads:[~2013-01-13 14:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-13 14:20 [PATCH 1/7] em28xx-input: remove dead code line from em28xx_get_key_em_haup() Frank Schäfer
2013-01-13 14:20 ` [PATCH 2/7] em28xx: remove i2cdprintk() messages Frank Schäfer
2013-01-13 14:20 ` [PATCH 3/7] em28xx: get rid of the dependency on module ir-kbd-i2c Frank Schäfer
2013-01-13 14:20 ` [PATCH 4/7] em28xx: remove unused parameter ir_raw from i2c RC key polling functions Frank Schäfer
2013-01-13 14:20 ` [PATCH 5/7] em28xx: fix a comment and a small coding style issue Frank Schäfer
2013-01-13 14:20 ` [PATCH 6/7] em28xx: i2c RC devices: minor code size and memory usage optimization Frank Schäfer
2013-01-13 14:20 ` Frank Schäfer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1358086845-6989-7-git-send-email-fschaefer.oss@googlemail.com \
--to=fschaefer.oss@googlemail.com \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).