Received: by 10.223.185.116 with SMTP id b49csp244061wrg; Mon, 19 Feb 2018 21:26:42 -0800 (PST) X-Google-Smtp-Source: AH8x224wOcMUi9YHa4m9nd9t891r2WZptXBs5sNJaSVMRWJCEgQmXw3Ek0wxdzzm9BVWUQ5IWcM3 X-Received: by 10.98.49.7 with SMTP id x7mr17006787pfx.101.1519104401908; Mon, 19 Feb 2018 21:26:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519104401; cv=none; d=google.com; s=arc-20160816; b=xddKTrzQ6f1LODA3k77EEDpIhvIUtEakYQiMMXwHNcuK2lBL7PTJMEPhQqpv2eVBM7 ubZl72KhZEYJLyeeMwVJ7mf7exLtkXZQSkTo+hqKYlQJoKrUIfprSbrG2ReLjBV5LviO 5QtBjEnSeET574F4yGx1vqrKuHBvu2xQsTErbLBKPyQXQuN70Nf8v8tSWals0yAvFtQe 0Xqg3v4E+/DGm/amGSuHGoObJDFBYxxhwLJu0h/bGbckHqaDEM2l/w6V6Fr03b6raq6p lqujd7k56zOfxb3RBgGUozc/tvs6BSGq2ycfISJdn4o9FZbt177wBBdeIvvGLfyWI6YT pVuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=Odb8YomgLDiZS5y7ihk7Ib0HDMkDp0XBzG7kqvj4ZAk=; b=lihg+zaC62ViwV3vV62dQK7bDiJQjc8BEEYcWLl63CLFOfBp02mHPFeBt60xapPfnb eq6qJ8mjh2feO9QSWT4Wc0q5H4ynw2jZPJUB98cEwM8SYNYF78JbSNDWYI3NLurjT65M Z3qGVDikJqqUVuagQ82nzbSwwPT+7OubIgvBur+cvFC/fSOMCYmL1i5AJMdHImRsv5il HDg661DOMRYuHEYYp0saH+O2KpSuZci8Bi5kLhGJ+0yKij4kpUlzNVhEoeEzdlPgnpP5 B0wCl79If0l5tNbBmxZo2atwdTD3dFBTh9vqaS1dy6MqQzbe6CU2yActLBuFQ54KJV/+ /Wew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kempniu.pl header.s=google header.b=f9lWZWNs; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=kempniu.pl Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f16si634220pga.41.2018.02.19.21.26.18; Mon, 19 Feb 2018 21:26:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kempniu.pl header.s=google header.b=f9lWZWNs; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=kempniu.pl Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751351AbeBTFZ1 (ORCPT + 99 others); Tue, 20 Feb 2018 00:25:27 -0500 Received: from mail-lf0-f66.google.com ([209.85.215.66]:42835 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751274AbeBTFZK (ORCPT ); Tue, 20 Feb 2018 00:25:10 -0500 Received: by mail-lf0-f66.google.com with SMTP id t204so2429527lff.9 for ; Mon, 19 Feb 2018 21:25:09 -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=Odb8YomgLDiZS5y7ihk7Ib0HDMkDp0XBzG7kqvj4ZAk=; b=f9lWZWNsDR1NSORKdpFQVq6tmTEU25k10a2HAWjhU53tMfmwxrc+Q4wJskvN1kSCM+ 1VdGJXWVJgg8fnnWfv0iLLN8lJBMHFzxrqjfqM+oupHtyvXHN2Og5UHW1DaqmBFiAXBp yg0nLBn3bBX+E0EMa36NY7kr5lvJh1ceDdE/Q= 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=Odb8YomgLDiZS5y7ihk7Ib0HDMkDp0XBzG7kqvj4ZAk=; b=YIwuOBKyRFZkFpHdJdHcYR7p2ashClQKmbmqGy1KjPbGLL3easUvpPWuKywAyv6jDG V3QKKxMtXjhMT4gFfOtNLrLcp4FwiLYADPonw+bycdiK2DmMfKxLp2dJZs643Bb2FPwb nAbPtY2zeqLT67LPStvkK14Iu3Tv6CpamOweBO8NS+5odpUehUokGUnYRsmXCrPTrZ88 tCAjet66ax08TBhjHH/PQuQQLX+jFKzpbdosrKFBY0bsDgre8LxcrTUzg+ox5rrcD3/p O1zMN/5vS+XiBmExT6Uyt8S9wzrUHqu10uG9ePdUIBG01mIROVpId4noERaUnbkP7DWA BgzA== X-Gm-Message-State: APf1xPB3ywXbYvVE5Y6QMoxlwAiOwk9kyNsJCAkR3ZnoNuD7a6dvO2Sg kOw2g6n8ZlpwMERlQ8/g6Eo+VA== X-Received: by 10.46.91.88 with SMTP id p85mr11698619ljb.85.1519104308913; Mon, 19 Feb 2018 21:25:08 -0800 (PST) Received: from kmp-mobile.hq.kempniu.pl (kmp-mobile.hq.kempniu.pl. [2001:470:64df:111::1b01]) by smtp.googlemail.com with ESMTPSA id b27sm3978286ljb.84.2018.02.19.21.25.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Feb 2018 21:25:08 -0800 (PST) From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= To: Jonathan Woithe , Darren Hart , Andy Shevchenko Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 7/7] platform/x86: fujitsu-laptop: Clean up constants Date: Tue, 20 Feb 2018 06:24:54 +0100 Message-Id: <20180220052454.11134-8-kernel@kempniu.pl> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180220052454.11134-1-kernel@kempniu.pl> References: <20180220052454.11134-1-kernel@kempniu.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Align all constant values defined in the module to a common indentation. Rename ACPI_FUJITSU_NOTIFY_CODE1 to ACPI_FUJITSU_NOTIFY_CODE as there is only one ACPI notification code used throughout the driver. Define all bitmasks using the BIT() macro. Clean up comments. Signed-off-by: Michał Kępień --- drivers/platform/x86/fujitsu-laptop.c | 66 ++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c index 6b0484cbdcf2..13bcdfea5349 100644 --- a/drivers/platform/x86/fujitsu-laptop.c +++ b/drivers/platform/x86/fujitsu-laptop.c @@ -53,6 +53,7 @@ #include #include #include +#include #include #include #include @@ -63,9 +64,9 @@ #include #include -#define FUJITSU_DRIVER_VERSION "0.6.0" +#define FUJITSU_DRIVER_VERSION "0.6.0" -#define FUJITSU_LCD_N_LEVELS 8 +#define FUJITSU_LCD_N_LEVELS 8 #define ACPI_FUJITSU_CLASS "fujitsu" #define ACPI_FUJITSU_BL_HID "FUJ02B1" @@ -75,46 +76,47 @@ #define ACPI_FUJITSU_LAPTOP_DRIVER_NAME "Fujitsu laptop FUJ02E3 ACPI hotkeys driver" #define ACPI_FUJITSU_LAPTOP_DEVICE_NAME "Fujitsu FUJ02E3" -#define ACPI_FUJITSU_NOTIFY_CODE1 0x80 +#define ACPI_FUJITSU_NOTIFY_CODE 0x80 /* FUNC interface - command values */ -#define FUNC_FLAGS 0x1000 -#define FUNC_LEDS 0x1001 -#define FUNC_BUTTONS 0x1002 -#define FUNC_BACKLIGHT 0x1004 +#define FUNC_FLAGS BIT(12) +#define FUNC_LEDS (BIT(12) | BIT(0)) +#define FUNC_BUTTONS (BIT(12) | BIT(1)) +#define FUNC_BACKLIGHT (BIT(12) | BIT(2)) /* FUNC interface - responses */ -#define UNSUPPORTED_CMD 0x80000000 +#define UNSUPPORTED_CMD BIT(31) /* FUNC interface - status flags */ -#define FLAG_RFKILL 0x020 -#define FLAG_LID 0x100 -#define FLAG_DOCK 0x200 +#define FLAG_RFKILL BIT(5) +#define FLAG_LID BIT(8) +#define FLAG_DOCK BIT(9) /* FUNC interface - LED control */ -#define FUNC_LED_OFF 0x1 -#define FUNC_LED_ON 0x30001 -#define KEYBOARD_LAMPS 0x100 -#define LOGOLAMP_POWERON 0x2000 -#define LOGOLAMP_ALWAYS 0x4000 -#define RADIO_LED_ON 0x20 -#define ECO_LED 0x10000 -#define ECO_LED_ON 0x80000 +#define FUNC_LED_OFF BIT(0) +#define FUNC_LED_ON (BIT(0) | BIT(16) | BIT(17)) +#define LOGOLAMP_POWERON BIT(13) +#define LOGOLAMP_ALWAYS BIT(14) +#define KEYBOARD_LAMPS BIT(8) +#define RADIO_LED_ON BIT(5) +#define ECO_LED BIT(16) +#define ECO_LED_ON BIT(19) /* FUNC interface - backlight power control */ -#define BACKLIGHT_PARAM_POWER 0x4 -#define BACKLIGHT_OFF 0x3 -#define BACKLIGHT_ON 0x0 +#define BACKLIGHT_PARAM_POWER BIT(2) +#define BACKLIGHT_OFF (BIT(0) | BIT(1)) +#define BACKLIGHT_ON 0 -/* Hotkey details */ -#define KEY1_CODE 0x410 /* codes for the keys in the GIRB register */ -#define KEY2_CODE 0x411 -#define KEY3_CODE 0x412 -#define KEY4_CODE 0x413 -#define KEY5_CODE 0x420 +/* Scancodes read from the GIRB register */ +#define KEY1_CODE 0x410 +#define KEY2_CODE 0x411 +#define KEY3_CODE 0x412 +#define KEY4_CODE 0x413 +#define KEY5_CODE 0x420 -#define MAX_HOTKEY_RINGBUFFER_SIZE 100 -#define RINGBUFFERSIZE 40 +/* Hotkey ringbuffer limits */ +#define MAX_HOTKEY_RINGBUFFER_SIZE 100 +#define RINGBUFFERSIZE 40 /* Module parameters */ static int use_alt_lcd_levels = -1; @@ -428,7 +430,7 @@ static void acpi_fujitsu_bl_notify(struct acpi_device *device, u32 event) struct fujitsu_bl *priv = acpi_driver_data(device); int oldb, newb; - if (event != ACPI_FUJITSU_NOTIFY_CODE1) { + if (event != ACPI_FUJITSU_NOTIFY_CODE) { acpi_handle_info(device->handle, "unsupported event [0x%x]\n", event); sparse_keymap_report_event(priv->input, -1, 1, true); @@ -902,7 +904,7 @@ static void acpi_fujitsu_laptop_notify(struct acpi_device *device, u32 event) int scancode, i = 0; unsigned int irb; - if (event != ACPI_FUJITSU_NOTIFY_CODE1) { + if (event != ACPI_FUJITSU_NOTIFY_CODE) { acpi_handle_info(device->handle, "Unsupported event [0x%x]\n", event); sparse_keymap_report_event(priv->input, -1, 1, true); -- 2.16.1