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

staging:iio:accel:adis16209 move to chan_spec based setup.

For clean drivers its easier to convert to chan_spec based
registration than to work around the scan_el attributes
going away.

Some minor cleanups done whilst here.

Untested.

V2: IIO_CHAN macro used.
Signed-off-by: default avatarJonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent ad3eb9ab
...@@ -119,7 +119,7 @@ struct adis16209_state { ...@@ -119,7 +119,7 @@ struct adis16209_state {
struct mutex buf_lock; struct mutex buf_lock;
}; };
int adis16209_set_irq(struct device *dev, bool enable); int adis16209_set_irq(struct iio_dev *indio_dev, bool enable);
#ifdef CONFIG_IIO_RING_BUFFER #ifdef CONFIG_IIO_RING_BUFFER
......
This diff is collapsed.
...@@ -17,60 +17,6 @@ ...@@ -17,60 +17,6 @@
#include "../trigger.h" #include "../trigger.h"
#include "adis16209.h" #include "adis16209.h"
static IIO_SCAN_EL_C(in_supply, ADIS16209_SCAN_SUPPLY,
ADIS16209_SUPPLY_OUT, NULL);
static IIO_CONST_ATTR_SCAN_EL_TYPE(in_supply, u, 14, 16)
static IIO_SCAN_EL_C(accel_x, ADIS16209_SCAN_ACC_X, ADIS16209_XACCL_OUT, NULL);
static IIO_SCAN_EL_C(accel_y, ADIS16209_SCAN_ACC_Y, ADIS16209_YACCL_OUT, NULL);
static IIO_CONST_ATTR_SCAN_EL_TYPE(accel, s, 14, 16);
static IIO_SCAN_EL_C(in0, ADIS16209_SCAN_AUX_ADC, ADIS16209_AUX_ADC, NULL);
static IIO_CONST_ATTR_SCAN_EL_TYPE(in0, u, 12, 16);
static IIO_SCAN_EL_C(temp, ADIS16209_SCAN_TEMP, ADIS16209_TEMP_OUT, NULL);
static IIO_CONST_ATTR_SCAN_EL_TYPE(temp, u, 12, 16);
static IIO_SCAN_EL_C(incli_x, ADIS16209_SCAN_INCLI_X,
ADIS16209_XINCL_OUT, NULL);
static IIO_SCAN_EL_C(incli_y, ADIS16209_SCAN_INCLI_Y,
ADIS16209_YINCL_OUT, NULL);
static IIO_CONST_ATTR_SCAN_EL_TYPE(incli, s, 14, 16);
static IIO_SCAN_EL_C(rot, ADIS16209_SCAN_ROT, ADIS16209_ROT_OUT, NULL);
static IIO_CONST_ATTR_SCAN_EL_TYPE(rot, s, 14, 16);
static IIO_SCAN_EL_TIMESTAMP(8);
static IIO_CONST_ATTR_SCAN_EL_TYPE(timestamp, s, 64, 64);
static struct attribute *adis16209_scan_el_attrs[] = {
&iio_scan_el_in_supply.dev_attr.attr,
&iio_const_attr_in_supply_index.dev_attr.attr,
&iio_const_attr_in_supply_type.dev_attr.attr,
&iio_scan_el_accel_x.dev_attr.attr,
&iio_const_attr_accel_x_index.dev_attr.attr,
&iio_scan_el_accel_y.dev_attr.attr,
&iio_const_attr_accel_y_index.dev_attr.attr,
&iio_const_attr_accel_type.dev_attr.attr,
&iio_scan_el_in0.dev_attr.attr,
&iio_const_attr_in0_index.dev_attr.attr,
&iio_const_attr_in0_type.dev_attr.attr,
&iio_scan_el_temp.dev_attr.attr,
&iio_const_attr_temp_index.dev_attr.attr,
&iio_const_attr_temp_type.dev_attr.attr,
&iio_scan_el_incli_x.dev_attr.attr,
&iio_const_attr_incli_x_index.dev_attr.attr,
&iio_scan_el_incli_y.dev_attr.attr,
&iio_const_attr_incli_y_index.dev_attr.attr,
&iio_const_attr_incli_type.dev_attr.attr,
&iio_scan_el_rot.dev_attr.attr,
&iio_const_attr_rot_index.dev_attr.attr,
&iio_const_attr_rot_type.dev_attr.attr,
&iio_scan_el_timestamp.dev_attr.attr,
&iio_const_attr_timestamp_index.dev_attr.attr,
&iio_const_attr_timestamp_type.dev_attr.attr,
NULL,
};
static struct attribute_group adis16209_scan_el_group = {
.attrs = adis16209_scan_el_attrs,
.name = "scan_elements",
};
/** /**
* adis16209_read_ring_data() read data registers which will be placed into ring * adis16209_read_ring_data() read data registers which will be placed into ring
* @dev: device associated with child of actual device (iio_dev or iio_trig) * @dev: device associated with child of actual device (iio_dev or iio_trig)
...@@ -171,7 +117,6 @@ int adis16209_configure_ring(struct iio_dev *indio_dev) ...@@ -171,7 +117,6 @@ int adis16209_configure_ring(struct iio_dev *indio_dev)
/* Effectively select the ring buffer implementation */ /* Effectively select the ring buffer implementation */
iio_ring_sw_register_funcs(&ring->access); iio_ring_sw_register_funcs(&ring->access);
ring->bpe = 2; ring->bpe = 2;
ring->scan_el_attrs = &adis16209_scan_el_group;
ring->scan_timestamp = true; ring->scan_timestamp = true;
ring->preenable = &iio_sw_ring_preenable; ring->preenable = &iio_sw_ring_preenable;
ring->postenable = &iio_triggered_ring_postenable; ring->postenable = &iio_triggered_ring_postenable;
...@@ -179,14 +124,14 @@ int adis16209_configure_ring(struct iio_dev *indio_dev) ...@@ -179,14 +124,14 @@ int adis16209_configure_ring(struct iio_dev *indio_dev)
ring->owner = THIS_MODULE; ring->owner = THIS_MODULE;
/* Set default scan mode */ /* Set default scan mode */
iio_scan_mask_set(ring, iio_scan_el_in_supply.number); iio_scan_mask_set(ring, ADIS16209_SCAN_SUPPLY);
iio_scan_mask_set(ring, iio_scan_el_rot.number); iio_scan_mask_set(ring, ADIS16209_SCAN_ACC_X);
iio_scan_mask_set(ring, iio_scan_el_accel_x.number); iio_scan_mask_set(ring, ADIS16209_SCAN_ACC_Y);
iio_scan_mask_set(ring, iio_scan_el_accel_y.number); iio_scan_mask_set(ring, ADIS16209_SCAN_AUX_ADC);
iio_scan_mask_set(ring, iio_scan_el_temp.number); iio_scan_mask_set(ring, ADIS16209_SCAN_TEMP);
iio_scan_mask_set(ring, iio_scan_el_in0.number); iio_scan_mask_set(ring, ADIS16209_SCAN_INCLI_X);
iio_scan_mask_set(ring, iio_scan_el_incli_x.number); iio_scan_mask_set(ring, ADIS16209_SCAN_INCLI_Y);
iio_scan_mask_set(ring, iio_scan_el_incli_y.number); iio_scan_mask_set(ring, ADIS16209_SCAN_ROT);
indio_dev->pollfunc = kzalloc(sizeof(*indio_dev->pollfunc), GFP_KERNEL); indio_dev->pollfunc = kzalloc(sizeof(*indio_dev->pollfunc), GFP_KERNEL);
if (indio_dev->pollfunc == NULL) { if (indio_dev->pollfunc == NULL) {
......
...@@ -42,7 +42,7 @@ static int adis16209_data_rdy_trigger_set_state(struct iio_trigger *trig, ...@@ -42,7 +42,7 @@ static int adis16209_data_rdy_trigger_set_state(struct iio_trigger *trig,
struct iio_dev *indio_dev = st->indio_dev; struct iio_dev *indio_dev = st->indio_dev;
dev_dbg(&indio_dev->dev, "%s (%d)\n", __func__, state); dev_dbg(&indio_dev->dev, "%s (%d)\n", __func__, state);
return adis16209_set_irq(&st->indio_dev->dev, state); return adis16209_set_irq(st->indio_dev, state);
} }
int adis16209_probe_trigger(struct iio_dev *indio_dev) int adis16209_probe_trigger(struct iio_dev *indio_dev)
......
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