[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1603187810-30481-2-git-send-email-hsin-hsiung.wang@mediatek.com>
Date: Tue, 20 Oct 2020 17:56:48 +0800
From: Hsin-Hsiung Wang <hsin-hsiung.wang@...iatek.com>
To: Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
Matthias Brugger <matthias.bgg@...il.com>,
Stephen Boyd <sboyd@...nel.org>
CC: <linux-kernel@...r.kernel.org>, <devicetree@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-mediatek@...ts.infradead.org>,
<linux-arm-msm@...r.kernel.org>, <srv_heupstream@...iatek.com>,
Hsin-Hsiung Wang <hsin-hsiung.wang@...iatek.com>
Subject: [PATCH v2 1/3] spmi: Add driver shutdown support
Add new shutdown() method. Use it in the standard driver model style.
Signed-off-by: Hsin-Hsiung Wang <hsin-hsiung.wang@...iatek.com>
---
drivers/spmi/spmi.c | 9 +++++++++
include/linux/spmi.h | 1 +
2 files changed, 10 insertions(+)
diff --git a/drivers/spmi/spmi.c b/drivers/spmi/spmi.c
index c16b60f645a4..161a48ca4acc 100644
--- a/drivers/spmi/spmi.c
+++ b/drivers/spmi/spmi.c
@@ -357,6 +357,14 @@ 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 && 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 +381,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 394a3f68bad5..729bcbf9f5ad 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.18.0
Powered by blists - more mailing lists