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
This commit is contained in:
Alan Chen
2019-11-13 16:06:01 -08:00
committed by nshrivas
parent a9d46ad930
commit 0a26d8d2c1

View File

@@ -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);