diff options
author | Alex Dubov <oakad@yahoo.com> | 2007-04-12 02:59:20 -0400 |
---|---|---|
committer | Pierre Ossman <drzeus@drzeus.cx> | 2007-05-01 07:04:14 -0400 |
commit | 4e64f223857b138e3474bedc967d51db25c414b3 (patch) | |
tree | 002cadb95b16ff082c999ea931318c6c662ef494 /drivers/misc | |
parent | 88de1b2fed2bbe9eb1b7310195be84cf143efb4f (diff) |
tifm: add sysfs attribute for tifm devices
A sysfs attribute reflecting current media type is added.
Signed-off-by: Alex Dubov <oakad@yahoo.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | 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 1e591989835d..70220beb3e04 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) | |||
142 | 142 | ||
143 | #endif /* CONFIG_PM */ | 143 | #endif /* CONFIG_PM */ |
144 | 144 | ||
145 | static ssize_t type_show(struct device *dev, struct device_attribute *attr, | ||
146 | char *buf) | ||
147 | { | ||
148 | struct tifm_dev *sock = container_of(dev, struct tifm_dev, dev); | ||
149 | return sprintf(buf, "%x", sock->type); | ||
150 | } | ||
151 | |||
152 | static struct device_attribute tifm_dev_attrs[] = { | ||
153 | __ATTR(type, S_IRUGO, type_show, NULL), | ||
154 | __ATTR_NULL | ||
155 | }; | ||
156 | |||
145 | static struct bus_type tifm_bus_type = { | 157 | static struct bus_type tifm_bus_type = { |
146 | .name = "tifm", | 158 | .name = "tifm", |
147 | .match = tifm_bus_match, | 159 | .dev_attrs = tifm_dev_attrs, |
148 | .uevent = tifm_uevent, | 160 | .match = tifm_bus_match, |
149 | .probe = tifm_device_probe, | 161 | .uevent = tifm_uevent, |
150 | .remove = tifm_device_remove, | 162 | .probe = tifm_device_probe, |
151 | .suspend = tifm_device_suspend, | 163 | .remove = tifm_device_remove, |
152 | .resume = tifm_device_resume | 164 | .suspend = tifm_device_suspend, |
165 | .resume = tifm_device_resume | ||
153 | }; | 166 | }; |
154 | 167 | ||
155 | static void tifm_free(struct class_device *cdev) | 168 | static void tifm_free(struct class_device *cdev) |