lede/target/linux/generic/backport-5.15/005-add-tty-driver-missing-function.patch
aakkll f92cfbbd3e
kernel: bump 5.15 to 5.15.29 (#9078)
Signed-off-by: aakkll <94471752+aakkll@users.noreply.github.com>
2022-03-17 16:02:27 +08:00

55 lines
1.6 KiB
Diff

From 80fb91b164f3fdc7b2c54198d5fa7757b084c466 Mon Sep 17 00:00:00 2001
From: W_Y_CPP <383152993@qq.com>
Date: Wed, 9 Mar 2022 01:45:44 -0500
Subject: [PATCH] add tty driver missing function
---
drivers/tty/tty_io.c | 13 +++++++++++++
include/linux/tty_driver.h | 15 +++++++++++++++
2 files changed, 28 insertions(+)
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -3438,6 +3438,12 @@ void tty_driver_kref_put(struct tty_driv
}
EXPORT_SYMBOL(tty_driver_kref_put);
+void put_tty_driver(struct tty_driver *d)
+{
+ tty_driver_kref_put(d);
+}
+EXPORT_SYMBOL(put_tty_driver);
+
/*
* Called by a tty driver to register itself.
*/
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -329,6 +329,7 @@ extern struct list_head tty_drivers;
extern struct tty_driver *__tty_alloc_driver(unsigned int lines,
struct module *owner, unsigned long flags);
+extern void put_tty_driver(struct tty_driver *driver);
extern struct tty_driver *tty_find_polling_driver(char *name, int *line);
extern void tty_driver_kref_put(struct tty_driver *driver);
@@ -337,6 +338,18 @@ extern void tty_driver_kref_put(struct t
#define tty_alloc_driver(lines, flags) \
__tty_alloc_driver(lines, THIS_MODULE, flags)
+/*
+ * DEPRECATED Do not use this in new code, use tty_alloc_driver instead.
+ * (And change the return value checks.)
+ */
+static inline struct tty_driver *alloc_tty_driver(unsigned int lines)
+{
+ struct tty_driver *ret = tty_alloc_driver(lines, 0);
+ if (IS_ERR(ret))
+ return NULL;
+ return ret;
+}
+
static inline struct tty_driver *tty_driver_kref_get(struct tty_driver *d)
{
kref_get(&d->kref);