From 0a26d8d2c1135af856e6b9fbdf3ee6176cde6a05 Mon Sep 17 00:00:00 2001 From: Alan Chen Date: Wed, 13 Nov 2019 16:06:01 -0800 Subject: [PATCH] qcacmn: Add conditional macros for creating/destroying wakelocks Kernel 5.4 and 5.1 have removed the functions wakeup_source_init() and wakeup_source_trash() respectively. Add conditional preprocessor directives to use wakeup_source_register() and wakeup_source_unregister() for Kernels 5.4 and 5.1 respectively. Change-Id: I05597eb54b2988f7bc203b53427e17980a7473f9 CRs-Fixed: 2559016 --- qdf/linux/src/qdf_lock.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/qdf/linux/src/qdf_lock.c b/qdf/linux/src/qdf_lock.c index 0c1b19c22d7c..6a541d4163c3 100644 --- a/qdf/linux/src/qdf_lock.c +++ b/qdf/linux/src/qdf_lock.c @@ -265,7 +265,13 @@ qdf_export_symbol(qdf_wake_lock_name); * QDF status success: if wake lock is initialized * QDF status failure: if wake lock was not initialized */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)) +QDF_STATUS qdf_wake_lock_create(qdf_wake_lock_t *lock, const char *name) +{ + wakeup_source_register(lock->dev, name); + return QDF_STATUS_SUCCESS; +} +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)) QDF_STATUS qdf_wake_lock_create(qdf_wake_lock_t *lock, const char *name) { wakeup_source_init(lock, name); @@ -373,7 +379,13 @@ qdf_export_symbol(qdf_wake_lock_release); * QDF status success: if wake lock is acquired * QDF status failure: if wake lock was not acquired */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0)) +QDF_STATUS qdf_wake_lock_destroy(qdf_wake_lock_t *lock) +{ + wakeup_source_unregister(lock); + return QDF_STATUS_SUCCESS; +} +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)) QDF_STATUS qdf_wake_lock_destroy(qdf_wake_lock_t *lock) { wakeup_source_trash(lock);