From: Hsin-Hsiung Wang <hsin-hsiung.wang@mediatek.com>
To: Mark Brown <broonie@kernel.org>, Rob Herring <robh+dt@kernel.org>,
Matthias Brugger <matthias.bgg@gmail.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
Stephen Boyd <sboyd@kernel.org>,
Hsin-Hsiung Wang <hsin-hsiung.wang@mediatek.com>,
<linux-kernel@vger.kernel.org>, <devicetree@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-mediatek@lists.infradead.org>,
<linux-arm-msm@vger.kernel.org>, <srv_heupstream@mediatek.com>
Subject: [PATCH 1/3] spmi: Add driver shutdown support
Date: Mon, 3 Aug 2020 16:57:25 +0800 [thread overview]
Message-ID: <1596445047-2975-2-git-send-email-hsin-hsiung.wang@mediatek.com> (raw)
In-Reply-To: <1596445047-2975-1-git-send-email-hsin-hsiung.wang@mediatek.com>
Add new shutdown() method. Use it in the standard driver model style.
Signed-off-by: Hsin-Hsiung Wang <hsin-hsiung.wang@mediatek.com>
---
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
next prev parent reply other threads:[~2020-08-03 8:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-03 8:57 [PATCH 0/3] Add support for MT6315 regulator Hsin-Hsiung Wang
2020-08-03 8:57 ` Hsin-Hsiung Wang [this message]
2020-08-04 1:51 ` [PATCH 1/3] spmi: Add driver shutdown support Nicolas Boichat
2020-08-03 8:57 ` [PATCH 2/3] regulator: bindings: Add document for MT6315 regulator Hsin-Hsiung Wang
2020-08-04 2:12 ` Nicolas Boichat
2020-08-17 21:18 ` Rob Herring
2020-08-03 8:57 ` [PATCH 3/3] regulator: mt6315: Add support " Hsin-Hsiung Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1596445047-2975-2-git-send-email-hsin-hsiung.wang@mediatek.com \
--to=hsin-hsiung.wang@mediatek.com \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=robh+dt@kernel.org \
--cc=sboyd@kernel.org \
--cc=srv_heupstream@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).