mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] HID: lenovo: Fix undefined platform_profile_cycle in ThinkPad X12 keyboard patch
@ 2025-01-10 14:14 Vishnu Sankar
  2025-01-10 15:05 ` Jiri Kosina
  0 siblings, 1 reply; 3+ messages in thread
From: Vishnu Sankar @ 2025-01-10 14:14 UTC (permalink / raw)
  To: jikos, bentiss, linux-input, linux-kernel
  Cc: mpearson-lenovo, vsankar, Vishnu Sankar

The commit "HID: lenovo: Support for ThinkPad-X12-TAB-1/2 Kbd Fn keys"
introduced an issue where the CI failed with the following error:
ERROR: modpost: "platform_profile_cycle" [drivers/hid/hid-lenovo.ko] undefined!

This issue occurs because platform_profile_cycle is used without ensuring
the kernel is configured with CONFIG_ACPI_PLATFORM_PROFILE.
To address this, this patch adds conditional support for platform profile
management to the Fn+F8 key handling.
The functionality for platform_profile_cycle is now included only when
CONFIG_ACPI_PLATFORM_PROFILE is enabled in the kernel configuration.

This ensures compatibility with kernels that do not include the ACPI
platform profile feature, resolving the CI build issue.

Signed-off-by: Vishnu Sankar <vishnuocv@gmail.com>
Signed-off-by: Vishnu Sankar <vsankar@lenovo.com>
Suggested-by: Benjamin Tissoires <bentiss@kernel.org>
Suggested-by: Jiri Kosina <jikos@kernel.org>
---
 drivers/hid/hid-lenovo.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/hid/hid-lenovo.c b/drivers/hid/hid-lenovo.c
index bfaadd54cba1..4d00bc4d656e 100644
--- a/drivers/hid/hid-lenovo.c
+++ b/drivers/hid/hid-lenovo.c
@@ -31,7 +31,10 @@
 #include <linux/input.h>
 #include <linux/leds.h>
 #include <linux/workqueue.h>
+
+#if IS_ENABLED(CONFIG_ACPI_PLATFORM_PROFILE)
 #include <linux/platform_profile.h>
+#endif /* CONFIG_ACPI_PLATFORM_PROFILE */
 
 #include "hid-ids.h"
 
@@ -724,10 +727,17 @@ static int lenovo_raw_event_TP_X12_tab(struct hid_device *hdev, u32 raw_data)
 			 * Whereas TP X12 TAB2 uses Fn-F8 for toggling
 			 * Power modes
 			 */
-			(hdev->product == USB_DEVICE_ID_LENOVO_X12_TAB) ?
-				report_key_event(input, KEY_RFKILL) :
+			if (hdev->product == USB_DEVICE_ID_LENOVO_X12_TAB) {
+				report_key_event(input, KEY_RFKILL);
+				return 1;
+			}
+#if IS_ENABLED(CONFIG_ACPI_PLATFORM_PROFILE)
+			else {
 				platform_profile_cycle();
-			return 1;
+				return 1;
+			}
+#endif /* CONFIG_ACPI_PLATFORM_PROFILE */
+			return 0;
 		case TP_X12_RAW_HOTKEY_FN_F10:
 			/* TAB1 has PICKUP Phone and TAB2 use Snipping tool*/
 			(hdev->product == USB_DEVICE_ID_LENOVO_X12_TAB) ?
-- 
2.43.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] HID: lenovo: Fix undefined platform_profile_cycle in ThinkPad X12 keyboard patch
  2025-01-10 14:14 [PATCH] HID: lenovo: Fix undefined platform_profile_cycle in ThinkPad X12 keyboard patch Vishnu Sankar
@ 2025-01-10 15:05 ` Jiri Kosina
  2025-01-13 11:30   ` Vishnu Sankar
  0 siblings, 1 reply; 3+ messages in thread
From: Jiri Kosina @ 2025-01-10 15:05 UTC (permalink / raw)
  To: Vishnu Sankar
  Cc: bentiss, linux-input, linux-kernel, mpearson-lenovo, vsankar

On Fri, 10 Jan 2025, Vishnu Sankar wrote:

> The commit "HID: lenovo: Support for ThinkPad-X12-TAB-1/2 Kbd Fn keys"
> introduced an issue where the CI failed with the following error:
> ERROR: modpost: "platform_profile_cycle" [drivers/hid/hid-lenovo.ko] undefined!
> 
> This issue occurs because platform_profile_cycle is used without ensuring
> the kernel is configured with CONFIG_ACPI_PLATFORM_PROFILE.
> To address this, this patch adds conditional support for platform profile
> management to the Fn+F8 key handling.
> The functionality for platform_profile_cycle is now included only when
> CONFIG_ACPI_PLATFORM_PROFILE is enabled in the kernel configuration.
> 
> This ensures compatibility with kernels that do not include the ACPI
> platform profile feature, resolving the CI build issue.

Applied, thanks.

-- 
Jiri Kosina
SUSE Labs


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] HID: lenovo: Fix undefined platform_profile_cycle in ThinkPad X12 keyboard patch
  2025-01-10 15:05 ` Jiri Kosina
@ 2025-01-13 11:30   ` Vishnu Sankar
  0 siblings, 0 replies; 3+ messages in thread
From: Vishnu Sankar @ 2025-01-13 11:30 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: bentiss, linux-input, linux-kernel, mpearson-lenovo, vsankar

Jiri,
Thanks a lot.

On Sat, Jan 11, 2025 at 12:05 AM Jiri Kosina <jikos@kernel.org> wrote:
>
> On Fri, 10 Jan 2025, Vishnu Sankar wrote:
>
> > The commit "HID: lenovo: Support for ThinkPad-X12-TAB-1/2 Kbd Fn keys"
> > introduced an issue where the CI failed with the following error:
> > ERROR: modpost: "platform_profile_cycle" [drivers/hid/hid-lenovo.ko] undefined!
> >
> > This issue occurs because platform_profile_cycle is used without ensuring
> > the kernel is configured with CONFIG_ACPI_PLATFORM_PROFILE.
> > To address this, this patch adds conditional support for platform profile
> > management to the Fn+F8 key handling.
> > The functionality for platform_profile_cycle is now included only when
> > CONFIG_ACPI_PLATFORM_PROFILE is enabled in the kernel configuration.
> >
> > This ensures compatibility with kernels that do not include the ACPI
> > platform profile feature, resolving the CI build issue.
>
> Applied, thanks.
>
> --
> Jiri Kosina
> SUSE Labs
>


-- 

Regards,

      Vishnu Sankar
     +817015150407 (Japan)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-01-13 11:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-10 14:14 [PATCH] HID: lenovo: Fix undefined platform_profile_cycle in ThinkPad X12 keyboard patch Vishnu Sankar
2025-01-10 15:05 ` Jiri Kosina
2025-01-13 11:30   ` Vishnu Sankar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®