mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
serial: Use conftest to find if uart_ops has set_termios has const arg
Use conftest to determine if set_termios of struct uart_ops
has const type argument or not. The argument type is changed
from commit bec5b814d46c ("serial: Make ->set_termios() old
ktermios const") in Linux 6.1
Bug 4387902
Change-Id: I175aac51ac2c2b99b9eedc69260ccb6b0c38571e
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3037040
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
b7cbe748e1
commit
32516f4878
@@ -12,8 +12,6 @@
|
||||
|
||||
#include <nvidia/conftest.h>
|
||||
|
||||
#include <linux/version.h>
|
||||
|
||||
#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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 <linux/tty.h>
|
||||
#include <linux/tty_driver.h>
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user