Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 267519
b: refs/heads/master
c: f725687
h: refs/heads/master
i:
  267517: 3acde7d
  267515: 2d2325a
  267511: b0ea344
  267503: ee4fe0b
  267487: 79623d4
  267455: 87e61f3
  267391: 271ef88
  267263: ed20d5e
v: v3
  • Loading branch information
Jonathan Cameron authored and Greg Kroah-Hartman committed Aug 23, 2011
1 parent 9e3a6f9 commit 4c9747a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 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: 70a876c59007ddb166a36c1073f45633bef1513b
refs/heads/master: f7256877c777d08f3af445840d94e37b11038fe2
28 changes: 21 additions & 7 deletions trunk/drivers/staging/iio/industrialio-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -725,19 +725,29 @@ static ssize_t iio_show_dev_name(struct device *dev,

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

static struct attribute *iio_base_dummy_attrs[] = {
NULL
};
static struct attribute_group iio_base_dummy_group = {
.attrs = iio_base_dummy_attrs,
};

static int iio_device_register_sysfs(struct iio_dev *dev_info)
{
int i, ret = 0;
struct iio_dev_attr *p, *n;

if (dev_info->info->attrs) {
if (dev_info->info->attrs)
ret = sysfs_create_group(&dev_info->dev.kobj,
dev_info->info->attrs);
if (ret) {
dev_err(dev_info->dev.parent,
"Failed to register sysfs hooks\n");
goto error_ret;
}
else
ret = sysfs_create_group(&dev_info->dev.kobj,
&iio_base_dummy_group);

if (ret) {
dev_err(dev_info->dev.parent,
"Failed to register sysfs hooks\n");
goto error_ret;
}

/*
Expand All @@ -753,7 +763,7 @@ static int iio_device_register_sysfs(struct iio_dev *dev_info)
if (ret < 0)
goto error_clear_attrs;
}
if (dev_info->name) {
if (dev_info->name) {
ret = sysfs_add_file_to_group(&dev_info->dev.kobj,
&dev_attr_name.attr,
NULL);
Expand All @@ -770,6 +780,8 @@ static int iio_device_register_sysfs(struct iio_dev *dev_info)
}
if (dev_info->info->attrs)
sysfs_remove_group(&dev_info->dev.kobj, dev_info->info->attrs);
else
sysfs_remove_group(&dev_info->dev.kobj, &iio_base_dummy_group);
error_ret:
return ret;

Expand All @@ -790,6 +802,8 @@ static void iio_device_unregister_sysfs(struct iio_dev *dev_info)

if (dev_info->info->attrs)
sysfs_remove_group(&dev_info->dev.kobj, dev_info->info->attrs);
else
sysfs_remove_group(&dev_info->dev.kobj, &iio_base_dummy_group);
}

/* Return a negative errno on failure */
Expand Down

0 comments on commit 4c9747a

Please sign in to comment.