From patchwork Wed Jan 11 08:59:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TWljaGHFgiBLxJlwaWXFhA==?= X-Patchwork-Id: 9509541 X-Patchwork-Delegate: dvhart@infradead.org 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 2459160231 for ; Wed, 11 Jan 2017 09:00:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 14F2A285B8 for ; Wed, 11 Jan 2017 09:00:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 09351285BA; Wed, 11 Jan 2017 09:00:39 +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.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID 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 A021E2041F for ; Wed, 11 Jan 2017 09:00:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760917AbdAKJAR (ORCPT ); Wed, 11 Jan 2017 04:00:17 -0500 Received: from mail-lf0-f68.google.com ([209.85.215.68]:32868 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936764AbdAKI7o (ORCPT ); Wed, 11 Jan 2017 03:59:44 -0500 Received: by mail-lf0-f68.google.com with SMTP id k62so14177183lfg.0 for ; Wed, 11 Jan 2017 00:59:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kempniu.pl; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yMUSMzy6PKvZb4R0lefhkejv1HSbc6HnhJj6I93Xc3w=; b=VO87BqbE0vEopPRVrqaZCIOfKprvY+ZvV1qUsPi/AuXFGcW2N4M6aQ0wNrjnQaqlG+ +FDH8XPra+jWvPfarxNwBOk2JGwrxU38gUrmdZ3Wgq6XTF9dq1RzSEcMZ4SKOQCvoiAd xwLXPjj7RbPBUt6sF/6Sq8ty1DCqJpZE9pFds= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yMUSMzy6PKvZb4R0lefhkejv1HSbc6HnhJj6I93Xc3w=; b=VJMGHUpk8r9E3OB3KejSsDT/Gl84Wbwgz4Ssg8C4q0OdOBuZhwBjM65rDOGg2sZhhE miLISbDZa2Hl7nTsDOW1SKMKOsredIheZHTABh/HV8U/M6gkZUvJX7rUoXej9Z4c+wJJ K7Blj7vI0l0HnHO6F13NxqlFz5RRWJXrE/J+3qELoK2VRZn9+5DtL7LyLwG+V5RPke8T uQr00ZBOagDwV8rhyLsHKJpJeADR61ZZqCRDljq6s4BE6sYBw9F9YmqnYHhaPeZ9vktp 5OGy0WgWBciCDESpRosOcZRNQ+B217fntY7U1zSSD36uDGaS7D0v5qnokHDBW8is00g7 UlKg== X-Gm-Message-State: AIkVDXL7wNO9hTA8F2H6xtT0SdQfh8Ex4g+iEOrrfFX+zdeT2F7BxL11wm6dgYTj1lKGnw== X-Received: by 10.25.132.6 with SMTP id g6mr3046920lfd.144.1484125182697; Wed, 11 Jan 2017 00:59:42 -0800 (PST) Received: from ozzy.nask.waw.pl ([2001:a10:160:3::3]) by smtp.googlemail.com with ESMTPSA id r127sm1157567lfr.3.2017.01.11.00.59.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Jan 2017 00:59:42 -0800 (PST) From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= To: Jonathan Woithe , Darren Hart Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/4] platform/x86: fujitsu-laptop: break up complex loop condition Date: Wed, 11 Jan 2017 09:59:32 +0100 Message-Id: <20170111085933.2486-4-kernel@kempniu.pl> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170111085933.2486-1-kernel@kempniu.pl> References: <20170111085933.2486-1-kernel@kempniu.pl> MIME-Version: 1.0 Sender: platform-driver-x86-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The loop condition in acpi_fujitsu_hotkey_release() includes an assignment, a four-argument function call and a comparison, making it hard to read. Separate the assignment from the comparison to improve readability. Signed-off-by: Michał Kępień Acked-by: Jonathan Woithe --- drivers/platform/x86/fujitsu-laptop.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c index e57d3724d2ce..06653a8594ed 100644 --- a/drivers/platform/x86/fujitsu-laptop.c +++ b/drivers/platform/x86/fujitsu-laptop.c @@ -1054,11 +1054,13 @@ static void acpi_fujitsu_hotkey_release(void) struct input_dev *input = fujitsu_hotkey->input; int keycode, status; - while ((status = kfifo_out_locked(&fujitsu_hotkey->fifo, + while (true) { + status = kfifo_out_locked(&fujitsu_hotkey->fifo, (unsigned char *)&keycode, sizeof(keycode), - &fujitsu_hotkey->fifo_lock)) - == sizeof(keycode)) { + &fujitsu_hotkey->fifo_lock); + if (status != sizeof(keycode)) + return; input_report_key(input, keycode, 0); input_sync(input); vdbg_printk(FUJLAPTOP_DBG_TRACE,