diff --git a/drivers/pwm/pwm-tegra-tachometer.c b/drivers/pwm/pwm-tegra-tachometer.c index 625434a6..dd8c5fbd 100644 --- a/drivers/pwm/pwm-tegra-tachometer.c +++ b/drivers/pwm/pwm-tegra-tachometer.c @@ -16,7 +16,6 @@ #include #include #include -#include #define DRIVER_NAME "pwm_tach" @@ -144,7 +143,7 @@ static inline void tachometer_writel(struct pwm_tegra_tach *ptt, u32 val, writel(val, ptt->regs + reg); } -#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0)) +#if defined(NV_PWM_OPS_STRUCT_HAS_CONFIG) /* Linux 6.0 */ static int tegra_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, int duty_ns, int period_ns) { @@ -310,7 +309,7 @@ static irqreturn_t tegra_pwm_tach_irq(int irq, void *dev) } static const struct pwm_ops pwm_tegra_tach_ops = { -#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0)) +#if defined(NV_PWM_OPS_STRUCT_HAS_CONFIG) /* Linux 6.0 */ .config = tegra_pwm_config, .enable = tegra_pwm_enable, .disable = tegra_pwm_disable, diff --git a/scripts/conftest/Makefile b/scripts/conftest/Makefile index b86252fa..bd4dc033 100644 --- a/scripts/conftest/Makefile +++ b/scripts/conftest/Makefile @@ -134,6 +134,7 @@ 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_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 NV_CONFTEST_FUNCTION_COMPILE_TESTS += pci_disable_pcie_error_reporting NV_CONFTEST_FUNCTION_COMPILE_TESTS += pci_enable_pcie_error_reporting diff --git a/scripts/conftest/conftest.sh b/scripts/conftest/conftest.sh index 8ef61485..b145261d 100755 --- a/scripts/conftest/conftest.sh +++ b/scripts/conftest/conftest.sh @@ -7163,6 +7163,22 @@ compile_test() { compile_check_conftest "$CODE" "NV_PWM_OPS_STRUCT_HAS_OWNER" "" "types" ;; + pwm_ops_struct_has_config) + # + # Determine if the pwm_ops struct has config callback or not + # + # Removed from commit 0829c35dc534 ("pwm: Drop support for legacy drivers") + # in Linux 6.0 + # + CODE=" + #include + int conftest_pwm_ops_struct_has_owner(void) { + return offsetof(struct pwm_ops, config); + }" + + compile_check_conftest "$CODE" "NV_PWM_OPS_STRUCT_HAS_CONFIG" "" "types" + ;; + pci_epc_event_ops_struct_has_core_deinit) # # Determine if the pci_epc_event_ops struct has the core_deinit function.