Skip to content

Commit 52e7d1f

Browse files
vishnuocvJiri Kosina
authored andcommitted
HID: lenovo: Fix undefined platform_profile_cycle in ThinkPad X12 keyboard patch
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> Signed-off-by: Jiri Kosina <jkosina@suse.com>
1 parent 84c9d2a commit 52e7d1f

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

drivers/hid/hid-lenovo.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@
3131
#include <linux/input.h>
3232
#include <linux/leds.h>
3333
#include <linux/workqueue.h>
34+
35+
#if IS_ENABLED(CONFIG_ACPI_PLATFORM_PROFILE)
3436
#include <linux/platform_profile.h>
37+
#endif /* CONFIG_ACPI_PLATFORM_PROFILE */
3538

3639
#include "hid-ids.h"
3740

@@ -724,10 +727,17 @@ static int lenovo_raw_event_TP_X12_tab(struct hid_device *hdev, u32 raw_data)
724727
* Whereas TP X12 TAB2 uses Fn-F8 for toggling
725728
* Power modes
726729
*/
727-
(hdev->product == USB_DEVICE_ID_LENOVO_X12_TAB) ?
728-
report_key_event(input, KEY_RFKILL) :
730+
if (hdev->product == USB_DEVICE_ID_LENOVO_X12_TAB) {
731+
report_key_event(input, KEY_RFKILL);
732+
return 1;
733+
}
734+
#if IS_ENABLED(CONFIG_ACPI_PLATFORM_PROFILE)
735+
else {
729736
platform_profile_cycle();
730-
return 1;
737+
return 1;
738+
}
739+
#endif /* CONFIG_ACPI_PLATFORM_PROFILE */
740+
return 0;
731741
case TP_X12_RAW_HOTKEY_FN_F10:
732742
/* TAB1 has PICKUP Phone and TAB2 use Snipping tool*/
733743
(hdev->product == USB_DEVICE_ID_LENOVO_X12_TAB) ?

0 commit comments

Comments
 (0)