Thread (7 messages) 7 messages, 3 authors, 2020-08-17
STALE2120d
Revisions (4)
  1. v1 current
  2. v2 [diff vs current]
  3. v3 [diff vs current]
  4. v4 [diff vs current]

[PATCH 1/3] spmi: Add driver shutdown support

From: Hsin-Hsiung Wang <hidden>
Date: 2020-08-03 08:57:41
Also in: linux-arm-msm, linux-devicetree, linux-mediatek, lkml
Subsystem: spmi subsystem, the rest · Maintainers: Stephen Boyd, Linus Torvalds

Add new shutdown() method.  Use it in the standard driver model style.

Signed-off-by: Hsin-Hsiung Wang <redacted>
---
 drivers/spmi/spmi.c  | 12 ++++++++++++
 drivers/spmi/spmi.c  | 12 ++++++++++++
 include/linux/spmi.h |  1 +
 2 files changed, 13 insertions(+)
diff --git a/drivers/spmi/spmi.c b/drivers/spmi/spmi.c
index c16b60f..5fde024 100644
--- a/drivers/spmi/spmi.c
+++ b/drivers/spmi/spmi.c
@@ -357,6 +357,17 @@ static int spmi_drv_remove(struct device *dev)
 	return 0;
 }
 
+static void spmi_drv_shutdown(struct device *dev)
+{
+	const struct spmi_driver *sdrv = to_spmi_driver(dev->driver);
+
+	if (!sdrv)
+		return;
+
+
+	if (sdrv->shutdown)
+		sdrv->shutdown(to_spmi_device(dev));
+}
+}
+
 static int spmi_drv_uevent(struct device *dev, struct kobj_uevent_env *env)
 {
 	int ret;
@@ -373,6 +384,7 @@ static struct bus_type spmi_bus_type = {
@@ -373,6 +384,7 @@ static struct bus_type spmi_bus_type = {
 	.match		= spmi_device_match,
 	.probe		= spmi_drv_probe,
 	.remove		= spmi_drv_remove,
+	.shutdown	= spmi_drv_shutdown,
 	.uevent		= spmi_drv_uevent,
 };
 
diff --git a/include/linux/spmi.h b/include/linux/spmi.h
index 394a3f6..729bcbf 100644
--- a/include/linux/spmi.h
+++ b/include/linux/spmi.h
@@ -138,6 +138,7 @@ struct spmi_driver {
 	struct device_driver driver;
 	int	(*probe)(struct spmi_device *sdev);
 	void	(*remove)(struct spmi_device *sdev);
+	void	(*shutdown)(struct spmi_device *sdev);
 };
 
 static inline struct spmi_driver *to_spmi_driver(struct device_driver *d)
-- 
2.6.4
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help