Skip to content

Commit

Permalink
sh: intc: Provide sysdev name for intc controllers.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Paul Mundt committed Apr 13, 2010
1 parent 050d4cc commit 0ded754
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions drivers/sh/intc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1034,6 +1034,18 @@ int __init register_intc_controller(struct intc_desc *desc)
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;
Expand Down Expand Up @@ -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++;
}
}
Expand Down

0 comments on commit 0ded754

Please sign in to comment.