From patchwork Wed Jun 29 13:20:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andi Shyti X-Patchwork-Id: 9205093 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3555A6089F for ; Wed, 29 Jun 2016 13:22:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2731C28655 for ; Wed, 29 Jun 2016 13:22:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 15DF62866B; Wed, 29 Jun 2016 13:22:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A170828669 for ; Wed, 29 Jun 2016 13:22:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752648AbcF2NVF (ORCPT ); Wed, 29 Jun 2016 09:21:05 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:48043 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752540AbcF2NVE (ORCPT ); Wed, 29 Jun 2016 09:21:04 -0400 Received: from epcpsbgr3.samsung.com (u143.gpu120.samsung.co.kr [203.254.230.143]) by mailout3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0O9J02NFKBQX2J40@mailout3.samsung.com>; Wed, 29 Jun 2016 22:20:57 +0900 (KST) Received: from epcpsbgm2new.samsung.com ( [172.20.52.113]) by epcpsbgr3.samsung.com (EPCPMTA) with SMTP id 90.6E.05161.83BC3775; Wed, 29 Jun 2016 22:20:57 +0900 (KST) X-AuditID: cbfee68f-f79476d000001429-1f-5773cb383952 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2new.samsung.com (EPCPMTA) with SMTP id 83.6D.04429.83BC3775; Wed, 29 Jun 2016 06:20:56 -0700 (MST) Received: from samsunx.samsung ([10.113.63.54]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0O9J0087XBQTVM50@mmp1.samsung.com>; Wed, 29 Jun 2016 22:20:56 +0900 (KST) From: Andi Shyti To: Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Andi Shyti , Andi Shyti Subject: [PATCH 08/15] lirc_dev: remove double if ... else statement Date: Wed, 29 Jun 2016 22:20:37 +0900 Message-id: <1467206444-9935-9-git-send-email-andi.shyti@samsung.com> X-Mailer: git-send-email 2.8.1 In-reply-to: <1467206444-9935-1-git-send-email-andi.shyti@samsung.com> References: <1467206444-9935-1-git-send-email-andi.shyti@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrOLMWRmVeSWpSXmKPExsWyRsSkUNfydHG4wfutTBbbjzxjtVj84zmT xeVdc9gsejZsZbVY/azCgdXj+pJPzB5b+u+ye/RtWcXo8XmTXABLFJdNSmpOZllqkb5dAlfG /zllBZO4K460PWdtYHzK0cXIySEhYCJx8Mp+ZghbTOLCvfVsXYxcHEICKxgltn6ewtjFyAFW 1HU7FiK+lFHiXvNHZgjnI6PEpFPf2UC62QQ0JZpu/2ADaRARMJY490MdJMws0Mwosfu6EYgt LOAicfhNEzuIzSKgKnFq4Sew+bwCrhKvbmlD3CAncXn6A7CJnAJuEsvP3wQrFwIqaX36nxGi pp1donOxLMQYAYlvkw+xQJwpK7HpANQrkhIHV9xgmcAovICRYRWjaGpBckFxUnqRsV5xYm5x aV66XnJ+7iZGYPie/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/NmP/xr6rvHLtDz/7s3fDm6mKW3+8X8xbOOuYcnjhh/9b1J7ftTGJ6rc0ZKbNa VWTSVpYvT76Ea8ZsvhHSs+XzLD5jJZbijERDLeai4kQAzrmTW6gCAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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);