pwm: Use conftest to findout if pwm_ops has owner

Use conftest method to find out the pwm_ops has
owner member or not. The owner member from pwm_ops
struct has been removed from Linux 6.7 with
commit 384461abcab6 ("pwm: Manage owner assignment
implicitly for drivers").

Bug 4346767

Change-Id: I7b98463b16d400a656a79db3a0c7aa645f20085d
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3028573
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Laxman Dewangan
2023-12-05 09:30:43 +00:00
committed by mobile promotions
parent 91c367006c
commit b0bfc4b801
6 changed files with 29 additions and 9 deletions

View File

@@ -81,9 +81,6 @@ subdir-ccflags-y += -DNV_ASOC_XXX_DROP
# drm_debugfs_remove_files has root argument # drm_debugfs_remove_files has root argument
subdir-ccflags-y += -DNV_DRM_DEBUGFS_REMOVE_HAS_ROOT_ARGS subdir-ccflags-y += -DNV_DRM_DEBUGFS_REMOVE_HAS_ROOT_ARGS
# pwm ops has dropped the .owner member
subdir-ccflags-y += -DNV_PWM_OPS_HAS_NO_OWNER
# get_file_rcu() have change the argument # get_file_rcu() have change the argument
subdir-ccflags-y += -DNV_GET_FILE_RCU_HAS_PTR_FILE_ARGS subdir-ccflags-y += -DNV_GET_FILE_RCU_HAS_PTR_FILE_ARGS

View File

@@ -1,5 +1,7 @@
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2016-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // Copyright (c) 2016-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#include <nvidia/conftest.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of.h> #include <linux/of.h>
@@ -130,7 +132,7 @@ static const struct pwm_ops cdi_pwm_ops = {
.enable = cdi_pwm_enable, .enable = cdi_pwm_enable,
.disable = cdi_pwm_disable, .disable = cdi_pwm_disable,
#endif #endif
#if !defined(NV_PWM_OPS_HAS_NO_OWNER) #if defined(NV_PWM_OPS_STRUCT_HAS_OWNER) /* Linux 6.7 */
.owner = THIS_MODULE, .owner = THIS_MODULE,
#endif #endif
}; };

View File

@@ -1,5 +1,7 @@
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2016-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // Copyright (c) 2016-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#include <nvidia/conftest.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of.h> #include <linux/of.h>
@@ -130,7 +132,7 @@ static const struct pwm_ops isc_pwm_ops = {
.enable = isc_pwm_enable, .enable = isc_pwm_enable,
.disable = isc_pwm_disable, .disable = isc_pwm_disable,
#endif #endif
#if !defined(NV_PWM_OPS_HAS_NO_OWNER) #if defined(NV_PWM_OPS_STRUCT_HAS_OWNER) /* Linux 6.7 */
.owner = THIS_MODULE, .owner = THIS_MODULE,
#endif #endif
}; };

View File

@@ -1,5 +1,7 @@
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. // Copyright (c) 2022-2023, NVIDIA CORPORATION. All rights reserved.
#include <nvidia/conftest.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of.h> #include <linux/of.h>
@@ -316,7 +318,7 @@ static const struct pwm_ops pwm_tegra_tach_ops = {
.apply = tegra_pwm_apply, .apply = tegra_pwm_apply,
#endif #endif
.capture = pwm_tegra_tacho_capture, .capture = pwm_tegra_tacho_capture,
#if !defined(NV_PWM_OPS_HAS_NO_OWNER) #if defined(NV_PWM_OPS_STRUCT_HAS_OWNER) /* Linux 6.7 */
.owner = THIS_MODULE, .owner = THIS_MODULE,
#endif #endif
}; };

View File

@@ -123,6 +123,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += mii_bus_struct_has_write_c45
NV_CONFTEST_FUNCTION_COMPILE_TESTS += netif_set_tso_max_size NV_CONFTEST_FUNCTION_COMPILE_TESTS += netif_set_tso_max_size
NV_CONFTEST_FUNCTION_COMPILE_TESTS += netif_napi_add_weight NV_CONFTEST_FUNCTION_COMPILE_TESTS += netif_napi_add_weight
NV_CONFTEST_FUNCTION_COMPILE_TESTS += pde_data NV_CONFTEST_FUNCTION_COMPILE_TESTS += pde_data
NV_CONFTEST_FUNCTION_COMPILE_TESTS += pwm_ops_struct_has_owner
NV_CONFTEST_FUNCTION_COMPILE_TESTS += register_shrinker_has_fmt_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += register_shrinker_has_fmt_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += snd_soc_card_jack_new_has_no_snd_soc_jack_pins NV_CONFTEST_FUNCTION_COMPILE_TESTS += snd_soc_card_jack_new_has_no_snd_soc_jack_pins
NV_CONFTEST_FUNCTION_COMPILE_TESTS += snd_soc_component_driver_struct_has_non_legacy_dai_naming NV_CONFTEST_FUNCTION_COMPILE_TESTS += snd_soc_component_driver_struct_has_non_legacy_dai_naming

View File

@@ -6968,6 +6968,22 @@ compile_test() {
compile_check_conftest "$CODE" "NV_MII_BUS_STRUCT_HAS_WRITE_C45" "" "types" compile_check_conftest "$CODE" "NV_MII_BUS_STRUCT_HAS_WRITE_C45" "" "types"
;; ;;
pwm_ops_struct_has_owner)
#
# Determine if the pwm_ops struct has an owner member.
#
# Added by commit 384461abcab6 ("pwm: Manage owner assignment implicitly
# for drivers") in Linux 6.7.
#
CODE="
#include <linux/pwm.h>
int conftest_pwm_ops_struct_has_owner(void) {
return offsetof(struct pwm_ops, owner);
}"
compile_check_conftest "$CODE" "NV_PWM_OPS_STRUCT_HAS_OWNER" "" "types"
;;
register_shrinker_has_fmt_arg) register_shrinker_has_fmt_arg)
# #
# Determine if the 'register_shrinker' function # Determine if the 'register_shrinker' function