3c65add1b2
[ci skip]
55 lines
1.6 KiB
Diff
55 lines
1.6 KiB
Diff
From 7e8fc396d34f6c9f536cb9540f212a2fd0f11685 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 1/8] 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.28.0
|
|
|