From 048b4ec7277d8358794a894c222dabc1ee378b89 Mon Sep 17 00:00:00 2001 From: Gilberto Gambugge Date: Tue, 21 Jul 2020 16:44:36 -0300 Subject: [PATCH] touch: nt36xxx: fix build 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: I8f3b7a62c0b17456aba18400e00117507f9e1873 Reviewed-on: https://gerrit.mot.com/1699261 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Ling Jin Submit-Approved: Sergio Vilela --- .../touchscreen/nova_0flash_mmi/nt36xxx.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx.c b/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx.c index 15bfb506e8ea..d78fcef19c1c 100644 --- a/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx.c +++ b/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx.c @@ -25,6 +25,7 @@ #include #include #include +#include #if defined(CONFIG_FB) #ifdef CONFIG_DRM_MSM @@ -57,7 +58,7 @@ enum touch_state { #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 = { @@ -1054,7 +1055,7 @@ void nvt_ts_wakeup_gesture_report(uint8_t gesture_id, uint8_t *data) #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 input_report_key(ts->input_dev, keycode, 1); @@ -2010,7 +2011,15 @@ static int32_t nvt_ts_probe(struct spi_device *client) #ifdef CONFIG_HAS_WAKELOCK wake_lock_init(&gesture_wakelock, WAKE_LOCK_SUSPEND, "dt-wake-lock"); #else - wakeup_source_init(&gesture_wakelock, "dt-wake-lock"); +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 110)) + gesture_wakelock = wakeup_source_register(&client->dev, "dt-wake-lock"); +#else + gesture_wakelock = wakeup_source_register("dt-wake-lock"); +#endif + if (!gesture_wakelock) { + NVT_ERR("failed to allocate wakeup source\n"); + goto err_wakeup_source_register_failed; + } #endif if (!nvt_sensor_init(ts)) initialized_sensor = true; @@ -2226,6 +2235,9 @@ err_register_charger_notify_failed: err_charger_detection_alloc_failed: err_charger_notify_wq_failed: free_irq(client->irq, ts); +#ifndef CONFIG_HAS_WAKELOCK +err_wakeup_source_register_failed: +#endif err_int_request_failed: input_unregister_device(ts->input_dev); ts->input_dev = NULL;