Commit aa3bf280 authored by Hauke Mehrtens's avatar Hauke Mehrtens Committed by John W. Linville

ssb: Add sysfs attributes to ssb devices

Make it possible to read out the attributes, till now only show on
dmesg, through sysfs.

This patch was some time in OpenWrt.
Signed-off-by: default avatarBernhard Loos <>
Signed-off-by: default avatarHauke Mehrtens <>
Signed-off-by: default avatarJohn W. Linville <>
parent 172c69a4
......@@ -383,6 +383,35 @@ static int ssb_device_uevent(struct device *dev, struct kobj_uevent_env *env)
#define ssb_config_attr(attrib, field, format_string) \
static ssize_t \
attrib##_show(struct device *dev, struct device_attribute *attr, char *buf) \
{ \
return sprintf(buf, format_string, dev_to_ssb_dev(dev)->field); \
ssb_config_attr(core_num, core_index, "%u\n")
ssb_config_attr(coreid, id.coreid, "0x%04x\n")
ssb_config_attr(vendor, id.vendor, "0x%04x\n")
ssb_config_attr(revision, id.revision, "%u\n")
ssb_config_attr(irq, irq, "%u\n")
static ssize_t
name_show(struct device *dev, struct device_attribute *attr, char *buf)
return sprintf(buf, "%s\n",
static struct device_attribute ssb_device_attrs[] = {
static struct bus_type ssb_bustype = {
.name = "ssb",
.match = ssb_bus_match,
......@@ -392,6 +421,7 @@ static struct bus_type ssb_bustype = {
.suspend = ssb_device_suspend,
.resume = ssb_device_resume,
.uevent = ssb_device_uevent,
.dev_attrs = ssb_device_attrs,
static void ssb_buses_lock(void)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment