Fix build on 6.0 kernel

This commit is contained in:
zhanghua000 2022-10-15 15:34:44 +08:00 committed by Christian Hoff
parent 2325d6fe45
commit cd66055f6d
2 changed files with 9 additions and 0 deletions

View File

@ -874,7 +874,11 @@ static int __init ashmem_init(void)
return ret; return ret;
} }
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,0,0))
register_shrinker(&ashmem_shrinker, "android-ashmem");
#else
register_shrinker(&ashmem_shrinker); register_shrinker(&ashmem_shrinker);
#endif
return 0; return 0;
} }

View File

@ -23,6 +23,7 @@
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <linux/highmem.h> #include <linux/highmem.h>
#include <linux/sizes.h> #include <linux/sizes.h>
#include <linux/version.h>
#include "binder_alloc.h" #include "binder_alloc.h"
#include "binder_trace.h" #include "binder_trace.h"
@ -1079,7 +1080,11 @@ int binder_alloc_shrinker_init(void)
int ret = list_lru_init(&binder_alloc_lru); int ret = list_lru_init(&binder_alloc_lru);
if (ret == 0) { if (ret == 0) {
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,0,0))
ret = register_shrinker(&binder_shrinker, "android-binder");
#else
ret = register_shrinker(&binder_shrinker); ret = register_shrinker(&binder_shrinker);
#endif
if (ret) if (ret)
list_lru_destroy(&binder_alloc_lru); list_lru_destroy(&binder_alloc_lru);
} }