Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4e64f223857b138e3474bedc967d51db25c414b3
Commit:     4e64f223857b138e3474bedc967d51db25c414b3
Parent:     88de1b2fed2bbe9eb1b7310195be84cf143efb4f
Author:     Alex Dubov <[EMAIL PROTECTED]>
AuthorDate: Thu Apr 12 16:59:20 2007 +1000
Committer:  Pierre Ossman <[EMAIL PROTECTED]>
CommitDate: Tue May 1 13:04:14 2007 +0200

    tifm: add sysfs attribute for tifm devices
    
    A sysfs attribute reflecting current media type is added.
    
    Signed-off-by: Alex Dubov <[EMAIL PROTECTED]>
    Signed-off-by: Pierre Ossman <[EMAIL PROTECTED]>
---
 drivers/misc/tifm_core.c |   27 ++++++++++++++++++++-------
 1 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/drivers/misc/tifm_core.c b/drivers/misc/tifm_core.c
index 1e59198..70220be 100644
--- a/drivers/misc/tifm_core.c
+++ b/drivers/misc/tifm_core.c
@@ -142,14 +142,27 @@ static int tifm_device_resume(struct device *dev)
 
 #endif /* CONFIG_PM */
 
+static ssize_t type_show(struct device *dev, struct device_attribute *attr,
+                        char *buf)
+{
+       struct tifm_dev *sock = container_of(dev, struct tifm_dev, dev);
+       return sprintf(buf, "%x", sock->type);
+}
+
+static struct device_attribute tifm_dev_attrs[] = {
+       __ATTR(type, S_IRUGO, type_show, NULL),
+       __ATTR_NULL
+};
+
 static struct bus_type tifm_bus_type = {
-       .name    = "tifm",
-       .match   = tifm_bus_match,
-       .uevent  = tifm_uevent,
-       .probe   = tifm_device_probe,
-       .remove  = tifm_device_remove,
-       .suspend = tifm_device_suspend,
-       .resume  = tifm_device_resume
+       .name           = "tifm",
+       .dev_attrs      = tifm_dev_attrs,
+       .match          = tifm_bus_match,
+       .uevent         = tifm_uevent,
+       .probe          = tifm_device_probe,
+       .remove         = tifm_device_remove,
+       .suspend        = tifm_device_suspend,
+       .resume         = tifm_device_resume
 };
 
 static void tifm_free(struct class_device *cdev)
-
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