diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-07-09 16:39:08 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-07-09 16:39:08 -0400 |
commit | f12db36d3fd7ab75c29015c32a12d49697e11f61 (patch) | |
tree | 614b33f6b8b2ac6fe429ab26984d20a605b7885f /drivers/iio | |
parent | 8b67527113a3396b2d66402a4fe83b08e74acc63 (diff) | |
parent | c732a24c5a9392cf3738f5957e0d97d37c09e6e1 (diff) |
Merge tag 'togreg_8_7_2012' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Mixed back of updates and trivial examples fixes.
Nothing terribly interesting in this one.
8 July 2012
Diffstat (limited to 'drivers/iio')
-rw-r--r-- | drivers/iio/industrialio-trigger.c | 42 |
1 files changed, 15 insertions, 27 deletions
diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c index ec653fb51d0b..4fe0ead84213 100644 --- a/drivers/iio/industrialio-trigger.c +++ b/drivers/iio/industrialio-trigger.c | |||
@@ -51,25 +51,19 @@ static ssize_t iio_trigger_read_name(struct device *dev, | |||
51 | 51 | ||
52 | static DEVICE_ATTR(name, S_IRUGO, iio_trigger_read_name, NULL); | 52 | static DEVICE_ATTR(name, S_IRUGO, iio_trigger_read_name, NULL); |
53 | 53 | ||
54 | /** | 54 | static struct attribute *iio_trig_dev_attrs[] = { |
55 | * iio_trigger_register_sysfs() - create a device for this trigger | 55 | &dev_attr_name.attr, |
56 | * @trig_info: the trigger | 56 | NULL, |
57 | * | 57 | }; |
58 | * Also adds any control attribute registered by the trigger driver | ||
59 | **/ | ||
60 | static int iio_trigger_register_sysfs(struct iio_trigger *trig_info) | ||
61 | { | ||
62 | return sysfs_add_file_to_group(&trig_info->dev.kobj, | ||
63 | &dev_attr_name.attr, | ||
64 | NULL); | ||
65 | } | ||
66 | 58 | ||
67 | static void iio_trigger_unregister_sysfs(struct iio_trigger *trig_info) | 59 | static struct attribute_group iio_trig_attr_group = { |
68 | { | 60 | .attrs = iio_trig_dev_attrs, |
69 | sysfs_remove_file_from_group(&trig_info->dev.kobj, | 61 | }; |
70 | &dev_attr_name.attr, | 62 | |
71 | NULL); | 63 | static const struct attribute_group *iio_trig_attr_groups[] = { |
72 | } | 64 | &iio_trig_attr_group, |
65 | NULL | ||
66 | }; | ||
73 | 67 | ||
74 | int iio_trigger_register(struct iio_trigger *trig_info) | 68 | int iio_trigger_register(struct iio_trigger *trig_info) |
75 | { | 69 | { |
@@ -88,10 +82,6 @@ int iio_trigger_register(struct iio_trigger *trig_info) | |||
88 | if (ret) | 82 | if (ret) |
89 | goto error_unregister_id; | 83 | goto error_unregister_id; |
90 | 84 | ||
91 | ret = iio_trigger_register_sysfs(trig_info); | ||
92 | if (ret) | ||
93 | goto error_device_del; | ||
94 | |||
95 | /* Add to list of available triggers held by the IIO core */ | 85 | /* Add to list of available triggers held by the IIO core */ |
96 | mutex_lock(&iio_trigger_list_lock); | 86 | mutex_lock(&iio_trigger_list_lock); |
97 | list_add_tail(&trig_info->list, &iio_trigger_list); | 87 | list_add_tail(&trig_info->list, &iio_trigger_list); |
@@ -99,8 +89,6 @@ int iio_trigger_register(struct iio_trigger *trig_info) | |||
99 | 89 | ||
100 | return 0; | 90 | return 0; |
101 | 91 | ||
102 | error_device_del: | ||
103 | device_del(&trig_info->dev); | ||
104 | error_unregister_id: | 92 | error_unregister_id: |
105 | ida_simple_remove(&iio_trigger_ida, trig_info->id); | 93 | ida_simple_remove(&iio_trigger_ida, trig_info->id); |
106 | error_ret: | 94 | error_ret: |
@@ -114,7 +102,6 @@ void iio_trigger_unregister(struct iio_trigger *trig_info) | |||
114 | list_del(&trig_info->list); | 102 | list_del(&trig_info->list); |
115 | mutex_unlock(&iio_trigger_list_lock); | 103 | mutex_unlock(&iio_trigger_list_lock); |
116 | 104 | ||
117 | iio_trigger_unregister_sysfs(trig_info); | ||
118 | ida_simple_remove(&iio_trigger_ida, trig_info->id); | 105 | ida_simple_remove(&iio_trigger_ida, trig_info->id); |
119 | /* Possible issue in here */ | 106 | /* Possible issue in here */ |
120 | device_unregister(&trig_info->dev); | 107 | device_unregister(&trig_info->dev); |
@@ -234,7 +221,7 @@ static int iio_trigger_attach_poll_func(struct iio_trigger *trig, | |||
234 | return ret; | 221 | return ret; |
235 | } | 222 | } |
236 | 223 | ||
237 | static int iio_trigger_dettach_poll_func(struct iio_trigger *trig, | 224 | static int iio_trigger_detach_poll_func(struct iio_trigger *trig, |
238 | struct iio_poll_func *pf) | 225 | struct iio_poll_func *pf) |
239 | { | 226 | { |
240 | int ret = 0; | 227 | int ret = 0; |
@@ -406,6 +393,7 @@ static void iio_trig_release(struct device *device) | |||
406 | 393 | ||
407 | static struct device_type iio_trig_type = { | 394 | static struct device_type iio_trig_type = { |
408 | .release = iio_trig_release, | 395 | .release = iio_trig_release, |
396 | .groups = iio_trig_attr_groups, | ||
409 | }; | 397 | }; |
410 | 398 | ||
411 | static void iio_trig_subirqmask(struct irq_data *d) | 399 | static void iio_trig_subirqmask(struct irq_data *d) |
@@ -502,7 +490,7 @@ EXPORT_SYMBOL(iio_triggered_buffer_postenable); | |||
502 | 490 | ||
503 | int iio_triggered_buffer_predisable(struct iio_dev *indio_dev) | 491 | int iio_triggered_buffer_predisable(struct iio_dev *indio_dev) |
504 | { | 492 | { |
505 | return iio_trigger_dettach_poll_func(indio_dev->trig, | 493 | return iio_trigger_detach_poll_func(indio_dev->trig, |
506 | indio_dev->pollfunc); | 494 | indio_dev->pollfunc); |
507 | } | 495 | } |
508 | EXPORT_SYMBOL(iio_triggered_buffer_predisable); | 496 | EXPORT_SYMBOL(iio_triggered_buffer_predisable); |