Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 230996
b: refs/heads/master
c: cca69b6
h: refs/heads/master
v: v3
  • Loading branch information
Mattias Wallin authored and Samuel Ortiz committed Jan 14, 2011
1 parent 4c7344f commit 28df03c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6bce7bf1a1f8a79a57ff69910c115e1d2ed8913d
refs/heads/master: cca69b67b3ba954ed8642583295b51933f902227
25 changes: 25 additions & 0 deletions trunk/drivers/mfd/ab8500-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,26 @@ static struct mfd_cell ab8500_devs[] = {
},
};

static ssize_t show_chip_id(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct ab8500 *ab8500;

ab8500 = dev_get_drvdata(dev);
return sprintf(buf, "%#x\n", ab8500 ? ab8500->chip_id : -EINVAL);
}

static DEVICE_ATTR(chip_id, S_IRUGO, show_chip_id, NULL);

static struct attribute *ab8500_sysfs_entries[] = {
&dev_attr_chip_id.attr,
NULL,
};

static struct attribute_group ab8500_attr_group = {
.attrs = ab8500_sysfs_entries,
};

int __devinit ab8500_init(struct ab8500 *ab8500)
{
struct ab8500_platform_data *plat = dev_get_platdata(ab8500->dev);
Expand Down Expand Up @@ -510,6 +530,10 @@ int __devinit ab8500_init(struct ab8500 *ab8500)
if (ret)
goto out_freeirq;

ret = sysfs_create_group(&ab8500->dev->kobj, &ab8500_attr_group);
if (ret)
dev_err(ab8500->dev, "error creating sysfs entries\n");

return ret;

out_freeirq:
Expand All @@ -523,6 +547,7 @@ int __devinit ab8500_init(struct ab8500 *ab8500)

int __devexit ab8500_exit(struct ab8500 *ab8500)
{
sysfs_remove_group(&ab8500->dev->kobj, &ab8500_attr_group);
mfd_remove_devices(ab8500->dev);
if (ab8500->irq_base) {
free_irq(ab8500->irq, ab8500);
Expand Down

0 comments on commit 28df03c

Please sign in to comment.