Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1433732
| From | Andi Shyti <andi.shyti@samsung.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 08/15] lirc_dev: remove double if ... else statement |
| Date | 2016-06-29 15:30 +0200 |
| Message-ID | <rPnJ5-4Hd-27@gated-at.bofh.it> (permalink) |
| References | <rPnIZ-4Hd-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
There are two if ... else which check the same thing in different
part of the code, they can be merged in a single check.
Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
---
drivers/media/rc/lirc_dev.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c
index d63ff85..7dff92c 100644
--- a/drivers/media/rc/lirc_dev.c
+++ b/drivers/media/rc/lirc_dev.c
@@ -309,13 +309,6 @@ static int lirc_allocate_driver(struct lirc_driver *d)
irctls[minor] = ir;
d->minor = minor;
- if (d->sample_rate) {
- ir->jiffies_to_wait = HZ / d->sample_rate;
- } else {
- /* it means - wait for external event in task queue */
- ir->jiffies_to_wait = 0;
- }
-
/* some safety check 8-) */
d->name[sizeof(d->name)-1] = '\0';
@@ -329,6 +322,8 @@ static int lirc_allocate_driver(struct lirc_driver *d)
"lirc%u", ir->d.minor);
if (d->sample_rate) {
+ ir->jiffies_to_wait = HZ / d->sample_rate;
+
/* try to fire up polling thread */
ir->task = kthread_run(lirc_thread, (void *)ir, "lirc_dev");
if (IS_ERR(ir->task)) {
@@ -337,6 +332,9 @@ static int lirc_allocate_driver(struct lirc_driver *d)
err = -ECHILD;
goto out_sysfs;
}
+ } else {
+ /* it means - wait for external event in task queue */
+ ir->jiffies_to_wait = 0;
}
err = lirc_cdev_add(ir);
--
2.8.1
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH 08/15] lirc_dev: remove double if ... else statement Andi Shyti <andi.shyti@samsung.com> - 2016-06-29 15:30 +0200
csiph-web