From 46cb523d95b9a56538b7649e68aa3e4701b3276e Mon Sep 17 00:00:00 2001 From: Gilberto Gambugge Date: Tue, 21 Jul 2020 15:36:35 -0300 Subject: [PATCH] ets_fps: fix build error due to changes in the wakeup API On latest 4.19 kernel update, wakeup_source_init and wake_source_trash APIs were removed. So, replacing them as follows: - wakeup_source_init => wakeup_source_register - wakeup_source_trash => wakeup_source_unregister Also, ensure wake_source_register is compatible with all kernels. NO_PROP_NEEDED: Change-Id: I35d73705252d23aedc2eb6b9ad4dcede0e451f35 Reviewed-on: https://gerrit.mot.com/1699260 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Ling Jin Submit-Approved: Sergio Vilela --- drivers/input/misc/ets_fps_mmi/ets_fps.c | 26 ++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/drivers/input/misc/ets_fps_mmi/ets_fps.c b/drivers/input/misc/ets_fps_mmi/ets_fps.c index 43757c9ab188..cf3e185f1222 100644 --- a/drivers/input/misc/ets_fps_mmi/ets_fps.c +++ b/drivers/input/misc/ets_fps_mmi/ets_fps.c @@ -50,6 +50,8 @@ #include #endif +#include + #include "ets_fps.h" #include "ets_navi_input.h" @@ -65,7 +67,7 @@ #ifdef CONFIG_HAS_WAKELOCK static struct wake_lock ets_wake_lock; #else -static struct wakeup_source ets_wake_lock; +static struct wakeup_source *ets_wake_lock; #endif /* * FPS interrupt table @@ -258,7 +260,7 @@ static irqreturn_t fp_eint_func(int irq, void *dev_id) #ifdef CONFIG_HAS_WAKELOCK wake_lock_timeout(&ets_wake_lock, msecs_to_jiffies(1500)); #else - __pm_wakeup_event(&ets_wake_lock, 1500); + __pm_wakeup_event(ets_wake_lock, 1500); #endif #ifdef CONFIG_DISPLAY_SPEED_UP if (is_auth_ready) { @@ -282,7 +284,7 @@ static irqreturn_t fp_eint_func_ll(int irq, void *dev_id) #ifdef CONFIG_HAS_WAKELOCK wake_lock_timeout(&ets_wake_lock, msecs_to_jiffies(1500)); #else - __pm_wakeup_event(&ets_wake_lock, 1500); + __pm_wakeup_event(ets_wake_lock, 1500); #endif return IRQ_RETVAL(IRQ_HANDLED); } @@ -968,7 +970,7 @@ static int etspi_remove(struct platform_device *pdev) #ifdef CONFIG_HAS_WAKELOCK wake_lock_destroy(&ets_wake_lock); #else - wakeup_source_trash(&ets_wake_lock); + wakeup_source_unregister(ets_wake_lock); #endif del_timer_sync(&fps_ints.timer); etspi_create_device(etspi, false); @@ -1050,7 +1052,16 @@ static int etspi_probe(struct platform_device *pdev) #ifdef CONFIG_HAS_WAKELOCK wake_lock_init(&ets_wake_lock, WAKE_LOCK_SUSPEND, "ets_wake_lock"); #else - wakeup_source_init(&ets_wake_lock, "ets_wake_lock"); +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 110)) + ets_wake_lock = wakeup_source_register(dev, "ets_wake_lock"); +#else + ets_wake_lock = wakeup_source_register("ets_wake_lock"); +#endif + if (!ets_wake_lock) { + pr_err("%s : failed to allocate wakeup source\n", __func__); + status = -ENOMEM; + goto etspi_register_wake_lock_failed; + } #endif DEBUG_PRINT(" add_timer ---- \n"); DEBUG_PRINT("%s : initialize success %d\n", @@ -1076,7 +1087,10 @@ etspi_create_group_failed: #ifdef CONFIG_HAS_WAKELOCK wake_lock_destroy(&ets_wake_lock); #else - wakeup_source_trash(&ets_wake_lock); + wakeup_source_unregister(ets_wake_lock); +#endif +#ifndef CONFIG_HAS_WAKELOCK +etspi_register_wake_lock_failed: #endif del_timer_sync(&fps_ints.timer); etspi_create_device(etspi, false);