From f9360f364fa864202931b3b4e3d1cc1e34cf3012 Mon Sep 17 00:00:00 2001 From: Jon Hunter Date: Mon, 13 Nov 2023 18:03:48 +0000 Subject: [PATCH] tegra: hwpm: Use conftest for get_user_pages The conftest script already has a test for checking which variant of the get_user_pages() function is present in the kernel. So use the definition generated by conftest to select which function variant is used. Bug 4276500 Change-Id: I29d216c8cead657c1daca4ce11b3dc3f74928467 Signed-off-by: Jon Hunter Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3015357 Reviewed-by: Vedashree Vidwans GVS: Gerrit_Virtual_Submit --- drivers/tegra/hwpm/os/linux/mem_mgmt_utils.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/tegra/hwpm/os/linux/mem_mgmt_utils.c b/drivers/tegra/hwpm/os/linux/mem_mgmt_utils.c index 6785015..e7557c1 100644 --- a/drivers/tegra/hwpm/os/linux/mem_mgmt_utils.c +++ b/drivers/tegra/hwpm/os/linux/mem_mgmt_utils.c @@ -467,12 +467,12 @@ int tegra_hwpm_map_update_allowlist(struct tegra_soc_hwpm *hwpm, goto fail; } -#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 5, 0)) - pinned_pages = get_user_pages(user_va & PAGE_MASK, - hwpm->alist_map->num_pages, 0, hwpm->alist_map->pages, NULL); -#else +#if defined(NV_GET_USER_PAGES_HAS_ARGS_FLAGS) /* Linux v6.5 */ pinned_pages = get_user_pages(user_va & PAGE_MASK, hwpm->alist_map->num_pages, 0, hwpm->alist_map->pages); +#else + pinned_pages = get_user_pages(user_va & PAGE_MASK, + hwpm->alist_map->num_pages, 0, hwpm->alist_map->pages, NULL); #endif if (pinned_pages != hwpm->alist_map->num_pages) { tegra_hwpm_err(hwpm, "Requested %llu pages / Got %ld pages",