From patchwork Sat Sep 19 04:45:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Azael Avalos X-Patchwork-Id: 7221851 Return-Path: X-Original-To: patchwork-platform-driver-x86@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 959FCBEEC1 for ; Sat, 19 Sep 2015 04:45:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A6CC320830 for ; Sat, 19 Sep 2015 04:45:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A4CDD2082D for ; Sat, 19 Sep 2015 04:45:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751020AbbISEpm (ORCPT ); Sat, 19 Sep 2015 00:45:42 -0400 Received: from mail-oi0-f45.google.com ([209.85.218.45]:35671 "EHLO mail-oi0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750949AbbISEpl (ORCPT ); Sat, 19 Sep 2015 00:45:41 -0400 Received: by oiww128 with SMTP id w128so36433088oiw.2; Fri, 18 Sep 2015 21:45:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=koM/okvbHWfhCVnQjTz+EruPkbQ0n91LRG8Ukum8bUE=; b=oQRTpb2R3f7GXEBm5WI7hHQMpCbl+mM7nCbPYwHh5dB1CiIgjlAGWfRUYwL8Aq4PSG ePygjKDzgfOjvVfZgy1ycRdJ4ryo+SXFIFqpw5Ik3oO73b77tYT7zELPNm4QhPVzhuQg B0G5nPlhn+k1lV2ipGGzfVDbHNMGLDF2bHzNF8y7QyvS01UC1PhngaRWjIwN62zXoaXX qAt1yAtl4dRtxnau+cRM2a03ovE4vbEZLxXXCrLSwpB+fIgZ7vSccVODdGwRPaQF/n1J /xZjZydrssIeGl8u8FZfRRTy15QefnjF3o+pllUdKFQj9Qc8gFPqSVor/U8mcYSN2sAf BBwQ== X-Received: by 10.202.198.131 with SMTP id w125mr5616102oif.10.1442637940430; Fri, 18 Sep 2015 21:45:40 -0700 (PDT) Received: from Shakuras.scurra.org (148-240-211-215.ftth.dynamic.axtel.net. [148.240.211.215]) by smtp.gmail.com with ESMTPSA id x70sm5925374oie.26.2015.09.18.21.45.38 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 18 Sep 2015 21:45:39 -0700 (PDT) From: Azael Avalos To: Darren Hart , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Azael Avalos Subject: [PATCH v2] toshiba_acpi: Remove unneeded u32 variables from *setup_keyboard Date: Fri, 18 Sep 2015 22:45:34 -0600 Message-Id: <1442637935-5136-1-git-send-email-coproscefalo@gmail.com> X-Mailer: git-send-email 2.5.1 Sender: platform-driver-x86-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The function toshiba_acpi_setup_keyboard currently has two u32 variables used to store the Hotkey Event Type and the result of the HCI_SYSTEM_EVENT query. This patch removes those two variables, as we already have a global variable named "hotkey_event_type" and the result of the HCI_SYSTEM_EVENT query can be checked directly from the function. Signed-off-by: Azael Avalos --- Changes since v1: - Effectively remove unneeded braces to avoid compiler errors I forgot to respin the patch with the changes when compile tested this patch, sorry for the noise :-) drivers/platform/x86/toshiba_acpi.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c index 803e967..0824f18 100644 --- a/drivers/platform/x86/toshiba_acpi.c +++ b/drivers/platform/x86/toshiba_acpi.c @@ -2381,8 +2381,6 @@ static int toshiba_acpi_setup_keyboard(struct toshiba_acpi_dev *dev) { const struct key_entry *keymap = toshiba_acpi_keymap; acpi_handle ec_handle; - u32 events_type; - u32 hci_result; int error; if (wmi_has_guid(TOSHIBA_WMI_EVENT_GUID)) { @@ -2394,11 +2392,9 @@ static int toshiba_acpi_setup_keyboard(struct toshiba_acpi_dev *dev) if (error) return error; - if (toshiba_hotkey_event_type_get(dev, &events_type)) + if (toshiba_hotkey_event_type_get(dev, &dev->hotkey_event_type)) pr_notice("Unable to query Hotkey Event Type\n"); - dev->hotkey_event_type = events_type; - dev->hotkey_dev = input_allocate_device(); if (!dev->hotkey_dev) return -ENOMEM; @@ -2407,14 +2403,15 @@ static int toshiba_acpi_setup_keyboard(struct toshiba_acpi_dev *dev) dev->hotkey_dev->phys = "toshiba_acpi/input0"; dev->hotkey_dev->id.bustype = BUS_HOST; - if (events_type == HCI_SYSTEM_TYPE1 || + if (dev->hotkey_event_type == HCI_SYSTEM_TYPE1 || !dev->kbd_function_keys_supported) keymap = toshiba_acpi_keymap; - else if (events_type == HCI_SYSTEM_TYPE2 || + else if (dev->hotkey_event_type == HCI_SYSTEM_TYPE2 || dev->kbd_function_keys_supported) keymap = toshiba_acpi_alt_keymap; else - pr_info("Unknown event type received %x\n", events_type); + pr_info("Unknown event type received %x\n", + dev->hotkey_event_type); error = sparse_keymap_setup(dev->hotkey_dev, keymap, NULL); if (error) goto err_free_dev; @@ -2445,11 +2442,8 @@ static int toshiba_acpi_setup_keyboard(struct toshiba_acpi_dev *dev) */ if (acpi_has_method(dev->acpi_dev->handle, "INFO")) dev->info_supported = 1; - else { - hci_result = hci_write(dev, HCI_SYSTEM_EVENT, 1); - if (hci_result == TOS_SUCCESS) - dev->system_event_supported = 1; - } + else if (hci_write(dev, HCI_SYSTEM_EVENT, 1) == TOS_SUCCESS) + dev->system_event_supported = 1; if (!dev->info_supported && !dev->system_event_supported) { pr_warn("No hotkey query interface found\n");