1 From 3cfa0a9d4b4cc30ec735c5c9535ff493bae24d08 Mon Sep 17 00:00:00 2001
2 From: Hauke Mehrtens <hauke@hauke-m.de>
3 Date: Sat, 27 Nov 2010 18:14:23 +0100
4 Subject: [PATCH] ssb: Add sysfs attributes to ssb devices
6 Make it possible to read out the attributes, till now only show on
9 This patch was some time in OpenWrt.
11 Signed-off-by: Bernhard Loos <bernhardloos@googlemail.com>
12 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
14 drivers/ssb/main.c | 30 ++++++++++++++++++++++++++++++
15 1 files changed, 30 insertions(+), 0 deletions(-)
17 --- a/drivers/ssb/main.c
18 +++ b/drivers/ssb/main.c
19 @@ -384,6 +384,35 @@ static int ssb_device_uevent(struct devi
20 ssb_dev->id.revision);
23 +#define ssb_config_attr(attrib, field, format_string) \
25 +attrib##_show(struct device *dev, struct device_attribute *attr, char *buf) \
27 + return sprintf(buf, format_string, dev_to_ssb_dev(dev)->field); \
30 +ssb_config_attr(core_num, core_index, "%u\n")
31 +ssb_config_attr(coreid, id.coreid, "0x%04x\n")
32 +ssb_config_attr(vendor, id.vendor, "0x%04x\n")
33 +ssb_config_attr(revision, id.revision, "%u\n")
34 +ssb_config_attr(irq, irq, "%u\n")
36 +name_show(struct device *dev, struct device_attribute *attr, char *buf)
38 + return sprintf(buf, "%s\n",
39 + ssb_core_name(dev_to_ssb_dev(dev)->id.coreid));
42 +static struct device_attribute ssb_device_attrs[] = {
44 + __ATTR_RO(core_num),
47 + __ATTR_RO(revision),
52 static struct bus_type ssb_bustype = {
54 .match = ssb_bus_match,
55 @@ -393,6 +422,7 @@ static struct bus_type ssb_bustype = {
56 .suspend = ssb_device_suspend,
57 .resume = ssb_device_resume,
58 .uevent = ssb_device_uevent,
59 + .dev_attrs = ssb_device_attrs,
62 static void ssb_buses_lock(void)