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 <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3015357
(cherry picked from commit f9360f364f)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3017317
Reviewed-by: Vedashree Vidwans <vvidwans@nvidia.com>
This commit is contained in:
Jon Hunter
2023-11-13 18:03:48 +00:00
committed by mobile promotions
parent ee08de6166
commit 1e751f52f0

View File

@@ -457,12 +457,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",