aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorPierre Ossman <drzeus@drzeus.cx>2007-06-17 05:42:21 -0400
committerPierre Ossman <drzeus@drzeus.cx>2007-09-23 14:54:15 -0400
commitbcfe66e21ef78a078bb0de0bab532701996695d3 (patch)
treeb1c130e567a8d41a6d81022f0d29bfbe92ac0065 /drivers/mmc
parentd59b66c7a575cfa8e01f483875d131e42b539bbc (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.c32
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) \
28static ssize_t \
29field##_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
37sdio_config_attr(class, "0x%02x\n");
38sdio_config_attr(vendor, "0x%04x\n");
39sdio_config_attr(device, "0x%04x\n");
40
41static 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
49struct 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
26static const struct sdio_device_id *sdio_match_one(struct sdio_func *func, 57static 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
118static struct bus_type sdio_bus_type = { 149static 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,