summaryrefslogtreecommitdiff
path: root/gnu/packages/patches/linux-libre-pinebook-pro-03-tty-serdev-support-shutdown-op.patch
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/patches/linux-libre-pinebook-pro-03-tty-serdev-support-shutdown-op.patch')
-rw-r--r--gnu/packages/patches/linux-libre-pinebook-pro-03-tty-serdev-support-shutdown-op.patch55
1 files changed, 55 insertions, 0 deletions
diff --git a/gnu/packages/patches/linux-libre-pinebook-pro-03-tty-serdev-support-shutdown-op.patch b/gnu/packages/patches/linux-libre-pinebook-pro-03-tty-serdev-support-shutdown-op.patch
new file mode 100644
index 0000000000..48591d444a
--- /dev/null
+++ b/gnu/packages/patches/linux-libre-pinebook-pro-03-tty-serdev-support-shutdown-op.patch
@@ -0,0 +1,55 @@
+From 336bc343e754aa1b30c877eec59b3fa1e905aa1e Mon Sep 17 00:00:00 2001
+From: Tobias Schramm <t.schramm@manjaro.org>
+Date: Thu, 28 May 2020 14:12:56 +0200
+Subject: [PATCH 03/22] tty: serdev: support shutdown op
+
+Allow serdev drivers to register a shutdown handler
+
+Signed-off-by: Tobias Schramm <t.schramm@manjaro.org>
+---
+ drivers/tty/serdev/core.c | 11 +++++++++++
+ include/linux/serdev.h | 1 +
+ 2 files changed, 12 insertions(+)
+
+diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c
+index c5f0d936b003..37e45c356540 100644
+--- a/drivers/tty/serdev/core.c
++++ b/drivers/tty/serdev/core.c
+@@ -432,11 +432,22 @@ static int serdev_drv_remove(struct device *dev)
+ return 0;
+ }
+
++static void serdev_drv_shutdown(struct device *dev)
++{
++ const struct serdev_device_driver *sdrv;
++ if (dev->driver) {
++ sdrv = to_serdev_device_driver(dev->driver);
++ if (sdrv->shutdown)
++ sdrv->shutdown(to_serdev_device(dev));
++ }
++}
++
+ static struct bus_type serdev_bus_type = {
+ .name = "serial",
+ .match = serdev_device_match,
+ .probe = serdev_drv_probe,
+ .remove = serdev_drv_remove,
++ .shutdown = serdev_drv_shutdown,
+ };
+
+ /**
+diff --git a/include/linux/serdev.h b/include/linux/serdev.h
+index 9f14f9c12ec4..94050561325c 100644
+--- a/include/linux/serdev.h
++++ b/include/linux/serdev.h
+@@ -63,6 +63,7 @@ struct serdev_device_driver {
+ struct device_driver driver;
+ int (*probe)(struct serdev_device *);
+ void (*remove)(struct serdev_device *);
++ void (*shutdown)(struct serdev_device *);
+ };
+
+ static inline struct serdev_device_driver *to_serdev_device_driver(struct device_driver *d)
+--
+2.30.0
+