summaryrefslogtreecommitdiff
path: root/drivers/staging/iio/accel/lis3l02dq_ring.c
diff options
context:
space:
mode:
authorJonathan Cameron <jic23@cam.ac.uk>2011-05-18 14:42:22 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2011-05-19 16:15:02 -0700
commit59c85e82c2e7a672cb4342dc5ccf9df8a3a14f73 (patch)
tree7df58c13e2254bf55692a20841bc3553583d11ef /drivers/staging/iio/accel/lis3l02dq_ring.c
parent3b8ebfb47f0cacc82c88b6f886ad84d78d6fdd61 (diff)
staging:iio:trigger handle name attr in core, remove old alloc and register any control_attrs via struct device
As the majority of triggers don't actually have any other control_attrs lets use the fact that struct device has a groups element when we do need to have these attributes registered. A vargs function is used to cut down on lots of building strings in every single driver just in order to pass them into the allocate. Also iio_allocate_trigger_named -> iio_allocate_trigger as there is no unamed version any more, so that is now just confusing. Blackfin tested and fixed by Michael Hennerich. V2: Elements from Michael Hennerich's patches for the ade7758 Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/iio/accel/lis3l02dq_ring.c')
-rw-r--r--drivers/staging/iio/accel/lis3l02dq_ring.c27
1 files changed, 2 insertions, 25 deletions
diff --git a/drivers/staging/iio/accel/lis3l02dq_ring.c b/drivers/staging/iio/accel/lis3l02dq_ring.c
index 83f2bbeb2dcf..2b7219b75fbb 100644
--- a/drivers/staging/iio/accel/lis3l02dq_ring.c
+++ b/drivers/staging/iio/accel/lis3l02dq_ring.c
@@ -260,17 +260,6 @@ static int lis3l02dq_data_rdy_trigger_set_state(struct iio_trigger *trig,
return ret;
}
-static IIO_TRIGGER_NAME_ATTR;
-
-static struct attribute *lis3l02dq_trigger_attrs[] = {
- &dev_attr_name.attr,
- NULL,
-};
-
-static const struct attribute_group lis3l02dq_trigger_attr_group = {
- .attrs = lis3l02dq_trigger_attrs,
-};
-
/**
* lis3l02dq_trig_try_reen() try renabling irq for data rdy trigger
* @trig: the datardy trigger
@@ -301,19 +290,11 @@ int lis3l02dq_probe_trigger(struct iio_dev *indio_dev)
struct iio_sw_ring_helper_state *h
= iio_dev_get_devdata(indio_dev);
struct lis3l02dq_state *st = lis3l02dq_h_to_s(h);
- char *name;
- name = kasprintf(GFP_KERNEL,
- "lis3l02dq-dev%d",
- indio_dev->id);
- if (name == NULL) {
- ret = -ENOMEM;
- goto error_ret;
- }
- st->trig = iio_allocate_trigger_named(name);
+ st->trig = iio_allocate_trigger("lis3l02dq-dev%d", indio_dev->id);
if (!st->trig) {
ret = -ENOMEM;
- goto error_free_name;
+ goto error_ret;
}
st->trig->dev.parent = &st->us->dev;
@@ -321,7 +302,6 @@ int lis3l02dq_probe_trigger(struct iio_dev *indio_dev)
st->trig->private_data = st;
st->trig->set_trigger_state = &lis3l02dq_data_rdy_trigger_set_state;
st->trig->try_reenable = &lis3l02dq_trig_try_reen;
- st->trig->control_attrs = &lis3l02dq_trigger_attr_group;
ret = iio_trigger_register(st->trig);
if (ret)
goto error_free_trig;
@@ -330,8 +310,6 @@ int lis3l02dq_probe_trigger(struct iio_dev *indio_dev)
error_free_trig:
iio_free_trigger(st->trig);
-error_free_name:
- kfree(name);
error_ret:
return ret;
}
@@ -343,7 +321,6 @@ void lis3l02dq_remove_trigger(struct iio_dev *indio_dev)
struct lis3l02dq_state *st = lis3l02dq_h_to_s(h);
iio_trigger_unregister(st->trig);
- kfree(st->trig->name);
iio_free_trigger(st->trig);
}