camera: Use conftest to find if v4l2_async_notifier_* present

use conftest to determine if APIs v4l2_async_notifier_*()
present or not.
These APIs have been renamed in
commit 3c8c15391481 ("media: v4l: async: Rename async
nf functions, clean up long lines") in Linux 5.16

Bug 4387902

Change-Id: Id2023543f487c3867ef4e140662141803ac63f04
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3037918
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Laxman Dewangan
2023-12-19 09:48:19 +00:00
committed by mobile promotions
parent b40e45535e
commit 702def895c
3 changed files with 20 additions and 4 deletions

View File

@@ -16,7 +16,6 @@
#include <linux/regulator/consumer.h>
#include <linux/reset.h>
#include <linux/slab.h>
#include <linux/version.h>
#include <soc/tegra/fuse.h>
#include <media/media-device.h>
#include <media/v4l2-async.h>
@@ -426,7 +425,7 @@ void tegra_vi_graph_cleanup(struct tegra_mc_vi *vi)
list_for_each_entry(chan, &vi->vi_chans, list) {
#if defined(CONFIG_V4L2_ASYNC)
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
#if defined(NV_V4L2_ASYNC_NOTIFIER_INIT_PRESENT)
v4l2_async_notifier_unregister(&chan->notifier);
#else
v4l2_async_nf_unregister(&chan->notifier);
@@ -667,7 +666,7 @@ int tegra_vi_graph_init(struct tegra_mc_vi *vi)
i = 0;
#if defined(CONFIG_V4L2_ASYNC)
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
#if defined(NV_V4L2_ASYNC_NOTIFIER_INIT_PRESENT)
v4l2_async_notifier_init(&chan->notifier);
list_for_each_entry(entity, &chan->entities, list)
__v4l2_async_notifier_add_subdev(&chan->notifier, &entity->asd);
@@ -694,7 +693,7 @@ int tegra_vi_graph_init(struct tegra_mc_vi *vi)
chan->subdevs_bound = 0;
/* Register the async notifier for this channel */
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
#if defined(NV_V4L2_ASYNC_NOTIFIER_INIT_PRESENT)
ret = v4l2_async_notifier_register(&vi->v4l2_dev,
&chan->notifier);
#else

View File

@@ -160,6 +160,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += ufs_hba_variant_ops_suspend_has_status_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += v4l2_async_connection_struct_present
NV_CONFTEST_FUNCTION_COMPILE_TESTS += v4l2_async_match_type_enum_present
NV_CONFTEST_FUNCTION_COMPILE_TESTS += v4l2_async_subdev_nf_init
NV_CONFTEST_FUNCTION_COMPILE_TESTS += v4l2_async_notifier_init
NV_CONFTEST_FUNCTION_COMPILE_TESTS += vm_area_struct_has_const_vm_flags
NV_CONFTEST_GENERIC_COMPILE_TESTS += is_export_symbol_present_drm_gem_prime_fd_to_handle
NV_CONFTEST_GENERIC_COMPILE_TESTS += is_export_symbol_present_drm_gem_prime_handle_to_fd

View File

@@ -7631,6 +7631,22 @@ compile_test() {
compile_check_conftest "$CODE" "NV_V4L2_ASYNC_SUBDEV_NF_INIT_PRESENT" "" "functions"
;;
v4l2_async_notifier_init)
#
# Determine if the function v4l2_async_notifier_init() present or not.
#
# The API is renamed with commit 3c8c15391481 ("media: v4l: async:
# Rename async nf functions, clean up long lines") in Linux 5.16
#
CODE="
#include <media/v4l2-async.h>
void conftest_v4l2_async_notifier_init(void) {
v4l2_async_notifier_init();
}"
compile_check_conftest "$CODE" "NV_V4L2_ASYNC_NOTIFIER_INIT_PRESENT" "" "functions"
;;
crypto_engine_ctx_struct_removed_test)
#
# Determine if struct 'crypto_engine_ctx' is removed in linux kernel.