diff --git a/drivers/tty/serial/wch_35x/wch_common.h b/drivers/tty/serial/wch_35x/wch_common.h index 4de18085..9c1fc103 100644 --- a/drivers/tty/serial/wch_35x/wch_common.h +++ b/drivers/tty/serial/wch_35x/wch_common.h @@ -30,6 +30,7 @@ #include #include #include +#include #include #include diff --git a/drivers/tty/serial/wch_35x/wch_serial.c b/drivers/tty/serial/wch_35x/wch_serial.c index 45a17404..44721695 100644 --- a/drivers/tty/serial/wch_35x/wch_serial.c +++ b/drivers/tty/serial/wch_35x/wch_serial.c @@ -11,11 +11,17 @@ * more details. */ +#include + #include #include "wch_common.h" +#if defined(NV_DEFINE_SEMAPHORE_HAS_NUMBER_ARG) +static DEFINE_SEMAPHORE(ser_port_sem, 1); +#else static DEFINE_SEMAPHORE(ser_port_sem); +#endif #define WCH_HIGH_BITS_OFFSET ((sizeof(long) - sizeof(int)) * 8) #define wch_ser_users(state) ((state)->count + ((state)->info ? (state)->info->blocked_open : 0)) diff --git a/scripts/conftest/Makefile b/scripts/conftest/Makefile index aa29dfa2..6c503579 100644 --- a/scripts/conftest/Makefile +++ b/scripts/conftest/Makefile @@ -90,6 +90,7 @@ endef NV_CONFTEST_FUNCTION_COMPILE_TESTS += bus_type_struct_remove_has_int_return_type NV_CONFTEST_FUNCTION_COMPILE_TESTS += class_struct_devnode_has_const_dev_arg +NV_CONFTEST_FUNCTION_COMPILE_TESTS += define_semaphore_has_number_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += devm_thermal_of_zone_register NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_aperture_remove_framebuffers_has_drm_driver_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_driver_struct_has_irq_enabled_arg diff --git a/scripts/conftest/conftest.sh b/scripts/conftest/conftest.sh index 48904402..a229fb7c 100755 --- a/scripts/conftest/conftest.sh +++ b/scripts/conftest/conftest.sh @@ -6332,6 +6332,22 @@ compile_test() { compile_check_conftest "$CODE" "NV_CLASS_STRUCT_DEVNODE_HAS_CONST_DEV_ARG" "" "types" ;; + define_semaphore_has_number_arg) + # + # Determine if the macro DEFINE_SEMAPHORE has a number argument. + # + # In Linux v6.4, 48380368dec1 ("Change DEFINE_SEMAPHORE() to + # take a number argument") updated the macro DEFINE_SEMAPHORE to + # take a number argument. + # + CODE=" + #include + + DEFINE_SEMAPHORE(my_sem, 1);" + + compile_check_conftest "$CODE" "NV_DEFINE_SEMAPHORE_HAS_NUMBER_ARG" "" "types" + ;; + devm_thermal_of_zone_register) # # Determine whether devm_thermal_of_zone_register is present.