Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=41d78f7405659b55e082c5f0b3d1b625e75e1294
Commit:     41d78f7405659b55e082c5f0b3d1b625e75e1294
Parent:     8b40adab9c6cb63cede72c3ce3c3fee1157719e0
Author:     Alex Dubov <[EMAIL PROTECTED]>
AuthorDate: Mon Dec 11 01:55:37 2006 +1100
Committer:  Pierre Ossman <[EMAIL PROTECTED]>
CommitDate: Sun Feb 4 20:54:10 2007 +0100

    tifm_core: add suspend/resume infrastructure for tifm devices
    
    Signed-off-by: Alex Dubov <[EMAIL PROTECTED]>
    Signed-off-by: Pierre Ossman <[EMAIL PROTECTED]>
---
 drivers/misc/tifm_core.c |   35 ++++++++++++++++++++++++++++++++++-
 include/linux/tifm.h     |    3 +++
 2 files changed, 37 insertions(+), 1 deletions(-)

diff --git a/drivers/misc/tifm_core.c b/drivers/misc/tifm_core.c
index 4d62dab..6b10ebe 100644
--- a/drivers/misc/tifm_core.c
+++ b/drivers/misc/tifm_core.c
@@ -14,7 +14,7 @@
 #include <linux/idr.h>
 
 #define DRIVER_NAME "tifm_core"
-#define DRIVER_VERSION "0.6"
+#define DRIVER_VERSION "0.7"
 
 static DEFINE_IDR(tifm_adapter_idr);
 static DEFINE_SPINLOCK(tifm_adapter_lock);
@@ -60,10 +60,41 @@ static int tifm_uevent(struct device *dev, char **envp, int 
num_envp,
        return 0;
 }
 
+#ifdef CONFIG_PM
+
+static int tifm_device_suspend(struct device *dev, pm_message_t state)
+{
+       struct tifm_dev *fm_dev = container_of(dev, struct tifm_dev, dev);
+       struct tifm_driver *drv = fm_dev->drv;
+
+       if (drv && drv->suspend)
+               return drv->suspend(fm_dev, state);
+       return 0;
+}
+
+static int tifm_device_resume(struct device *dev)
+{
+       struct tifm_dev *fm_dev = container_of(dev, struct tifm_dev, dev);
+       struct tifm_driver *drv = fm_dev->drv;
+
+       if (drv && drv->resume)
+               return drv->resume(fm_dev);
+       return 0;
+}
+
+#else
+
+#define tifm_device_suspend NULL
+#define tifm_device_resume NULL
+
+#endif /* CONFIG_PM */
+
 static struct bus_type tifm_bus_type = {
        .name    = "tifm",
        .match   = tifm_match,
        .uevent  = tifm_uevent,
+       .suspend = tifm_device_suspend,
+       .resume  = tifm_device_resume
 };
 
 static void tifm_free(struct class_device *cdev)
@@ -233,6 +264,8 @@ int tifm_register_driver(struct tifm_driver *drv)
        drv->driver.bus = &tifm_bus_type;
        drv->driver.probe = tifm_device_probe;
        drv->driver.remove = tifm_device_remove;
+       drv->driver.suspend = tifm_device_suspend;
+       drv->driver.resume = tifm_device_resume;
 
        return driver_register(&drv->driver);
 }
diff --git a/include/linux/tifm.h b/include/linux/tifm.h
index e5a8295..3deb0a6 100644
--- a/include/linux/tifm.h
+++ b/include/linux/tifm.h
@@ -101,6 +101,9 @@ struct tifm_driver {
        tifm_media_id        *id_table;
        int                  (*probe)(struct tifm_dev *dev);
        void                 (*remove)(struct tifm_dev *dev);
+       int                  (*suspend)(struct tifm_dev *dev,
+                                        pm_message_t state);
+       int                  (*resume)(struct tifm_dev *dev);
 
        struct device_driver driver;
 };
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to