summaryrefslogtreecommitdiff
path: root/drivers/media/rc/lirc_dev.c
diff options
context:
space:
mode:
authorAndi Shyti <andi.shyti@samsung.com>2016-07-06 12:01:19 +0300
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2016-07-13 21:06:29 +0300
commit19e565397cb92b0484c46c48498e0fe2d2491efa (patch)
tree25ca079ed0358d56685db0028977f41043d94db5 /drivers/media/rc/lirc_dev.c
parent7fe579d29f66e7dee77c50f39947a70a74929f4f (diff)
downloadlinux-19e565397cb92b0484c46c48498e0fe2d2491efa.tar.xz
[media] lirc_dev: simplify if statement in lirc_add_to_buf
The whole function is inside an 'if' statement ("if (ir->d.add_to_buf)"). Check the opposite of that statement at the beginning and exit, this way we can have one level less of indentation. Signed-off-by: Andi Shyti <andi.shyti@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/rc/lirc_dev.c')
-rw-r--r--drivers/media/rc/lirc_dev.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c
index cfa6031eeb72..c2826a7b70bd 100644
--- a/drivers/media/rc/lirc_dev.c
+++ b/drivers/media/rc/lirc_dev.c
@@ -97,26 +97,25 @@ static void lirc_irctl_cleanup(struct irctl *ir)
*/
static int lirc_add_to_buf(struct irctl *ir)
{
- if (ir->d.add_to_buf) {
- int res = -ENODATA;
- int got_data = -1;
+ int res;
+ int got_data = -1;
- /*
- * service the device as long as it is returning
- * data and we have space
- */
- do {
- got_data++;
- res = ir->d.add_to_buf(ir->d.data, ir->buf);
- } while (!res);
+ if (!ir->d.add_to_buf)
+ return 0;
- if (res == -ENODEV)
- kthread_stop(ir->task);
+ /*
+ * service the device as long as it is returning
+ * data and we have space
+ */
+ do {
+ got_data++;
+ res = ir->d.add_to_buf(ir->d.data, ir->buf);
+ } while (!res);
- return got_data ? 0 : res;
- }
+ if (res == -ENODEV)
+ kthread_stop(ir->task);
- return 0;
+ return got_data ? 0 : res;
}
/* main function of the polling thread