From patchwork Sun Jul 2 22:46:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christos Gkekas X-Patchwork-Id: 9821827 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 E354960246 for ; Sun, 2 Jul 2017 22:46:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D92BD21E5A for ; Sun, 2 Jul 2017 22:46:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C9D5B25D9E; Sun, 2 Jul 2017 22:46:50 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, 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 7126E21E5A for ; Sun, 2 Jul 2017 22:46:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752001AbdGBWqt (ORCPT ); Sun, 2 Jul 2017 18:46:49 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:36786 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751983AbdGBWqs (ORCPT ); Sun, 2 Jul 2017 18:46:48 -0400 Received: by mail-wr0-f196.google.com with SMTP id 77so43330322wrb.3; Sun, 02 Jul 2017 15:46:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=cXV15GE/NuZp9kHcf+c/KmPvu7bq9daq7NPH9zYtx+Q=; b=tYBNeYelEQ4qAnRE/n3JVqbFU2CzHcZhsLDaxa23uO1lbuVC5aVJg1ZDwX6eqPCE4y fgoTDZvvjz+2nhAxtFc/pfLr80v3f5XzG98Jg8LnazyeVBZ6XpY1SSJ58yVuKLfuo4ou MHInkrWjfNAY9KL5LFvlDnrGwH3PPvd01nYQiKagc+odKBSOlG7g1oUZpV7He3DGqTKP j9qTaQ94IeJAGf72z+arlJDY3B+aJ79v8Ex78q2GJcF5l7HuR2wF+fVh/ECkctkuxNUO 9ySbrnbOpzz8mEk9XHcYqH9+YRtFR/NOXmvT/pdL+37mk6dAVQqSIddeinSddS/LZUoN 4q0w== 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; bh=cXV15GE/NuZp9kHcf+c/KmPvu7bq9daq7NPH9zYtx+Q=; b=uG35OjUllDJ4GqaODcNttRe22VwbNc4L6tkc/EywF4NTGpbiq9IcQmJzeXlugitLQq 5HlOP+3fuuwJVQaDK6DgtipCfYMrHmxESyp8KqXITAw+DgKFTeGyQ64QcuRvNyTd4HU5 7WC3Ix807x4e1RIt573srDBcNkDfFVZ6/4uWjuI28ViarQoB4zxluw6We/JU70GllU5r rlhwjMMXjuKY4yuRv3otT0oZ2YuiYaimjEbf3XuIi4+UeYqCrL32CDBQ1HqZJHclBMNE neZMZIq9Xac0ZZWv/Y74mpDmGW+Nar66OCdb/wq14WP/kSw1x4pKGKW+KxPpdBFxXd9N kdUA== X-Gm-Message-State: AKS2vOzfEud7zhOXZVcQWjTahMUY8FHZs72EGi9roPSMeN9u7IJ7wUte r/+Mn08gEMl6mQ== X-Received: by 10.223.175.37 with SMTP id z34mr31366858wrc.11.1499035607184; Sun, 02 Jul 2017 15:46:47 -0700 (PDT) Received: from inspiron ([2a02:c7d:5e0c:c300:197f:7023:a78d:9f70]) by smtp.gmail.com with ESMTPSA id q70sm15752562wrb.3.2017.07.02.15.46.46 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 02 Jul 2017 15:46:46 -0700 (PDT) From: Christos Gkekas To: Joe Perches , Jiri Kosina , Benjamin Tissoires , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Christos Gkekas Subject: [PATCH] HID: wacom: Remove comparison of u8 mode with zero and simplify. Date: Sun, 2 Jul 2017 23:46:42 +0100 Message-Id: <1499035602-28437-1-git-send-email-chris.gekas@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Variable mode in method wacom_show_remote_mode() is defined as u8, thus statement (mode >= 0) is always true and should be removed, simplifying the logic. Signed-off-by: Christos Gkekas --- drivers/hid/wacom_sys.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index 838c1eb..ae2408d 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c @@ -1671,10 +1671,7 @@ static ssize_t wacom_show_remote_mode(struct kobject *kobj, u8 mode; mode = wacom->led.groups[index].select; - if (mode >= 0 && mode < 3) - return snprintf(buf, PAGE_SIZE, "%d\n", mode); - else - return snprintf(buf, PAGE_SIZE, "%d\n", -1); + return sprintf(buf, "%d\n", mode < 3 ? mode : -1); } #define DEVICE_EKR_ATTR_GROUP(SET_ID) \