From nobody Tue Apr 7 14:03:40 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 8C9202DC789; Wed, 25 Feb 2026 20:57:47 +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=1772053067; cv=none; b=JYhSHZYXUiSHFHpsC19T2z27Hu9XSKCfZscgDWjiNRKOn5a9yW3skHEPfNUkl4Pw/9yS6YkXBBjd6raHiWxuxo1eVs2nPtUk869sOfaAP74jA3Qlz5Ei3UOGDxz7CwgIROP2AbXMTCaxl+U9dB8s6IJOlra/c7oiUsTsmgfMQXk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772053067; c=relaxed/simple; bh=IMfE0cfOnKIywR8ATEzDFw/vfR6sHCczmZkkkucB69o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=k4Qjfdod8HXP3cuQUXycQQlFbu6TcF4YY5a5pwJ0d9JZ4JY/QN9xxUAoA4T1IRc1B6sW95rEn+de0L2gkTTaZU/UIqkMj9oJ5QJx+whbmc8VM98TNR0bScEKUc4MBK7wKHY/fyAFRP7eTKbOcNnijh0x4vN7w4yWO6V33LrnX50= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PNB2/pnI; 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="PNB2/pnI" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CFAE4C19422; Wed, 25 Feb 2026 20:57:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772053067; bh=IMfE0cfOnKIywR8ATEzDFw/vfR6sHCczmZkkkucB69o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PNB2/pnIGAcLCPEHvNIKw0REyqkPG39Vf8dRwJ8zofsUzX2BUz9maGF+epFnXklXT +x0yZGJyI6i11TIukdv4q2POszo2HBo1Ria9GueF8qLYOgP6mIElz20ycaPtnMRQWc RIyCQlzkjnNEFGnqwEgvyzSye2ILqSYN98b0jDjNmJzx29fYj1mXPlnxaUH0LRRWru iwjGRwURiJrFMDj3pKYvYSVE4riWmt6c0mrQxBnYRt1/+231tePTCUqG7ue6+LzuZp MmCt1Ms0l/A4rS1blz2+pxK8DYaRaQIEiJs/ljQF8pXmESW6rCaAbhdTeMTeAyJQF8 lCZ5BaVaZrtcA== 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 v1 2/5] platform/x86: fujitsu: Reorder code to avoid forward declarations Date: Wed, 25 Feb 2026 21:43:52 +0100 Message-ID: <3418006.aeNJFYEL58@rafael.j.wysocki> Organization: Linux Kernel Development In-Reply-To: <1968442.tdWV9SEqCh@rafael.j.wysocki> References: <1968442.tdWV9SEqCh@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 --- 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