Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 354404
b: refs/heads/master
c: 1daed9b
h: refs/heads/master
v: v3
  • Loading branch information
Guenter Roeck authored and Jonathan Cameron committed Feb 2, 2013
1 parent 11ea5ab commit 2936239
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c4ac7b98bdeb04ffe867512f938a77d517cd9c6e
refs/heads/master: 1daed9becdd4c9a3f75a84ebdb4d05b4dade8512
12 changes: 10 additions & 2 deletions trunk/drivers/staging/iio/iio_hwmon.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ static ssize_t iio_hwmon_read_val(struct device *dev,
return sprintf(buf, "%d\n", result);
}

static ssize_t show_name(struct device *dev, struct device_attribute *attr,
char *buf)
{
return sprintf(buf, "iio_hwmon\n");
}

static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);

static int iio_hwmon_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
Expand All @@ -77,7 +85,7 @@ static int iio_hwmon_probe(struct platform_device *pdev)
st->num_channels++;

st->attrs = devm_kzalloc(dev,
sizeof(*st->attrs) * (st->num_channels + 1),
sizeof(*st->attrs) * (st->num_channels + 2),
GFP_KERNEL);
if (st->attrs == NULL) {
ret = -ENOMEM;
Expand Down Expand Up @@ -125,7 +133,7 @@ static int iio_hwmon_probe(struct platform_device *pdev)
a->index = i;
st->attrs[i] = &a->dev_attr.attr;
}

st->attrs[st->num_channels] = &dev_attr_name.attr;
st->attr_group.attrs = st->attrs;
platform_set_drvdata(pdev, st);
ret = sysfs_create_group(&dev->kobj, &st->attr_group);
Expand Down

0 comments on commit 2936239

Please sign in to comment.