From dc5c7eb4745aa08906595228c53f515ae1656bc0 Mon Sep 17 00:00:00 2001 From: Gilberto Gambugge Date: Tue, 21 Jul 2020 16:46:30 -0300 Subject: [PATCH] focaltech_0_flash: fix bld error due to wakeup API changes On latest 4.19 kernel update, wakeup_source_init API was removed. So replacing it as follows: - wakeup_source_init => wakeup_source_register Also, ensure wake_source_register is compatible with all kernels. NO_PROP_NEEDED: Change-Id: Ic08fa612c3aa8adec0e2f485c9aa85e3a8eacdf1 Reviewed-on: https://gerrit.mot.com/1699262 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Ling Jin Submit-Approved: Sergio Vilela --- .../focaltech_0flash_mmi/focaltech_gesture.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/input/touchscreen/focaltech_0flash_mmi/focaltech_gesture.c b/drivers/input/touchscreen/focaltech_0flash_mmi/focaltech_gesture.c index a7e30baedbe4..79431d6ff477 100755 --- a/drivers/input/touchscreen/focaltech_0flash_mmi/focaltech_gesture.c +++ b/drivers/input/touchscreen/focaltech_0flash_mmi/focaltech_gesture.c @@ -101,7 +101,7 @@ static struct fts_gesture_st fts_gesture_data; #ifdef CONFIG_HAS_WAKELOCK static struct wake_lock gesture_wakelock; #else -static struct wakeup_source gesture_wakelock; +static struct wakeup_source *gesture_wakelock; #endif static struct sensors_classdev __maybe_unused sensors_touch_cdev = { .name = "dt-gesture", @@ -340,7 +340,7 @@ static void fts_gesture_report(struct input_dev *input_dev, int gesture_id) #ifdef CONFIG_HAS_WAKELOCK wake_lock_timeout(&gesture_wakelock, msecs_to_jiffies(5000)); #else - __pm_wakeup_event(&gesture_wakelock, 5000); + __pm_wakeup_event(gesture_wakelock, 5000); #endif } #else @@ -651,7 +651,15 @@ int fts_gesture_init(struct fts_ts_data *ts_data) #ifdef CONFIG_HAS_WAKELOCK wake_lock_init(&gesture_wakelock, WAKE_LOCK_SUSPEND, "poll-wake-lock"); #else - wakeup_source_init(&gesture_wakelock, "ets_wake_lock"); +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 110)) + gesture_wakelock = wakeup_source_register(ts_data->dev, "poll-wake-lock"); +#else + gesture_wakelock = wakeup_source_register("poll-wake-lock"); +#endif + if (!gesture_wakelock) { + FTS_ERROR("failed to allocate wakeup source\n"); + return -ENOMEM; + } #endif #ifndef CONFIG_INPUT_TOUCHSCREEN_MMI if (!fts_sensor_init(ts_data))