From nobody Thu Apr 9 10:42:49 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5823E3E715E; Mon, 9 Mar 2026 17:11:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773076298; cv=none; b=gPzv+cpr0fD7oNeY4gEuSnV7uVye3MtiwsKOyodFs6gBINwIqLhvedAhG/TvCfvQgFJZ1NbX2ggpi1lJA+S4l3ZeyhrZrpOgS6PgnCHM+Vl5bxmfdHixlFgLXOCRptL9mVvp5kxq+sE3spI3buYSRXmRKCMbnrctTJwbGE/2/XI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773076298; c=relaxed/simple; bh=HAKaWRP+YTCtaUrWplUJK5PdjI3gm83NIBXQ8fsBmhM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=XszGOCW+cAUyea1+G8woAdV/EZgmZoHzCQWwfnRCWI3VMdE+b8mZGd+XJay1HAfQyXVab+YgFESFl4TQPBzeuj3yb8+QjUS/VZ0g9qguo+jBUNrgjhWX3nlp8rJGmRTpGIKtOWAW5huNBIrII6ynagO+rclbdNGgd9PRqKBGCro= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GGQ66qms; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GGQ66qms" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7C151C2BCAF; Mon, 9 Mar 2026 17:11:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773076298; bh=HAKaWRP+YTCtaUrWplUJK5PdjI3gm83NIBXQ8fsBmhM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GGQ66qmscIicNYBSilyze8eX1RAPK4nEUvlgFj3zTrXaqJsLEHEf2Xhcd5pKl4ZCv 06cixlKnuNnvUSbmsL/pW6xVSawJbLTBLvnU4fFhmbxUy5bArO9oveQK9h2kuayUeD mEv1JmfR7n5N8U+7VDZr3V71R/sqOieng0P6FCwYGSkeTlhpCS5T8wrlou9X4ZRgYk CTL5GB006HrGGzwyRd4QlNd3fz+L9s3k8tUJr/KEfGry8UFKiqkBTxPTXdk6fv9TyA HkeYhkhxgF3TestlKj57JjTGyQxmPBBRjiDRLiNdWUndYkzdAbF6EH0xjexe4UBdJa 7x0Pma13a1asQ== From: "Rafael J. Wysocki" To: Ilpo =?ISO-8859-1?Q?J=E4rvinen?= Cc: Robert Gerlach , Hans de Goede , LKML , Linux ACPI , platform-driver-x86@vger.kernel.org, Jonathan Woithe Subject: [PATCH v2 2/5] platform/x86: fujitsu: Reorder code to avoid forward declarations Date: Mon, 09 Mar 2026 18:05:18 +0100 Message-ID: <4730334.LvFx2qVVIh@rafael.j.wysocki> Organization: Linux Kernel Development In-Reply-To: <12863082.O9o76ZdvQC@rafael.j.wysocki> References: <12863082.O9o76ZdvQC@rafael.j.wysocki> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: "Rafael J. Wysocki" Move the definitions of acpi_fujitsu_bl_notify() and acpi_fujitsu_laptop_notify() along with some helpers above the definitions of the functions that will refer to them after subsequent changes, to avoid having to add forward declarations of them. No intentional functional impact. Signed-off-by: Rafael J. Wysocki --- v1 -> v2: No changes --- drivers/platform/x86/fujitsu-laptop.c | 216 +++++++++++++------------- 1 file changed, 108 insertions(+), 108 deletions(-) diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/f= ujitsu-laptop.c index 931fbcdd21b8..1adce90ae3e6 100644 --- a/drivers/platform/x86/fujitsu-laptop.c +++ b/drivers/platform/x86/fujitsu-laptop.c @@ -500,6 +500,36 @@ static int fujitsu_backlight_register(struct acpi_devi= ce *device) return 0; } =20 +/* Brightness notify */ + +static void acpi_fujitsu_bl_notify(struct acpi_device *device, u32 event) +{ + struct fujitsu_bl *priv =3D acpi_driver_data(device); + int oldb, newb; + + if (event !=3D ACPI_FUJITSU_NOTIFY_CODE) { + acpi_handle_info(device->handle, "unsupported event [0x%x]\n", + event); + sparse_keymap_report_event(priv->input, -1, 1, true); + return; + } + + oldb =3D priv->brightness_level; + get_lcd_level(device); + newb =3D priv->brightness_level; + + acpi_handle_debug(device->handle, + "brightness button event [%i -> %i]\n", oldb, newb); + + if (oldb =3D=3D newb) + return; + + if (!disable_brightness_adjust) + set_lcd_level(device, newb); + + sparse_keymap_report_event(priv->input, oldb < newb, 1, true); +} + static int acpi_fujitsu_bl_add(struct acpi_device *device) { struct fujitsu_bl *priv; @@ -531,36 +561,6 @@ static int acpi_fujitsu_bl_add(struct acpi_device *dev= ice) return fujitsu_backlight_register(device); } =20 -/* Brightness notify */ - -static void acpi_fujitsu_bl_notify(struct acpi_device *device, u32 event) -{ - struct fujitsu_bl *priv =3D acpi_driver_data(device); - int oldb, newb; - - if (event !=3D ACPI_FUJITSU_NOTIFY_CODE) { - acpi_handle_info(device->handle, "unsupported event [0x%x]\n", - event); - sparse_keymap_report_event(priv->input, -1, 1, true); - return; - } - - oldb =3D priv->brightness_level; - get_lcd_level(device); - newb =3D priv->brightness_level; - - acpi_handle_debug(device->handle, - "brightness button event [%i -> %i]\n", oldb, newb); - - if (oldb =3D=3D newb) - return; - - if (!disable_brightness_adjust) - set_lcd_level(device, newb); - - sparse_keymap_report_event(priv->input, oldb < newb, 1, true); -} - /* ACPI device for hotkey handling */ =20 static const struct key_entry keymap_default[] =3D { @@ -908,6 +908,84 @@ static int acpi_fujitsu_laptop_leds_register(struct ac= pi_device *device) return 0; } =20 +static void acpi_fujitsu_laptop_press(struct acpi_device *device, int scan= code) +{ + struct fujitsu_laptop *priv =3D acpi_driver_data(device); + int ret; + + ret =3D kfifo_in_locked(&priv->fifo, (unsigned char *)&scancode, + sizeof(scancode), &priv->fifo_lock); + if (ret !=3D sizeof(scancode)) { + dev_info(&priv->input->dev, "Could not push scancode [0x%x]\n", + scancode); + return; + } + sparse_keymap_report_event(priv->input, scancode, 1, false); + dev_dbg(&priv->input->dev, "Push scancode into ringbuffer [0x%x]\n", + scancode); +} + +static void acpi_fujitsu_laptop_release(struct acpi_device *device) +{ + struct fujitsu_laptop *priv =3D acpi_driver_data(device); + int scancode, ret; + + while (true) { + ret =3D kfifo_out_locked(&priv->fifo, (unsigned char *)&scancode, + sizeof(scancode), &priv->fifo_lock); + if (ret !=3D sizeof(scancode)) + return; + sparse_keymap_report_event(priv->input, scancode, 0, false); + dev_dbg(&priv->input->dev, + "Pop scancode from ringbuffer [0x%x]\n", scancode); + } +} + +static void acpi_fujitsu_laptop_notify(struct acpi_device *device, u32 eve= nt) +{ + struct fujitsu_laptop *priv =3D acpi_driver_data(device); + unsigned long flags; + int scancode, i =3D 0; + unsigned int irb; + + if (event !=3D ACPI_FUJITSU_NOTIFY_CODE) { + acpi_handle_info(device->handle, "Unsupported event [0x%x]\n", + event); + sparse_keymap_report_event(priv->input, -1, 1, true); + return; + } + + if (priv->flags_supported) + priv->flags_state =3D call_fext_func(device, FUNC_FLAGS, 0x4, 0x0, + 0x0); + + while ((irb =3D call_fext_func(device, + FUNC_BUTTONS, 0x1, 0x0, 0x0)) !=3D 0 && + i++ < MAX_HOTKEY_RINGBUFFER_SIZE) { + scancode =3D irb & 0x4ff; + if (sparse_keymap_entry_from_scancode(priv->input, scancode)) + acpi_fujitsu_laptop_press(device, scancode); + else if (scancode =3D=3D 0) + acpi_fujitsu_laptop_release(device); + else + acpi_handle_info(device->handle, + "Unknown GIRB result [%x]\n", irb); + } + + /* + * First seen on the Skylake-based Lifebook E736/E746/E756), the + * touchpad toggle hotkey (Fn+F4) is handled in software. Other models + * have since added additional "soft keys". These are reported in the + * status flags queried using FUNC_FLAGS. + */ + if (priv->flags_supported & (FLAG_SOFTKEYS)) { + flags =3D call_fext_func(device, FUNC_FLAGS, 0x1, 0x0, 0x0); + flags &=3D (FLAG_SOFTKEYS); + for_each_set_bit(i, &flags, BITS_PER_LONG) + sparse_keymap_report_event(priv->input, BIT(i), 1, true); + } +} + static int acpi_fujitsu_laptop_add(struct acpi_device *device) { struct fujitsu_laptop *priv; @@ -1001,84 +1079,6 @@ static void acpi_fujitsu_laptop_remove(struct acpi_d= evice *device) kfifo_free(&priv->fifo); } =20 -static void acpi_fujitsu_laptop_press(struct acpi_device *device, int scan= code) -{ - struct fujitsu_laptop *priv =3D acpi_driver_data(device); - int ret; - - ret =3D kfifo_in_locked(&priv->fifo, (unsigned char *)&scancode, - sizeof(scancode), &priv->fifo_lock); - if (ret !=3D sizeof(scancode)) { - dev_info(&priv->input->dev, "Could not push scancode [0x%x]\n", - scancode); - return; - } - sparse_keymap_report_event(priv->input, scancode, 1, false); - dev_dbg(&priv->input->dev, "Push scancode into ringbuffer [0x%x]\n", - scancode); -} - -static void acpi_fujitsu_laptop_release(struct acpi_device *device) -{ - struct fujitsu_laptop *priv =3D acpi_driver_data(device); - int scancode, ret; - - while (true) { - ret =3D kfifo_out_locked(&priv->fifo, (unsigned char *)&scancode, - sizeof(scancode), &priv->fifo_lock); - if (ret !=3D sizeof(scancode)) - return; - sparse_keymap_report_event(priv->input, scancode, 0, false); - dev_dbg(&priv->input->dev, - "Pop scancode from ringbuffer [0x%x]\n", scancode); - } -} - -static void acpi_fujitsu_laptop_notify(struct acpi_device *device, u32 eve= nt) -{ - struct fujitsu_laptop *priv =3D acpi_driver_data(device); - unsigned long flags; - int scancode, i =3D 0; - unsigned int irb; - - if (event !=3D ACPI_FUJITSU_NOTIFY_CODE) { - acpi_handle_info(device->handle, "Unsupported event [0x%x]\n", - event); - sparse_keymap_report_event(priv->input, -1, 1, true); - return; - } - - if (priv->flags_supported) - priv->flags_state =3D call_fext_func(device, FUNC_FLAGS, 0x4, 0x0, - 0x0); - - while ((irb =3D call_fext_func(device, - FUNC_BUTTONS, 0x1, 0x0, 0x0)) !=3D 0 && - i++ < MAX_HOTKEY_RINGBUFFER_SIZE) { - scancode =3D irb & 0x4ff; - if (sparse_keymap_entry_from_scancode(priv->input, scancode)) - acpi_fujitsu_laptop_press(device, scancode); - else if (scancode =3D=3D 0) - acpi_fujitsu_laptop_release(device); - else - acpi_handle_info(device->handle, - "Unknown GIRB result [%x]\n", irb); - } - - /* - * First seen on the Skylake-based Lifebook E736/E746/E756), the - * touchpad toggle hotkey (Fn+F4) is handled in software. Other models - * have since added additional "soft keys". These are reported in the - * status flags queried using FUNC_FLAGS. - */ - if (priv->flags_supported & (FLAG_SOFTKEYS)) { - flags =3D call_fext_func(device, FUNC_FLAGS, 0x1, 0x0, 0x0); - flags &=3D (FLAG_SOFTKEYS); - for_each_set_bit(i, &flags, BITS_PER_LONG) - sparse_keymap_report_event(priv->input, BIT(i), 1, true); - } -} - /* Initialization */ =20 static const struct acpi_device_id fujitsu_bl_device_ids[] =3D { --=20 2.51.0