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
(cherry picked from commit 32516f4878)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3053703
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
9c2c4a695c
commit
a39a2be24e
@@ -13,8 +13,6 @@
|
||||
|
||||
#include <nvidia/conftest.h>
|
||||
|
||||
#include <linux/version.h>
|
||||
|
||||
#include "wch_common.h"
|
||||
|
||||
#if defined(NV_DEFINE_SEMAPHORE_HAS_NUMBER_ARG)
|
||||
@@ -83,7 +81,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
|
||||
@@ -109,7 +107,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);
|
||||
@@ -1283,7 +1281,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
|
||||
@@ -1354,7 +1352,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)
|
||||
@@ -1382,7 +1380,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)
|
||||
@@ -1963,7 +1961,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)
|
||||
|
||||
@@ -146,6 +146,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 += vm_area_struct_has_const_vm_flags
|
||||
NV_CONFTEST_GENERIC_COMPILE_TESTS += is_export_symbol_present_drm_gem_prime_fd_to_handle
|
||||
NV_CONFTEST_GENERIC_COMPILE_TESTS += is_export_symbol_present_drm_gem_prime_handle_to_fd
|
||||
|
||||
@@ -7406,6 +7406,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"
|
||||
;;
|
||||
|
||||
# When adding a new conftest entry, please use the correct format for
|
||||
# specifying the relevant upstream Linux kernel commit.
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user