From nobody Mon Apr 6 21:32:31 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 8521F381AED; Tue, 17 Mar 2026 19:45:11 +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=1773776711; cv=none; b=Edz/BVC+NjKjO1gf5Jh+3c+SVmroBO0Ysb+WZIVg9/uZCycL0jW8xJu4detjJVgdRmnvvG2BX2/ixQHFUPYbdy2wMIbPN4k3ip39lp1LWrh6EFaY+GzHSaMKo+vXi6C4o3MZQKvvyQVZXZg27rc3IfUDzaAahCSpWI5PEKZf78k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773776711; c=relaxed/simple; bh=DraGRYCgVkXSiF2Vs+EW70tknAGkeftWiEK4y2PPsgk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=fFirl5JppKPfDcOFP+pta41DO/KuTRIQZE7VwHMXWuXQhVf985Lhe49MdZdOAgUUBU0n3aetKcBlmZf6NOuNYiEcMUcf7YkJ2lMaUyzVrmBbDmNeZFyFShZ5AM93rW4R2Dle9gw3tC7KyFsuzbNjv1+PxjxckGbTCRV05VAn0r8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=iz0H5BBx; 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="iz0H5BBx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65265C2BCAF; Tue, 17 Mar 2026 19:45:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773776711; bh=DraGRYCgVkXSiF2Vs+EW70tknAGkeftWiEK4y2PPsgk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iz0H5BBxvG8227pcr30aDgHN/WW8XI+5YCCvcu/jM526cylb7QHK5zUDVryn2sVXC zdzfCbLwfffj279QNCo0Xec8OPrSLD76r0GMDLtDtTttZo/zOEHG+8+KK7zwbkyt16 haMc51lZnpXQYLnxmDGLLGAkbkHLpVEu+2+2EOm8Htcwxj7wFqWUCQox/igBTrUvki 9yZDLAQdPXLTWOodUHa+/mhXHSdGNuwJUlz/iASDBLE//ctvQtyLM3FEAVpzU+n+F3 2BtZfwi/sX3KxzsgqNWEDfNWv7dL6dBA9aipjIHprVnQ9VXnM0cvJljfBzTB43EY1U ps83AbtDZCiTw== 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 v3 2/5] platform/x86: fujitsu: Reorder code to avoid forward declarations Date: Tue, 17 Mar 2026 20:40:02 +0100 Message-ID: <1950259.tdWV9SEqCh@rafael.j.wysocki> Organization: Linux Kernel Development In-Reply-To: <5085647.31r3eYUQgx@rafael.j.wysocki> References: <5085647.31r3eYUQgx@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. Acked-by: Jonathan Woithe Signed-off-by: Rafael J. Wysocki --- v1 -> v3: 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