diff options
author | Pierre Ossman <drzeus@drzeus.cx> | 2007-06-17 05:42:21 -0400 |
---|---|---|
committer | Pierre Ossman <drzeus@drzeus.cx> | 2007-09-23 14:54:15 -0400 |
commit | bcfe66e21ef78a078bb0de0bab532701996695d3 (patch) | |
tree | b1c130e567a8d41a6d81022f0d29bfbe92ac0065 /drivers/mmc | |
parent | d59b66c7a575cfa8e01f483875d131e42b539bbc (diff) |
sdio: add basic sysfs attributes
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/core/sdio_bus.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c index c834f5150888..129f0719c391 100644 --- a/drivers/mmc/core/sdio_bus.c +++ b/drivers/mmc/core/sdio_bus.c | |||
@@ -23,6 +23,37 @@ | |||
23 | #define dev_to_sdio_func(d) container_of(d, struct sdio_func, dev) | 23 | #define dev_to_sdio_func(d) container_of(d, struct sdio_func, dev) |
24 | #define to_sdio_driver(d) container_of(d, struct sdio_driver, drv) | 24 | #define to_sdio_driver(d) container_of(d, struct sdio_driver, drv) |
25 | 25 | ||
26 | /* show configuration fields */ | ||
27 | #define sdio_config_attr(field, format_string) \ | ||
28 | static ssize_t \ | ||
29 | field##_show(struct device *dev, struct device_attribute *attr, char *buf) \ | ||
30 | { \ | ||
31 | struct sdio_func *func; \ | ||
32 | \ | ||
33 | func = dev_to_sdio_func (dev); \ | ||
34 | return sprintf (buf, format_string, func->field); \ | ||
35 | } | ||
36 | |||
37 | sdio_config_attr(class, "0x%02x\n"); | ||
38 | sdio_config_attr(vendor, "0x%04x\n"); | ||
39 | sdio_config_attr(device, "0x%04x\n"); | ||
40 | |||
41 | static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, char *buf) | ||
42 | { | ||
43 | struct sdio_func *func = dev_to_sdio_func (dev); | ||
44 | |||
45 | return sprintf(buf, "sdio:c%02Xv%04Xd%04X\n", | ||
46 | func->class, func->vendor, func->device); | ||
47 | } | ||
48 | |||
49 | struct device_attribute sdio_dev_attrs[] = { | ||
50 | __ATTR_RO(class), | ||
51 | __ATTR_RO(vendor), | ||
52 | __ATTR_RO(device), | ||
53 | __ATTR_RO(modalias), | ||
54 | __ATTR_NULL, | ||
55 | }; | ||
56 | |||
26 | static const struct sdio_device_id *sdio_match_one(struct sdio_func *func, | 57 | static const struct sdio_device_id *sdio_match_one(struct sdio_func *func, |
27 | const struct sdio_device_id *id) | 58 | const struct sdio_device_id *id) |
28 | { | 59 | { |
@@ -117,6 +148,7 @@ static int sdio_bus_remove(struct device *dev) | |||
117 | 148 | ||
118 | static struct bus_type sdio_bus_type = { | 149 | static struct bus_type sdio_bus_type = { |
119 | .name = "sdio", | 150 | .name = "sdio", |
151 | .dev_attrs = sdio_dev_attrs, | ||
120 | .match = sdio_bus_match, | 152 | .match = sdio_bus_match, |
121 | .uevent = sdio_bus_uevent, | 153 | .uevent = sdio_bus_uevent, |
122 | .probe = sdio_bus_probe, | 154 | .probe = sdio_bus_probe, |