diff --git a/drivers/media/platform/tegra/cdi/cdi_pwm.c b/drivers/media/platform/tegra/cdi/cdi_pwm.c index 625b5445..d0093f70 100644 --- a/drivers/media/platform/tegra/cdi/cdi_pwm.c +++ b/drivers/media/platform/tegra/cdi/cdi_pwm.c @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-2.0 -// Copyright (c) 2016-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2016-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. #include @@ -162,7 +162,9 @@ static int cdi_pwm_probe(struct platform_device *pdev) info->chip.dev = &pdev->dev; info->chip.ops = &cdi_pwm_ops; +#if defined(NV_PWM_CHIP_STRUCT_HAS_BASE_ARG) info->chip.base = -1; +#endif info->chip.npwm = npwm; info->chip.of_xlate = of_cdi_pwm_xlate; info->chip.of_pwm_n_cells = 2; diff --git a/drivers/media/platform/tegra/isc/isc_pwm.c b/drivers/media/platform/tegra/isc/isc_pwm.c index 97b464c1..cb80f2e9 100644 --- a/drivers/media/platform/tegra/isc/isc_pwm.c +++ b/drivers/media/platform/tegra/isc/isc_pwm.c @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-2.0 -// Copyright (c) 2016-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2016-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. #include @@ -162,7 +162,9 @@ static int isc_pwm_probe(struct platform_device *pdev) info->chip.dev = &pdev->dev; info->chip.ops = &isc_pwm_ops; +#if defined(NV_PWM_CHIP_STRUCT_HAS_BASE_ARG) info->chip.base = -1; +#endif info->chip.npwm = npwm; info->chip.of_xlate = of_isc_pwm_xlate; info->chip.of_pwm_n_cells = 2; diff --git a/drivers/pwm/pwm-tegra-tachometer.c b/drivers/pwm/pwm-tegra-tachometer.c index dd8c5fbd..02e86832 100644 --- a/drivers/pwm/pwm-tegra-tachometer.c +++ b/drivers/pwm/pwm-tegra-tachometer.c @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-2.0 -// Copyright (c) 2022-2023, NVIDIA CORPORATION. All rights reserved. +// Copyright (c) 2022-2024, NVIDIA CORPORATION. All rights reserved. #include @@ -429,7 +429,9 @@ static int pwm_tegra_tach_probe(struct platform_device *pdev) ptt->chip.dev = &pdev->dev; ptt->chip.ops = &pwm_tegra_tach_ops; +#if defined(NV_PWM_CHIP_STRUCT_HAS_BASE_ARG) ptt->chip.base = -1; +#endif ptt->chip.npwm = 1; ret = pwmchip_add(&ptt->chip); diff --git a/scripts/conftest/Makefile b/scripts/conftest/Makefile index 40f95a30..0c3e50a3 100644 --- a/scripts/conftest/Makefile +++ b/scripts/conftest/Makefile @@ -135,6 +135,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += of_get_named_gpio_flags NV_CONFTEST_FUNCTION_COMPILE_TESTS += gpio_chip_struct_has_of_node_present NV_CONFTEST_FUNCTION_COMPILE_TESTS += gpiochip_find NV_CONFTEST_FUNCTION_COMPILE_TESTS += pde_data +NV_CONFTEST_FUNCTION_COMPILE_TESTS += pwm_chip_struct_has_base_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += pwm_ops_struct_has_owner NV_CONFTEST_FUNCTION_COMPILE_TESTS += pwm_ops_struct_has_config NV_CONFTEST_FUNCTION_COMPILE_TESTS += pci_epc_event_ops_struct_has_core_deinit diff --git a/scripts/conftest/conftest.sh b/scripts/conftest/conftest.sh index 5ebc63fd..86298c1e 100755 --- a/scripts/conftest/conftest.sh +++ b/scripts/conftest/conftest.sh @@ -7163,6 +7163,23 @@ compile_test() { compile_check_conftest "$CODE" "NV_MII_BUS_STRUCT_HAS_WRITE_C45" "" "types" ;; + pwm_chip_struct_has_base_arg) + # + # Determine if 'struct pwm_chip' has the 'base' field. + # + # Commit 54c86dd20bba ("pwm: Replace PWM chip unique base by unique ID") + # removed the 'base' field of the 'pwm_chip' structure replacing it with + # an 'id' field. + # + CODE=" + #include + int conftest_pwm_chip_struct_has_base_arg(void) { + return offsetof(struct pwm_chip, base); + }" + + compile_check_conftest "$CODE" "NV_PWM_CHIP_STRUCT_HAS_BASE_ARG" "" "types" + ;; + pwm_ops_struct_has_owner) # # Determine if the pwm_ops struct has an owner member.