]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
spmi: Add driver shutdown support
authorHsin-Hsiung Wang <hsin-hsiung.wang@mediatek.com>
Thu, 10 Dec 2020 02:33:43 +0000 (18:33 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Dec 2020 09:45:36 +0000 (10:45 +0100)
Add new shutdown() method.  Use it in the standard driver model style.

Link: https://lore.kernel.org/r/1603187810-30481-2-git-send-email-hsin-hsiung.wang@mediatek.com
Signed-off-by: Hsin-Hsiung Wang <hsin-hsiung.wang@mediatek.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Link: https://lore.kernel.org/r/20201210023344.2838141-4-sboyd@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/spmi/spmi.c
include/linux/spmi.h

index 253340e10dabd5fb6ae7d8f448c771261fcd37ef..51f5aeb65b3b20dd60bbf8cdf7852a973a180b8a 100644 (file)
@@ -359,6 +359,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;
@@ -375,6 +383,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,
 };
 
index 394a3f68bad5df36a1d0ad15c179e9b88adca7e6..729bcbf9f5ad1197818728b8546668fb64addd0e 100644 (file)
@@ -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)