summaryrefslogtreecommitdiffstats
path: root/drivers/sh
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2010-04-13 10:16:34 +0900
committerPaul Mundt <lethal@linux-sh.org>2010-04-13 10:16:34 +0900
commit0ded75428605213641897d6b8d8e9cf9fdb6eb8d (patch)
treeca9088ff89b42190df432650c2294abcbc3c735b /drivers/sh
parent050d4cc7029b73997d6821d89487b1f777d4873c (diff)
downloadlinux-0ded75428605213641897d6b8d8e9cf9fdb6eb8d.tar.gz
linux-0ded75428605213641897d6b8d8e9cf9fdb6eb8d.tar.bz2
linux-0ded75428605213641897d6b8d8e9cf9fdb6eb8d.zip
sh: intc: Provide sysdev name for intc controllers.
Presently the sysdevs are simply numbered based on the list position, without having any direct way of figuring out which controller these are actually mapping to. This provides a name attr for mapping out the chip name. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers/sh')
-rw-r--r--drivers/sh/intc.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/sh/intc.c b/drivers/sh/intc.c
index f43850527645..b605f7e478d6 100644
--- a/drivers/sh/intc.c
+++ b/drivers/sh/intc.c
@@ -1034,6 +1034,18 @@ err0:
return -ENOMEM;
}
+static ssize_t
+show_intc_name(struct sys_device *dev, struct sysdev_attribute *attr, char *buf)
+{
+ struct intc_desc_int *d;
+
+ d = container_of(dev, struct intc_desc_int, sysdev);
+
+ return sprintf(buf, "%s\n", d->chip.name);
+}
+
+static SYSDEV_ATTR(name, S_IRUGO, show_intc_name, NULL);
+
static int intc_suspend(struct sys_device *dev, pm_message_t state)
{
struct intc_desc_int *d;
@@ -1098,8 +1110,12 @@ static int __init register_intc_sysdevs(void)
d->sysdev.id = id;
d->sysdev.cls = &intc_sysdev_class;
error = sysdev_register(&d->sysdev);
+ if (error == 0)
+ error = sysdev_create_file(&d->sysdev,
+ &attr_name);
if (error)
break;
+
id++;
}
}