Commit 5cba220b authored by Jonathan Cameron's avatar Jonathan Cameron Committed by Greg Kroah-Hartman

staging:iio: Move event attributes into the event[n] device in sysfs

Signed-off-by: default avatarJonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 5aaaeba8
...@@ -676,16 +676,14 @@ static int iio_device_register_eventset(struct iio_dev *dev_info) ...@@ -676,16 +676,14 @@ static int iio_device_register_eventset(struct iio_dev *dev_info)
dev_info->event_interfaces[i].id); dev_info->event_interfaces[i].id);
goto error_free_setup_ev_ints; goto error_free_setup_ev_ints;
} }
}
for (i = 0; i < dev_info->num_interrupt_lines; i++) { dev_set_drvdata(&dev_info->event_interfaces[i].dev,
snprintf(dev_info->event_interfaces[i]._attrname, 20, (void *)dev_info);
"event_line%d_sources", i); ret = sysfs_create_group(&dev_info
dev_info->event_attrs[i].name ->event_interfaces[i]
= (const char *) .dev.kobj,
(dev_info->event_interfaces[i]._attrname); &dev_info->event_attrs[i]);
ret = sysfs_create_group(&dev_info->dev.kobj,
&dev_info->event_attrs[i]);
if (ret) { if (ret) {
dev_err(&dev_info->dev, dev_err(&dev_info->dev,
"Failed to register sysfs for event attrs"); "Failed to register sysfs for event attrs");
...@@ -707,13 +705,13 @@ static int iio_device_register_eventset(struct iio_dev *dev_info) ...@@ -707,13 +705,13 @@ static int iio_device_register_eventset(struct iio_dev *dev_info)
i = dev_info->num_interrupt_lines - 1; i = dev_info->num_interrupt_lines - 1;
error_remove_sysfs_interfaces: error_remove_sysfs_interfaces:
for (j = 0; j < i; j++) for (j = 0; j < i; j++)
sysfs_remove_group(&dev_info->dev.kobj, sysfs_remove_group(&dev_info
->event_interfaces[j].dev.kobj,
&dev_info->event_attrs[j]); &dev_info->event_attrs[j]);
i = dev_info->num_interrupt_lines - 1;
error_free_setup_ev_ints: error_free_setup_ev_ints:
for (j = 0; j < i; j++) { for (j = 0; j < i; j++) {
iio_free_idr_val(&iio_event_idr, iio_free_idr_val(&iio_event_idr,
dev_info->event_interfaces[i].id); dev_info->event_interfaces[j].id);
iio_free_ev_int(&dev_info->event_interfaces[j]); iio_free_ev_int(&dev_info->event_interfaces[j]);
} }
kfree(dev_info->interrupts); kfree(dev_info->interrupts);
...@@ -731,7 +729,8 @@ static void iio_device_unregister_eventset(struct iio_dev *dev_info) ...@@ -731,7 +729,8 @@ static void iio_device_unregister_eventset(struct iio_dev *dev_info)
if (dev_info->num_interrupt_lines == 0) if (dev_info->num_interrupt_lines == 0)
return; return;
for (i = 0; i < dev_info->num_interrupt_lines; i++) for (i = 0; i < dev_info->num_interrupt_lines; i++)
sysfs_remove_group(&dev_info->dev.kobj, sysfs_remove_group(&dev_info
->event_interfaces[i].dev.kobj,
&dev_info->event_attrs[i]); &dev_info->event_attrs[i]);
for (i = 0; i < dev_info->num_interrupt_lines; i++) { for (i = 0; i < dev_info->num_interrupt_lines; i++) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment