Commit 19e56539 authored by Andi Shyti's avatar Andi Shyti Committed by Mauro Carvalho Chehab

[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: default avatarAndi Shyti <andi.shyti@samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 7fe579d2
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment