drm/tegra: Use conftest for drm_debugfs_remove_files()

The function drm_debugfs_remove_file() has extra argument in
Linux 6.7 with change commit 8e455145d8f16 ("drm/debugfs: rework
drm_debugfs_create_files implementation v2")

Use conftest to findout this new argument presence.

Bug 4346767

Change-Id: I77346a85c8841f915f4a8f3f471af1e03240fa62
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3028576
(cherry picked from commit 1ae406004f)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3031239
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Laxman Dewangan
2023-12-05 11:29:55 +00:00
committed by mobile promotions
parent 5b6fed0199
commit e91b43420c
7 changed files with 37 additions and 34 deletions

View File

@@ -51,12 +51,6 @@ subdir-ccflags-y += -DNV_V4L2_ASYNC_NF_SUBDEVICE_INIT_RENAME
export CONFIG_SKIP_CRYPTO=y export CONFIG_SKIP_CRYPTO=y
endif endif
# Changes done in Linux 6.7 onwards
ifeq ($(shell test $(LINUX_VERSION) -ge $(LINUX_VERSION_6_7); echo $$?),0)
# drm_debugfs_remove_files has root argument
subdir-ccflags-y += -DNV_DRM_DEBUGFS_REMOVE_HAS_ROOT_ARGS
endif
ifeq ($(CONFIG_TEGRA_VIRTUALIZATION),y) ifeq ($(CONFIG_TEGRA_VIRTUALIZATION),y)
subdir-ccflags-y += -DCONFIG_TEGRA_VIRTUALIZATION subdir-ccflags-y += -DCONFIG_TEGRA_VIRTUALIZATION
endif endif

View File

@@ -4,6 +4,8 @@
* Copyright (C) 2012 NVIDIA CORPORATION. All rights reserved. * Copyright (C) 2012 NVIDIA CORPORATION. All rights reserved.
*/ */
#include <nvidia/conftest.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/debugfs.h> #include <linux/debugfs.h>
#include <linux/delay.h> #include <linux/delay.h>
@@ -1746,7 +1748,8 @@ static void tegra_dc_early_unregister(struct drm_crtc *crtc)
unsigned int count = ARRAY_SIZE(debugfs_files); unsigned int count = ARRAY_SIZE(debugfs_files);
struct drm_minor *minor = crtc->dev->primary; struct drm_minor *minor = crtc->dev->primary;
struct tegra_dc *dc = to_tegra_dc(crtc); struct tegra_dc *dc = to_tegra_dc(crtc);
#if defined(NV_DRM_DEBUGFS_REMOVE_HAS_ROOT_ARGS)
#if defined(NV_DRM_DEBUGFS_REMOVE_FILES_HAS_ROOT_ARG) /* Linux v6.7 */
struct dentry *root; struct dentry *root;
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS

View File

@@ -3,6 +3,8 @@
* Copyright (C) 2013 NVIDIA Corporation * Copyright (C) 2013 NVIDIA Corporation
*/ */
#include <nvidia/conftest.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/debugfs.h> #include <linux/debugfs.h>
#include <linux/delay.h> #include <linux/delay.h>
@@ -254,17 +256,11 @@ static void tegra_dsi_early_unregister(struct drm_connector *connector)
struct tegra_output *output = connector_to_output(connector); struct tegra_output *output = connector_to_output(connector);
unsigned int count = ARRAY_SIZE(debugfs_files); unsigned int count = ARRAY_SIZE(debugfs_files);
struct tegra_dsi *dsi = to_dsi(output); struct tegra_dsi *dsi = to_dsi(output);
#if defined(NV_DRM_DEBUGFS_REMOVE_HAS_ROOT_ARGS)
struct dentry *root;
#ifdef CONFIG_DEBUG_FS
root = connector->debugfs_entry;
#else
root = NULL;
#endif
#if defined(NV_DRM_DEBUGFS_REMOVE_FILES_HAS_ROOT_ARG) /* Linux v6.7 */
drm_debugfs_remove_files(dsi->debugfs_files, count, drm_debugfs_remove_files(dsi->debugfs_files, count,
root, connector->dev->primary); connector->debugfs_entry,
connector->dev->primary);
#else #else
drm_debugfs_remove_files(dsi->debugfs_files, count, drm_debugfs_remove_files(dsi->debugfs_files, count,
connector->dev->primary); connector->dev->primary);

View File

@@ -4,6 +4,8 @@
* Copyright (C) 2012 NVIDIA CORPORATION. All rights reserved. * Copyright (C) 2012 NVIDIA CORPORATION. All rights reserved.
*/ */
#include <nvidia/conftest.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/debugfs.h> #include <linux/debugfs.h>
#include <linux/delay.h> #include <linux/delay.h>
@@ -1121,16 +1123,10 @@ static void tegra_hdmi_early_unregister(struct drm_connector *connector)
struct drm_minor *minor = connector->dev->primary; struct drm_minor *minor = connector->dev->primary;
unsigned int count = ARRAY_SIZE(debugfs_files); unsigned int count = ARRAY_SIZE(debugfs_files);
struct tegra_hdmi *hdmi = to_hdmi(output); struct tegra_hdmi *hdmi = to_hdmi(output);
#if defined(NV_DRM_DEBUGFS_REMOVE_HAS_ROOT_ARGS)
struct dentry *root;
#ifdef CONFIG_DEBUG_FS #if defined(NV_DRM_DEBUGFS_REMOVE_FILES_HAS_ROOT_ARG) /* Linux v6.7 */
root = connector->debugfs_entry; drm_debugfs_remove_files(hdmi->debugfs_files, count,
#else connector->debugfs_entry, minor);
root = NULL;
#endif
drm_debugfs_remove_files(hdmi->debugfs_files, count, root, minor);
#else #else
drm_debugfs_remove_files(hdmi->debugfs_files, count, minor); drm_debugfs_remove_files(hdmi->debugfs_files, count, minor);
#endif #endif

View File

@@ -1717,17 +1717,11 @@ static void tegra_sor_early_unregister(struct drm_connector *connector)
struct tegra_output *output = connector_to_output(connector); struct tegra_output *output = connector_to_output(connector);
unsigned int count = ARRAY_SIZE(debugfs_files); unsigned int count = ARRAY_SIZE(debugfs_files);
struct tegra_sor *sor = to_sor(output); struct tegra_sor *sor = to_sor(output);
#if defined(NV_DRM_DEBUGFS_REMOVE_HAS_ROOT_ARGS)
struct dentry *root;
#ifdef CONFIG_DEBUG_FS
root = connector->debugfs_entry;
#else
root = NULL;
#endif
#if defined(NV_DRM_DEBUGFS_REMOVE_FILES_HAS_ROOT_ARG) /* Linux v6.7 */
drm_debugfs_remove_files(sor->debugfs_files, count, drm_debugfs_remove_files(sor->debugfs_files, count,
root, connector->dev->primary); connector->debugfs_entry,
connector->dev->primary);
#else #else
drm_debugfs_remove_files(sor->debugfs_files, count, drm_debugfs_remove_files(sor->debugfs_files, count,

View File

@@ -105,6 +105,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += devm_thermal_of_zone_register
NV_CONFTEST_FUNCTION_COMPILE_TESTS += disk_check_media_change NV_CONFTEST_FUNCTION_COMPILE_TESTS += disk_check_media_change
NV_CONFTEST_FUNCTION_COMPILE_TESTS += dma_slave_config_struct_has_slave_id NV_CONFTEST_FUNCTION_COMPILE_TESTS += dma_slave_config_struct_has_slave_id
NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_aperture_remove_framebuffers NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_aperture_remove_framebuffers
NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_debugfs_remove_files_has_root_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_driver_struct_has_irq_enabled_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_driver_struct_has_irq_enabled_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_fb_helper_alloc_info NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_fb_helper_alloc_info
NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_fb_helper_prepare_has_preferred_bpp_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_fb_helper_prepare_has_preferred_bpp_arg

View File

@@ -6655,6 +6655,25 @@ compile_test() {
compile_check_conftest "$CODE" "NV_DRM_APERTURE_REMOVE_FRAMEBUFFERS_HAS_NO_PRIMARY_ARG" "" "types" compile_check_conftest "$CODE" "NV_DRM_APERTURE_REMOVE_FRAMEBUFFERS_HAS_NO_PRIMARY_ARG" "" "types"
;; ;;
drm_debugfs_remove_files_has_root_arg)
#
# Determine if the function drm_debugfs_remove_files() has the 'root' argument.
#
# Commit 8e455145d8f1 ("drm/debugfs: rework drm_debugfs_create_files
# implementation v2") added a 'root' argument to the function
# drm_debugfs_remove_files() in Linux v6.7.
#
CODE="
#include <drm/drm_debugfs.h>
int conftest_drm_debugfs_remove_files_has_root_arg(const struct drm_info_list *files,
int count, struct dentry *root,
struct drm_minor *minor) {
return drm_debugfs_remove_files(files, count, root, minor);
}"
compile_check_conftest "$CODE" "NV_DRM_DEBUGFS_REMOVE_FILES_HAS_ROOT_ARG" "" "types"
;;
drm_driver_struct_has_irq_enabled_arg) drm_driver_struct_has_irq_enabled_arg)
# #
# Determine if the 'drm_driver' structure # Determine if the 'drm_driver' structure