mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
tty: Use conftest to find if tty_operations::write() has argument u8 ptr
Use conftest to find if the function write() of tty_operations
struct has the argument as U8 pointer data type. This datatype
is changed from Linux 6.5 with commit 69851e4ab8feeb ("tty:
propagate u8 data to tty_operations::write()")
Bug 4346767
Change-Id: I49f9ef844da0dee8e209e597989f1d179a2a804b
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3028632
(cherry picked from commit a757343f2e)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3053702
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
3a35e1c2b1
commit
9c2c4a695c
3
Makefile
3
Makefile
@@ -27,9 +27,6 @@ ifeq ($(shell test $(LINUX_VERSION) -ge $(LINUX_VERSION_6_6); echo $$?),0)
|
|||||||
# probe_new is removed from i2c driver structure
|
# probe_new is removed from i2c driver structure
|
||||||
subdir-ccflags-y += -DNV_I2C_LEGACY_PROBE_NEW_REMOVED
|
subdir-ccflags-y += -DNV_I2C_LEGACY_PROBE_NEW_REMOVED
|
||||||
|
|
||||||
# API changes to replace u8 with unsigned char
|
|
||||||
subdir-ccflags-y += -DNV_TTY_SERIAL_TYPE_U8_CHANGE
|
|
||||||
|
|
||||||
# v4l2_async_subdev is renamed to v4l2_async_connection.
|
# v4l2_async_subdev is renamed to v4l2_async_connection.
|
||||||
subdir-ccflags-y += -DNV_V4L2_ASYNC_SUBDEV_RENAME
|
subdir-ccflags-y += -DNV_V4L2_ASYNC_SUBDEV_RENAME
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2021-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
* Copyright (c) 2021-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
@@ -54,7 +54,7 @@ static void ser_tasklet_action(unsigned long);
|
|||||||
static int ser_startup(struct ser_state *, int);
|
static int ser_startup(struct ser_state *, int);
|
||||||
static void ser_shutdown(struct ser_state *);
|
static void ser_shutdown(struct ser_state *);
|
||||||
static _INLINE_ void _ser_put_char(struct ser_port *, struct circ_buf *, unsigned char);
|
static _INLINE_ void _ser_put_char(struct ser_port *, struct circ_buf *, unsigned char);
|
||||||
#if defined(NV_TTY_SERIAL_TYPE_U8_CHANGE)
|
#if defined(NV_TTY_OPERATIONS_STRUCT_WRITE_HAS_U8_PTR_ARG) /* Linux 6.5 */
|
||||||
static int ser_put_char(struct tty_struct *, u8);
|
static int ser_put_char(struct tty_struct *, u8);
|
||||||
#else
|
#else
|
||||||
static int ser_put_char(struct tty_struct *, unsigned char);
|
static int ser_put_char(struct tty_struct *, unsigned char);
|
||||||
@@ -68,7 +68,7 @@ static void ser_unthrottle(struct tty_struct *);
|
|||||||
static int ser_get_info(struct ser_state *, struct serial_struct *);
|
static int ser_get_info(struct ser_state *, struct serial_struct *);
|
||||||
static int ser_set_info(struct ser_state *, struct serial_struct *);
|
static int ser_set_info(struct ser_state *, struct serial_struct *);
|
||||||
static unsigned int ser_write_room(struct tty_struct *tty);
|
static unsigned int ser_write_room(struct tty_struct *tty);
|
||||||
#if defined(NV_TTY_SERIAL_TYPE_U8_CHANGE)
|
#if defined(NV_TTY_OPERATIONS_STRUCT_WRITE_HAS_U8_PTR_ARG) /* Linux 6.5 */
|
||||||
static ssize_t ser_write(struct tty_struct *, const u8 *, size_t);
|
static ssize_t ser_write(struct tty_struct *, const u8 *, size_t);
|
||||||
#else
|
#else
|
||||||
static int ser_write(struct tty_struct *, const unsigned char *, int);
|
static int ser_write(struct tty_struct *, const unsigned char *, int);
|
||||||
@@ -622,7 +622,7 @@ static _INLINE_ void _ser_put_char(struct ser_port *port, struct circ_buf *circ,
|
|||||||
spin_unlock_irqrestore(&port->lock, flags);
|
spin_unlock_irqrestore(&port->lock, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(NV_TTY_SERIAL_TYPE_U8_CHANGE)
|
#if defined(NV_TTY_OPERATIONS_STRUCT_WRITE_HAS_U8_PTR_ARG) /* Linux 6.5 */
|
||||||
static int ser_put_char(struct tty_struct *tty, u8 ch)
|
static int ser_put_char(struct tty_struct *tty, u8 ch)
|
||||||
#else
|
#else
|
||||||
static int ser_put_char(struct tty_struct *tty, unsigned char ch)
|
static int ser_put_char(struct tty_struct *tty, unsigned char ch)
|
||||||
@@ -921,7 +921,7 @@ static unsigned int ser_write_room(struct tty_struct *tty)
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(NV_TTY_SERIAL_TYPE_U8_CHANGE)
|
#if defined(NV_TTY_OPERATIONS_STRUCT_WRITE_HAS_U8_PTR_ARG) /* Linux 6.5 */
|
||||||
static ssize_t ser_write(struct tty_struct *tty, const u8 *buf, size_t count)
|
static ssize_t ser_write(struct tty_struct *tty, const u8 *buf, size_t count)
|
||||||
#else
|
#else
|
||||||
static int ser_write(struct tty_struct *tty, const unsigned char *buf, int count)
|
static int ser_write(struct tty_struct *tty, const unsigned char *buf, int count)
|
||||||
|
|||||||
@@ -145,6 +145,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += spi_get_chipselect
|
|||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += tc_taprio_qopt_offload_struct_has_cmd
|
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_dev_iommu_get_stream_id
|
||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += tegra_ivc_struct_has_iosys_map
|
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 += vm_area_struct_has_const_vm_flags
|
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_fd_to_handle
|
||||||
NV_CONFTEST_GENERIC_COMPILE_TESTS += is_export_symbol_present_drm_gem_prime_handle_to_fd
|
NV_CONFTEST_GENERIC_COMPILE_TESTS += is_export_symbol_present_drm_gem_prime_handle_to_fd
|
||||||
|
|||||||
@@ -7385,6 +7385,27 @@ compile_test() {
|
|||||||
compile_check_conftest "$CODE" "NV_TEGRA_DEV_IOMMU_GET_STREAM_ID_PRESENT" "" "functions"
|
compile_check_conftest "$CODE" "NV_TEGRA_DEV_IOMMU_GET_STREAM_ID_PRESENT" "" "functions"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
tty_operations_struct_write_has_u8_ptr_arg)
|
||||||
|
#
|
||||||
|
# Determine if the function write() of tty_operations has u8 type pointer argument.
|
||||||
|
#
|
||||||
|
# The data type of function write() of struct tty_operation has changed
|
||||||
|
# to u8 data type from Linux 6.5 with change
|
||||||
|
# commit 69851e4ab8feeb3 ("tty: propagate u8 data to tty_operations::write()")
|
||||||
|
#
|
||||||
|
CODE="
|
||||||
|
#include <linux/tty.h>
|
||||||
|
#include <linux/tty_driver.h>
|
||||||
|
static inline int ser_write(struct tty_struct *ttys, const unsigned char *buf, int l) {
|
||||||
|
return l;
|
||||||
|
}
|
||||||
|
static struct tty_operations tty_ops = {
|
||||||
|
.write = ser_write,
|
||||||
|
};"
|
||||||
|
|
||||||
|
compile_check_conftest "$CODE" "NV_TTY_OPERATIONS_STRUCT_WRITE_HAS_U8_PTR_ARG" "" "functions"
|
||||||
|
;;
|
||||||
|
|
||||||
# When adding a new conftest entry, please use the correct format for
|
# When adding a new conftest entry, please use the correct format for
|
||||||
# specifying the relevant upstream Linux kernel commit.
|
# specifying the relevant upstream Linux kernel commit.
|
||||||
#
|
#
|
||||||
|
|||||||
Reference in New Issue
Block a user