diff --git a/drivers/tty/serial/wch_35x/wch_serial.c b/drivers/tty/serial/wch_35x/wch_serial.c index 3a4fbbec..e1a65735 100644 --- a/drivers/tty/serial/wch_35x/wch_serial.c +++ b/drivers/tty/serial/wch_35x/wch_serial.c @@ -12,8 +12,6 @@ #include -#include - #include "wch_common.h" #if defined(NV_DEFINE_SEMAPHORE_HAS_NUMBER_ARG) @@ -82,7 +80,7 @@ static int ser_get_count(struct ser_state *, struct serial_icounter_struct *); static int ser_ioctl(struct tty_struct *, unsigned int, unsigned long); static void ser_hangup(struct tty_struct *); unsigned int ser_get_divisor(struct ser_port *, unsigned int, bool); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0) +#if defined(NV_TTY_OPERATIONS_STRUCT_SET_TERMIOS_HAS_CONST_KTERMIOS_ARG) /* Linux 6.1 */ unsigned int ser_get_baud_rate(struct ser_port *, struct WCHTERMIOS *, const struct WCHTERMIOS *, unsigned int, unsigned int); static void ser_change_speed(struct ser_state *state, const struct WCHTERMIOS *old_termios); #else @@ -108,7 +106,7 @@ static void wch_ser_break_ctl(struct ser_port *, int); static int wch_ser_startup(struct ser_port *); static void wch_ser_shutdown(struct ser_port *); static unsigned int wch_ser_get_divisor(struct ser_port *, unsigned int, bool); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0) +#if defined(NV_TTY_OPERATIONS_STRUCT_SET_TERMIOS_HAS_CONST_KTERMIOS_ARG) /* Linux 6.1 */ static void wch_ser_set_termios(struct ser_port *port, struct WCHTERMIOS *termios, const struct WCHTERMIOS *old); #else static void wch_ser_set_termios(struct ser_port *port, struct WCHTERMIOS *termios, struct WCHTERMIOS *old); @@ -1285,7 +1283,7 @@ unsigned int ser_get_divisor(struct ser_port *port, unsigned int baud, bool btwi return quot; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0) +#if defined(NV_TTY_OPERATIONS_STRUCT_SET_TERMIOS_HAS_CONST_KTERMIOS_ARG) /* Linux 6.1 */ unsigned int ser_get_baud_rate(struct ser_port *port, struct WCHTERMIOS *termios, const struct WCHTERMIOS *old, unsigned int min, unsigned int max) #else @@ -1356,7 +1354,7 @@ unsigned int ser_get_baud_rate(struct ser_port *port, struct WCHTERMIOS *termios return 0; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0) +#if defined(NV_TTY_OPERATIONS_STRUCT_SET_TERMIOS_HAS_CONST_KTERMIOS_ARG) /* Linux 6.1 */ static void ser_change_speed(struct ser_state *state, const struct WCHTERMIOS *old_termios) #else static void ser_change_speed(struct ser_state *state, struct WCHTERMIOS *old_termios) @@ -1384,7 +1382,7 @@ static void ser_change_speed(struct ser_state *state, struct WCHTERMIOS *old_ter wch_ser_set_termios(port, &termios, old_termios); } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0) +#if defined(NV_TTY_OPERATIONS_STRUCT_SET_TERMIOS_HAS_CONST_KTERMIOS_ARG) /* Linux 6.1 */ static void ser_set_termios(struct tty_struct *tty, const struct WCHTERMIOS *old_termios) #else static void ser_set_termios(struct tty_struct *tty, struct WCHTERMIOS *old_termios) @@ -1965,7 +1963,7 @@ static unsigned int wch_ser_get_divisor(struct ser_port *port, unsigned int baud return quot; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0) +#if defined(NV_TTY_OPERATIONS_STRUCT_SET_TERMIOS_HAS_CONST_KTERMIOS_ARG) /* Linux 6.1 */ static void wch_ser_set_termios(struct ser_port *port, struct WCHTERMIOS *termios, const struct WCHTERMIOS *old) #else static void wch_ser_set_termios(struct ser_port *port, struct WCHTERMIOS *termios, struct WCHTERMIOS *old) diff --git a/scripts/conftest/Makefile b/scripts/conftest/Makefile index bd4dc033..d5a44ea2 100644 --- a/scripts/conftest/Makefile +++ b/scripts/conftest/Makefile @@ -153,6 +153,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += tc_taprio_qopt_offload_struct_has_cmd NV_CONFTEST_FUNCTION_COMPILE_TESTS += tegra_dev_iommu_get_stream_id NV_CONFTEST_FUNCTION_COMPILE_TESTS += tegra_ivc_struct_has_iosys_map NV_CONFTEST_FUNCTION_COMPILE_TESTS += tty_operations_struct_write_has_u8_ptr_arg +NV_CONFTEST_FUNCTION_COMPILE_TESTS += tty_operations_struct_set_termios_has_const_ktermios_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += ufs_hba_variant_ops_suspend_has_status_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += v4l2_async_connection_struct_present NV_CONFTEST_FUNCTION_COMPILE_TESTS += v4l2_async_match_type_enum_present diff --git a/scripts/conftest/conftest.sh b/scripts/conftest/conftest.sh index b145261d..b1f94f8d 100755 --- a/scripts/conftest/conftest.sh +++ b/scripts/conftest/conftest.sh @@ -7521,6 +7521,25 @@ compile_test() { compile_check_conftest "$CODE" "NV_TTY_OPERATIONS_STRUCT_WRITE_HAS_U8_PTR_ARG" "" "functions" ;; + tty_operations_struct_set_termios_has_const_ktermios_arg) + # + # Determine if the function set_termios of tty_operations struct has the const type argument or not. + # + # The callback function of tty_operations has the const type argument from the commit bec5b814d46c + # ("serial: Make ->set_termios() old ktermios const") in Linux 6.1. + # + CODE=" + #include + #include + static inline void test_set_termios(struct tty_struct *tty, const struct ktermios *old) { + } + static struct tty_operations tty_ops = { + .set_termios = test_set_termios, + };" + + compile_check_conftest "$CODE" "NV_TTY_OPERATIONS_STRUCT_SET_TERMIOS_HAS_CONST_KTERMIOS_ARG" "" "types" + ;; + ufs_hba_variant_ops_suspend_has_status_arg) # # Determine if the 'suspend' function for the