video: tegra: nvmap: Fix f_count for Linux v6.13

In Linux v6.13, 'f_count' has been replaced by 'f_ref' in the 'file'
structure. Use conftest to detect if 'f_ref' is present and update the
NVMAP driver accordingly.

Please note that in most cases we can simply use the 'file_count' macro
for getting the count and this has been supported since Linux v2.6.

Bug 4991705

Change-Id: I3ccaf88bd6c3dca5b364205cf03a577945f62092
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3260939
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
This commit is contained in:
Jon Hunter
2024-10-10 10:16:07 +01:00
parent cb2e183b22
commit b34e2f9554
5 changed files with 29 additions and 8 deletions

View File

@@ -128,6 +128,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += ethtool_ops_get_set_ringparam_has_ringpara
NV_CONFTEST_FUNCTION_COMPILE_TESTS += ethtool_ops_get_set_rxfh_has_rxfh_param_args
NV_CONFTEST_FUNCTION_COMPILE_TESTS += fd_empty
NV_CONFTEST_FUNCTION_COMPILE_TESTS += fd_file
NV_CONFTEST_FUNCTION_COMPILE_TESTS += file_struct_has_f_ref
NV_CONFTEST_FUNCTION_COMPILE_TESTS += folio_entire_mapcount
NV_CONFTEST_FUNCTION_COMPILE_TESTS += genpd_xlate_t_has_const_of_phandle_args
NV_CONFTEST_FUNCTION_COMPILE_TESTS += get_file_rcu_has_double_ptr_file_arg

View File

@@ -7280,6 +7280,22 @@ compile_test() {
compile_check_conftest "$CODE" "NV_FD_FILE_PRESENT" "" "functions"
;;
file_struct_has_f_ref)
#
# Determine if 'struct file' has the 'f_ref' member.
#
# Commit 90ee6ed776c0 ("fs: port files to file_ref") replaced the
# 'f_count' member of 'struct file' with 'f_ref' in Linux v6.13.
#
CODE="
#include <linux/fs.h>
int conftest_file_struct_has_f_ref(void) {
return offsetof(struct file, f_ref);
}"
compile_check_conftest "$CODE" "NV_FILE_STRUCT_HAS_F_REF" "" "types"
;;
folio_entire_mapcount)
#
# Determine if function folio_entire_mapcount() is present.