Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6ab86d2a authored by Andi Shyti's avatar Andi Shyti Committed by Mauro Carvalho Chehab
Browse files

[media] lirc_dev: remove double if ... else statement



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: default avatarAndi Shyti <andi.shyti@samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 19e56539
Loading
Loading
Loading
Loading
+5 −7
Original line number Original line Diff line number Diff line
@@ -310,13 +310,6 @@ static int lirc_allocate_driver(struct lirc_driver *d)
	irctls[minor] = ir;
	irctls[minor] = ir;
	d->minor = minor;
	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-) */
	/* some safety check 8-) */
	d->name[sizeof(d->name)-1] = '\0';
	d->name[sizeof(d->name)-1] = '\0';


@@ -330,6 +323,8 @@ static int lirc_allocate_driver(struct lirc_driver *d)
		      "lirc%u", ir->d.minor);
		      "lirc%u", ir->d.minor);


	if (d->sample_rate) {
	if (d->sample_rate) {
		ir->jiffies_to_wait = HZ / d->sample_rate;

		/* try to fire up polling thread */
		/* try to fire up polling thread */
		ir->task = kthread_run(lirc_thread, (void *)ir, "lirc_dev");
		ir->task = kthread_run(lirc_thread, (void *)ir, "lirc_dev");
		if (IS_ERR(ir->task)) {
		if (IS_ERR(ir->task)) {
@@ -338,6 +333,9 @@ static int lirc_allocate_driver(struct lirc_driver *d)
			err = -ECHILD;
			err = -ECHILD;
			goto out_sysfs;
			goto out_sysfs;
		}
		}
	} else {
		/* it means - wait for external event in task queue */
		ir->jiffies_to_wait = 0;
	}
	}


	err = lirc_cdev_add(ir);
	err = lirc_cdev_add(ir);