ddb1f1b3835e9050318047afac7a791fdbe1559a
[openwrt/svn-archive/archive.git] / target / linux / brcm47xx / patches-2.6.34 / 950-sbb-sysfs-files.patch
1 --- a/drivers/ssb/main.c
2 +++ b/drivers/ssb/main.c
3 @@ -385,6 +385,34 @@ static int ssb_device_uevent(struct devi
4 ssb_dev->id.revision);
5 }
6
7 +#define ssb_config_attr(attrib, field, format_string) \
8 +static ssize_t \
9 +attrib##_show(struct device *dev, struct device_attribute *attr, char *buf) \
10 +{ \
11 + return sprintf (buf, format_string, dev_to_ssb_dev(dev)->field); \
12 +}
13 +
14 +ssb_config_attr(core_num, core_index, "%u\n")
15 +ssb_config_attr(coreid, id.coreid, "0x%04x\n")
16 +ssb_config_attr(vendor, id.vendor, "0x%04x\n")
17 +ssb_config_attr(revision, id.revision, "%u\n")
18 +ssb_config_attr(irq, irq, "%u\n")
19 +static ssize_t
20 +name_show(struct device *dev, struct device_attribute *attr, char *buf)
21 +{
22 + return sprintf (buf, "%s\n", ssb_core_name(dev_to_ssb_dev(dev)->id.coreid));
23 +}
24 +
25 +static struct device_attribute ssb_device_attrs[] = {
26 + __ATTR_RO(name),
27 + __ATTR_RO(core_num),
28 + __ATTR_RO(coreid),
29 + __ATTR_RO(vendor),
30 + __ATTR_RO(revision),
31 + __ATTR_RO(irq),
32 + __ATTR_NULL,
33 +};
34 +
35 static struct bus_type ssb_bustype = {
36 .name = "ssb",
37 .match = ssb_bus_match,
38 @@ -394,6 +422,7 @@ static struct bus_type ssb_bustype = {
39 .suspend = ssb_device_suspend,
40 .resume = ssb_device_resume,
41 .uevent = ssb_device_uevent,
42 + .dev_attrs = ssb_device_attrs,
43 };
44
45 static void ssb_buses_lock(void)