diff --git a/drivers/media/platform/tegra/camera/vi/graph.c b/drivers/media/platform/tegra/camera/vi/graph.c index 4d71dd12..83fc8b25 100644 --- a/drivers/media/platform/tegra/camera/vi/graph.c +++ b/drivers/media/platform/tegra/camera/vi/graph.c @@ -16,7 +16,6 @@ #include #include #include -#include #include #include #include @@ -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 diff --git a/scripts/conftest/Makefile b/scripts/conftest/Makefile index 2a4bccf8..1199736a 100644 --- a/scripts/conftest/Makefile +++ b/scripts/conftest/Makefile @@ -153,6 +153,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += tty_operations_struct_set_termios_has_cons 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 diff --git a/scripts/conftest/conftest.sh b/scripts/conftest/conftest.sh index eee39cb6..94fa0cfc 100755 --- a/scripts/conftest/conftest.sh +++ b/scripts/conftest/conftest.sh @@ -7526,6 +7526,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 + void conftest_v4l2_async_notifier_init(void) { + v4l2_async_notifier_init(); + }" + + compile_check_conftest "$CODE" "NV_V4L2_ASYNC_NOTIFIER_INIT_PRESENT" "" "functions" + ;; + # When adding a new conftest entry, please use the correct format for # specifying the relevant upstream Linux kernel commit. #