summaryrefslogtreecommitdiffstats
path: root/drivers/staging/iio/meter
diff options
context:
space:
mode:
authorJonathan Cameron2011-05-18 15:42:22 +0200
committerGreg Kroah-Hartman2011-05-20 01:15:02 +0200
commit59c85e82c2e7a672cb4342dc5ccf9df8a3a14f73 (patch)
tree7df58c13e2254bf55692a20841bc3553583d11ef /drivers/staging/iio/meter
parentstaging:iio: iio_event_interfaces - clean out unused elements (diff)
downloadkernel-qcow2-linux-59c85e82c2e7a672cb4342dc5ccf9df8a3a14f73.tar.gz
kernel-qcow2-linux-59c85e82c2e7a672cb4342dc5ccf9df8a3a14f73.tar.xz
kernel-qcow2-linux-59c85e82c2e7a672cb4342dc5ccf9df8a3a14f73.zip
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/meter')
-rw-r--r--drivers/staging/iio/meter/ade7758_trigger.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/drivers/staging/iio/meter/ade7758_trigger.c b/drivers/staging/iio/meter/ade7758_trigger.c
index 06c921db9169..5442d796357c 100644
--- a/drivers/staging/iio/meter/ade7758_trigger.c
+++ b/drivers/staging/iio/meter/ade7758_trigger.c
@@ -61,21 +61,13 @@ int ade7758_probe_trigger(struct iio_dev *indio_dev)
{
int ret;
struct ade7758_state *st = indio_dev->dev_data;
- char *name;
- name = kasprintf(GFP_KERNEL,
- "%s-dev%d",
- spi_get_device_id(st->us)->name,
- indio_dev->id);
- if (name == NULL) {
- ret = -ENOMEM;
- goto error_ret;
- }
-
- st->trig = iio_allocate_trigger_named(name);
+ st->trig = iio_allocate_trigger("%s-dev%d",
+ spi_get_device_id(st->us)->name,
+ indio_dev->id);
if (st->trig == NULL) {
ret = -ENOMEM;
- goto error_free_name;
+ goto error_ret;
}
ret = request_irq(st->us->irq,
@@ -104,8 +96,6 @@ error_free_irq:
free_irq(st->us->irq, st->trig);
error_free_trig:
iio_free_trigger(st->trig);
-error_free_name:
- kfree(name);
error_ret:
return ret;
}
@@ -115,7 +105,6 @@ void ade7758_remove_trigger(struct iio_dev *indio_dev)
struct ade7758_state *state = indio_dev->dev_data;
iio_trigger_unregister(state->trig);
- kfree(state->trig->name);
free_irq(state->us->irq, state->trig);
iio_free_trigger(state->trig);
}