mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
video: tegra: nvmap: Use conftest
Instead of relying on kernel version to determine if the register_shrinker() function has the 'fmt' argument, use the conftest.sh script to test if this argument is present at compile time. This is beneficial for working with 3rd party Linux kernels that may have back-ported upstream changes into their kernel and so the kernel version checks do not work. Bug 4119327 Change-Id: I0cbde2dfc2affc41e93eee1f3a195dbc0f8f5667 Signed-off-by: Jon Hunter <jonathanh@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2984429 Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
ae64ed46c8
commit
b272a83282
@@ -7,6 +7,8 @@
|
|||||||
|
|
||||||
#define pr_fmt(fmt) "%s: " fmt, __func__
|
#define pr_fmt(fmt) "%s: " fmt, __func__
|
||||||
|
|
||||||
|
#include <nvidia/conftest.h>
|
||||||
|
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/vmalloc.h>
|
#include <linux/vmalloc.h>
|
||||||
#include <linux/moduleparam.h>
|
#include <linux/moduleparam.h>
|
||||||
@@ -769,7 +771,7 @@ int nvmap_page_pool_init(struct nvmap_device *dev)
|
|||||||
NULL, "nvmap-bz");
|
NULL, "nvmap-bz");
|
||||||
if (IS_ERR(background_allocator))
|
if (IS_ERR(background_allocator))
|
||||||
goto fail;
|
goto fail;
|
||||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)
|
#if defined(NV_REGISTER_SHRINKER_HAS_FMT_ARG) /* Linux v6.0 */
|
||||||
register_shrinker(&nvmap_page_pool_shrinker, "nvmap_pp_shrinker");
|
register_shrinker(&nvmap_page_pool_shrinker, "nvmap_pp_shrinker");
|
||||||
#else
|
#else
|
||||||
register_shrinker(&nvmap_page_pool_shrinker);
|
register_shrinker(&nvmap_page_pool_shrinker);
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_fb_helper_struct_has_info_arg
|
|||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_mode_config_struct_has_fb_base_arg
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_mode_config_struct_has_fb_base_arg
|
||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += iio_dev_opaque_has_mlock
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += iio_dev_opaque_has_mlock
|
||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += iommu_map_has_gfp_arg
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += iommu_map_has_gfp_arg
|
||||||
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += register_shrinker_has_fmt_arg
|
||||||
NV_CONFTEST_GENERIC_COMPILE_TESTS ?=
|
NV_CONFTEST_GENERIC_COMPILE_TESTS ?=
|
||||||
NV_CONFTEST_MACRO_COMPILE_TESTS ?=
|
NV_CONFTEST_MACRO_COMPILE_TESTS ?=
|
||||||
NV_CONFTEST_SYMBOL_COMPILE_TESTS ?=
|
NV_CONFTEST_SYMBOL_COMPILE_TESTS ?=
|
||||||
|
|||||||
@@ -6505,6 +6505,26 @@ compile_test() {
|
|||||||
compile_check_conftest "$CODE" "NV_IIO_DEV_OPAQUE_HAS_LOCK" "" "types"
|
compile_check_conftest "$CODE" "NV_IIO_DEV_OPAQUE_HAS_LOCK" "" "types"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
register_shrinker_has_fmt_arg)
|
||||||
|
#
|
||||||
|
# Determine if the 'register_shrinker' function
|
||||||
|
# has the 'fmt' argument.
|
||||||
|
#
|
||||||
|
# Commit e33c267ab70d ("mm: shrinkers: provide shrinkers with
|
||||||
|
# names") added a 'fmt' argument to the register_shrinker()
|
||||||
|
# function in Linux v6.0.
|
||||||
|
#
|
||||||
|
CODE="
|
||||||
|
#include <linux/atomic.h>
|
||||||
|
#include <linux/compiler_attributes.h>
|
||||||
|
#include <linux/shrinker.h>
|
||||||
|
int conftest_register_shrinker_has_fmt_arg(struct shrinker *s, const char *name) {
|
||||||
|
return register_shrinker(s, name);
|
||||||
|
}"
|
||||||
|
|
||||||
|
compile_check_conftest "$CODE" "NV_REGISTER_SHRINKER_HAS_FMT_ARG" "" "types"
|
||||||
|
;;
|
||||||
|
|
||||||
# When adding a new conftest entry, please use the correct format for
|
# When adding a new conftest entry, please use the correct format for
|
||||||
# specifying the relevant upstream Linux kernel commit.
|
# specifying the relevant upstream Linux kernel commit.
|
||||||
#
|
#
|
||||||
|
|||||||
Reference in New Issue
Block a user