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

staging:iio: tree wide IIO_RING_TRIGGERED -> IIO_BUFFER_TRIGGERED

also, IIO_RING_HARDWARE_BUFFER -> IIO_BUFFER_HARDWARE

These aren't always rings so the naming should not imply that.
Signed-off-by: default avatarJonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 3b99fb76
...@@ -132,7 +132,7 @@ int adis16201_configure_ring(struct iio_dev *indio_dev) ...@@ -132,7 +132,7 @@ int adis16201_configure_ring(struct iio_dev *indio_dev)
goto error_iio_sw_rb_free; goto error_iio_sw_rb_free;
} }
indio_dev->modes |= INDIO_RING_TRIGGERED; indio_dev->modes |= INDIO_BUFFER_TRIGGERED;
return 0; return 0;
error_iio_sw_rb_free: error_iio_sw_rb_free:
iio_sw_rb_free(indio_dev->ring); iio_sw_rb_free(indio_dev->ring);
......
...@@ -134,7 +134,7 @@ int adis16203_configure_ring(struct iio_dev *indio_dev) ...@@ -134,7 +134,7 @@ int adis16203_configure_ring(struct iio_dev *indio_dev)
goto error_iio_sw_rb_free; goto error_iio_sw_rb_free;
} }
indio_dev->modes |= INDIO_RING_TRIGGERED; indio_dev->modes |= INDIO_BUFFER_TRIGGERED;
return 0; return 0;
error_iio_sw_rb_free: error_iio_sw_rb_free:
......
...@@ -130,7 +130,7 @@ int adis16204_configure_ring(struct iio_dev *indio_dev) ...@@ -130,7 +130,7 @@ int adis16204_configure_ring(struct iio_dev *indio_dev)
goto error_iio_sw_rb_free; goto error_iio_sw_rb_free;
} }
indio_dev->modes |= INDIO_RING_TRIGGERED; indio_dev->modes |= INDIO_BUFFER_TRIGGERED;
return 0; return 0;
error_iio_sw_rb_free: error_iio_sw_rb_free:
......
...@@ -130,7 +130,7 @@ int adis16209_configure_ring(struct iio_dev *indio_dev) ...@@ -130,7 +130,7 @@ int adis16209_configure_ring(struct iio_dev *indio_dev)
goto error_iio_sw_rb_free; goto error_iio_sw_rb_free;
} }
indio_dev->modes |= INDIO_RING_TRIGGERED; indio_dev->modes |= INDIO_BUFFER_TRIGGERED;
return 0; return 0;
error_iio_sw_rb_free: error_iio_sw_rb_free:
......
...@@ -127,7 +127,7 @@ int adis16240_configure_ring(struct iio_dev *indio_dev) ...@@ -127,7 +127,7 @@ int adis16240_configure_ring(struct iio_dev *indio_dev)
goto error_iio_sw_rb_free; goto error_iio_sw_rb_free;
} }
indio_dev->modes |= INDIO_RING_TRIGGERED; indio_dev->modes |= INDIO_BUFFER_TRIGGERED;
return 0; return 0;
error_iio_sw_rb_free: error_iio_sw_rb_free:
......
...@@ -259,7 +259,7 @@ static int lis3l02dq_read_raw(struct iio_dev *indio_dev, ...@@ -259,7 +259,7 @@ static int lis3l02dq_read_raw(struct iio_dev *indio_dev,
case 0: case 0:
/* Take the iio_dev status lock */ /* Take the iio_dev status lock */
mutex_lock(&indio_dev->mlock); mutex_lock(&indio_dev->mlock);
if (indio_dev->currentmode == INDIO_RING_TRIGGERED) if (indio_dev->currentmode == INDIO_BUFFER_TRIGGERED)
ret = lis3l02dq_read_accel_from_ring(indio_dev->ring, ret = lis3l02dq_read_accel_from_ring(indio_dev->ring,
chan->scan_index, chan->scan_index,
val); val);
...@@ -725,7 +725,7 @@ static int __devinit lis3l02dq_probe(struct spi_device *spi) ...@@ -725,7 +725,7 @@ static int __devinit lis3l02dq_probe(struct spi_device *spi)
return 0; return 0;
error_remove_trigger: error_remove_trigger:
if (indio_dev->modes & INDIO_RING_TRIGGERED) if (indio_dev->modes & INDIO_BUFFER_TRIGGERED)
lis3l02dq_remove_trigger(indio_dev); lis3l02dq_remove_trigger(indio_dev);
error_free_interrupt: error_free_interrupt:
if (spi->irq && gpio_is_valid(irq_to_gpio(spi->irq)) > 0) if (spi->irq && gpio_is_valid(irq_to_gpio(spi->irq)) > 0)
......
...@@ -455,7 +455,7 @@ int lis3l02dq_configure_ring(struct iio_dev *indio_dev) ...@@ -455,7 +455,7 @@ int lis3l02dq_configure_ring(struct iio_dev *indio_dev)
goto error_iio_sw_rb_free; goto error_iio_sw_rb_free;
} }
indio_dev->modes |= INDIO_RING_TRIGGERED; indio_dev->modes |= INDIO_BUFFER_TRIGGERED;
return 0; return 0;
error_iio_sw_rb_free: error_iio_sw_rb_free:
......
...@@ -290,7 +290,7 @@ int sca3000_configure_ring(struct iio_dev *indio_dev) ...@@ -290,7 +290,7 @@ int sca3000_configure_ring(struct iio_dev *indio_dev)
indio_dev->ring = sca3000_rb_allocate(indio_dev); indio_dev->ring = sca3000_rb_allocate(indio_dev);
if (indio_dev->ring == NULL) if (indio_dev->ring == NULL)
return -ENOMEM; return -ENOMEM;
indio_dev->modes |= INDIO_RING_HARDWARE_BUFFER; indio_dev->modes |= INDIO_BUFFER_HARDWARE;
indio_dev->ring->access = &sca3000_ring_access_funcs; indio_dev->ring->access = &sca3000_ring_access_funcs;
......
...@@ -595,7 +595,7 @@ static int ad7192_register_ring_funcs_and_init(struct iio_dev *indio_dev) ...@@ -595,7 +595,7 @@ static int ad7192_register_ring_funcs_and_init(struct iio_dev *indio_dev)
indio_dev->ring->setup_ops = &ad7192_ring_setup_ops; indio_dev->ring->setup_ops = &ad7192_ring_setup_ops;
/* Flag that polled ring buffering is possible */ /* Flag that polled ring buffering is possible */
indio_dev->modes |= INDIO_RING_TRIGGERED; indio_dev->modes |= INDIO_BUFFER_TRIGGERED;
return 0; return 0;
error_deallocate_sw_rb: error_deallocate_sw_rb:
......
...@@ -178,7 +178,7 @@ int ad7298_register_ring_funcs_and_init(struct iio_dev *indio_dev) ...@@ -178,7 +178,7 @@ int ad7298_register_ring_funcs_and_init(struct iio_dev *indio_dev)
indio_dev->ring->scan_timestamp = true; indio_dev->ring->scan_timestamp = true;
/* Flag that polled ring buffering is possible */ /* Flag that polled ring buffering is possible */
indio_dev->modes |= INDIO_RING_TRIGGERED; indio_dev->modes |= INDIO_BUFFER_TRIGGERED;
return 0; return 0;
error_deallocate_sw_rb: error_deallocate_sw_rb:
......
...@@ -141,7 +141,7 @@ int ad7476_register_ring_funcs_and_init(struct iio_dev *indio_dev) ...@@ -141,7 +141,7 @@ int ad7476_register_ring_funcs_and_init(struct iio_dev *indio_dev)
indio_dev->ring->scan_timestamp = true; indio_dev->ring->scan_timestamp = true;
/* Flag that polled ring buffering is possible */ /* Flag that polled ring buffering is possible */
indio_dev->modes |= INDIO_RING_TRIGGERED; indio_dev->modes |= INDIO_BUFFER_TRIGGERED;
return 0; return 0;
error_deallocate_sw_rb: error_deallocate_sw_rb:
......
...@@ -186,7 +186,7 @@ int ad7606_register_ring_funcs_and_init(struct iio_dev *indio_dev) ...@@ -186,7 +186,7 @@ int ad7606_register_ring_funcs_and_init(struct iio_dev *indio_dev)
INIT_WORK(&st->poll_work, &ad7606_poll_bh_to_ring); INIT_WORK(&st->poll_work, &ad7606_poll_bh_to_ring);
/* Flag that polled ring buffering is possible */ /* Flag that polled ring buffering is possible */
indio_dev->modes |= INDIO_RING_TRIGGERED; indio_dev->modes |= INDIO_BUFFER_TRIGGERED;
return 0; return 0;
error_deallocate_sw_rb: error_deallocate_sw_rb:
......
...@@ -461,7 +461,7 @@ static int ad7793_register_ring_funcs_and_init(struct iio_dev *indio_dev) ...@@ -461,7 +461,7 @@ static int ad7793_register_ring_funcs_and_init(struct iio_dev *indio_dev)
indio_dev->ring->setup_ops = &ad7793_ring_setup_ops; indio_dev->ring->setup_ops = &ad7793_ring_setup_ops;
/* Flag that polled ring buffering is possible */ /* Flag that polled ring buffering is possible */
indio_dev->modes |= INDIO_RING_TRIGGERED; indio_dev->modes |= INDIO_BUFFER_TRIGGERED;
return 0; return 0;
error_deallocate_sw_rb: error_deallocate_sw_rb:
......
...@@ -179,7 +179,7 @@ int ad7887_register_ring_funcs_and_init(struct iio_dev *indio_dev) ...@@ -179,7 +179,7 @@ int ad7887_register_ring_funcs_and_init(struct iio_dev *indio_dev)
indio_dev->ring->setup_ops = &ad7887_ring_setup_ops; indio_dev->ring->setup_ops = &ad7887_ring_setup_ops;
/* Flag that polled ring buffering is possible */ /* Flag that polled ring buffering is possible */
indio_dev->modes |= INDIO_RING_TRIGGERED; indio_dev->modes |= INDIO_BUFFER_TRIGGERED;
return 0; return 0;
error_deallocate_sw_rb: error_deallocate_sw_rb:
......
...@@ -187,7 +187,7 @@ int ad799x_register_ring_funcs_and_init(struct iio_dev *indio_dev) ...@@ -187,7 +187,7 @@ int ad799x_register_ring_funcs_and_init(struct iio_dev *indio_dev)
indio_dev->ring->scan_timestamp = true; indio_dev->ring->scan_timestamp = true;
/* Flag that polled ring buffering is possible */ /* Flag that polled ring buffering is possible */
indio_dev->modes |= INDIO_RING_TRIGGERED; indio_dev->modes |= INDIO_BUFFER_TRIGGERED;
return 0; return 0;
error_deallocate_sw_rb: error_deallocate_sw_rb:
......
...@@ -182,7 +182,7 @@ int max1363_register_ring_funcs_and_init(struct iio_dev *indio_dev) ...@@ -182,7 +182,7 @@ int max1363_register_ring_funcs_and_init(struct iio_dev *indio_dev)
indio_dev->ring->setup_ops = &max1363_ring_setup_ops; indio_dev->ring->setup_ops = &max1363_ring_setup_ops;
/* Flag that polled ring buffering is possible */ /* Flag that polled ring buffering is possible */
indio_dev->modes |= INDIO_RING_TRIGGERED; indio_dev->modes |= INDIO_BUFFER_TRIGGERED;
return 0; return 0;
......
...@@ -131,7 +131,7 @@ int adis16260_configure_ring(struct iio_dev *indio_dev) ...@@ -131,7 +131,7 @@ int adis16260_configure_ring(struct iio_dev *indio_dev)
goto error_iio_sw_rb_free; goto error_iio_sw_rb_free;
} }
indio_dev->modes |= INDIO_RING_TRIGGERED; indio_dev->modes |= INDIO_BUFFER_TRIGGERED;
return 0; return 0;
error_iio_sw_rb_free: error_iio_sw_rb_free:
......
...@@ -189,10 +189,11 @@ static inline s64 iio_get_time_ns(void) ...@@ -189,10 +189,11 @@ static inline s64 iio_get_time_ns(void)
/* Device operating modes */ /* Device operating modes */
#define INDIO_DIRECT_MODE 0x01 #define INDIO_DIRECT_MODE 0x01
#define INDIO_RING_TRIGGERED 0x02 #define INDIO_BUFFER_TRIGGERED 0x02
#define INDIO_RING_HARDWARE_BUFFER 0x08 #define INDIO_BUFFER_HARDWARE 0x08
#define INDIO_ALL_RING_MODES (INDIO_RING_TRIGGERED | INDIO_RING_HARDWARE_BUFFER) #define INDIO_ALL_BUFFER_MODES \
(INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE)
/* Vast majority of this is set by the industrialio subsystem on a /* Vast majority of this is set by the industrialio subsystem on a
* call to iio_device_register. */ * call to iio_device_register. */
...@@ -388,8 +389,7 @@ void iio_free_device(struct iio_dev *dev); ...@@ -388,8 +389,7 @@ void iio_free_device(struct iio_dev *dev);
static inline bool iio_ring_enabled(struct iio_dev *dev_info) static inline bool iio_ring_enabled(struct iio_dev *dev_info)
{ {
return dev_info->currentmode return dev_info->currentmode
& (INDIO_RING_TRIGGERED & (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE);
| INDIO_RING_HARDWARE_BUFFER);
}; };
#endif /* _INDUSTRIAL_IO_H_ */ #endif /* _INDUSTRIAL_IO_H_ */
...@@ -612,7 +612,7 @@ static int ad5933_register_ring_funcs_and_init(struct iio_dev *indio_dev) ...@@ -612,7 +612,7 @@ static int ad5933_register_ring_funcs_and_init(struct iio_dev *indio_dev)
/* Ring buffer functions - here trigger setup related */ /* Ring buffer functions - here trigger setup related */
indio_dev->ring->setup_ops = &ad5933_ring_setup_ops; indio_dev->ring->setup_ops = &ad5933_ring_setup_ops;
indio_dev->modes |= INDIO_RING_HARDWARE_BUFFER; indio_dev->modes |= INDIO_BUFFER_HARDWARE;
return 0; return 0;
} }
......
...@@ -1070,7 +1070,7 @@ static int __devinit adis16400_probe(struct spi_device *spi) ...@@ -1070,7 +1070,7 @@ static int __devinit adis16400_probe(struct spi_device *spi)
return 0; return 0;
error_remove_trigger: error_remove_trigger:
if (indio_dev->modes & INDIO_RING_TRIGGERED) if (indio_dev->modes & INDIO_BUFFER_TRIGGERED)
adis16400_remove_trigger(indio_dev); adis16400_remove_trigger(indio_dev);
error_uninitialize_ring: error_uninitialize_ring:
iio_ring_buffer_unregister(indio_dev); iio_ring_buffer_unregister(indio_dev);
......
...@@ -203,7 +203,7 @@ int adis16400_configure_ring(struct iio_dev *indio_dev) ...@@ -203,7 +203,7 @@ int adis16400_configure_ring(struct iio_dev *indio_dev)
goto error_iio_sw_rb_free; goto error_iio_sw_rb_free;
} }
indio_dev->modes |= INDIO_RING_TRIGGERED; indio_dev->modes |= INDIO_BUFFER_TRIGGERED;
return 0; return 0;
error_iio_sw_rb_free: error_iio_sw_rb_free:
iio_sw_rb_free(indio_dev->ring); iio_sw_rb_free(indio_dev->ring);
......
...@@ -998,7 +998,7 @@ static void iio_dev_release(struct device *device) ...@@ -998,7 +998,7 @@ static void iio_dev_release(struct device *device)
{ {
struct iio_dev *dev_info = container_of(device, struct iio_dev, dev); struct iio_dev *dev_info = container_of(device, struct iio_dev, dev);
cdev_del(&dev_info->chrdev); cdev_del(&dev_info->chrdev);
if (dev_info->modes & INDIO_RING_TRIGGERED) if (dev_info->modes & INDIO_BUFFER_TRIGGERED)
iio_device_unregister_trigger_consumer(dev_info); iio_device_unregister_trigger_consumer(dev_info);
iio_device_unregister_eventset(dev_info); iio_device_unregister_eventset(dev_info);
iio_device_unregister_sysfs(dev_info); iio_device_unregister_sysfs(dev_info);
...@@ -1126,7 +1126,7 @@ int iio_device_register(struct iio_dev *dev_info) ...@@ -1126,7 +1126,7 @@ int iio_device_register(struct iio_dev *dev_info)
"Failed to register event set\n"); "Failed to register event set\n");
goto error_free_sysfs; goto error_free_sysfs;
} }
if (dev_info->modes & INDIO_RING_TRIGGERED) if (dev_info->modes & INDIO_BUFFER_TRIGGERED)
iio_device_register_trigger_consumer(dev_info); iio_device_register_trigger_consumer(dev_info);
ret = device_add(&dev_info->dev); ret = device_add(&dev_info->dev);
......
...@@ -150,7 +150,7 @@ static ssize_t iio_scan_el_store(struct device *dev, ...@@ -150,7 +150,7 @@ static ssize_t iio_scan_el_store(struct device *dev,
state = !(buf[0] == '0'); state = !(buf[0] == '0');
mutex_lock(&indio_dev->mlock); mutex_lock(&indio_dev->mlock);
if (indio_dev->currentmode == INDIO_RING_TRIGGERED) { if (indio_dev->currentmode == INDIO_BUFFER_TRIGGERED) {
ret = -EBUSY; ret = -EBUSY;
goto error_ret; goto error_ret;
} }
...@@ -193,7 +193,7 @@ static ssize_t iio_scan_el_ts_store(struct device *dev, ...@@ -193,7 +193,7 @@ static ssize_t iio_scan_el_ts_store(struct device *dev,
state = !(buf[0] == '0'); state = !(buf[0] == '0');
mutex_lock(&indio_dev->mlock); mutex_lock(&indio_dev->mlock);
if (indio_dev->currentmode == INDIO_RING_TRIGGERED) { if (indio_dev->currentmode == INDIO_BUFFER_TRIGGERED) {
ret = -EBUSY; ret = -EBUSY;
goto error_ret; goto error_ret;
} }
...@@ -430,7 +430,7 @@ ssize_t iio_store_ring_enable(struct device *dev, ...@@ -430,7 +430,7 @@ ssize_t iio_store_ring_enable(struct device *dev,
mutex_lock(&dev_info->mlock); mutex_lock(&dev_info->mlock);
previous_mode = dev_info->currentmode; previous_mode = dev_info->currentmode;
requested_state = !(buf[0] == '0'); requested_state = !(buf[0] == '0');
current_state = !!(previous_mode & INDIO_ALL_RING_MODES); current_state = !!(previous_mode & INDIO_ALL_BUFFER_MODES);
if (current_state == requested_state) { if (current_state == requested_state) {
printk(KERN_INFO "iio-ring, current state requested again\n"); printk(KERN_INFO "iio-ring, current state requested again\n");
goto done; goto done;
...@@ -457,7 +457,7 @@ ssize_t iio_store_ring_enable(struct device *dev, ...@@ -457,7 +457,7 @@ ssize_t iio_store_ring_enable(struct device *dev,
if (ring->access->mark_in_use) if (ring->access->mark_in_use)
ring->access->mark_in_use(ring); ring->access->mark_in_use(ring);
/* Definitely possible for devices to support both of these.*/ /* Definitely possible for devices to support both of these.*/
if (dev_info->modes & INDIO_RING_TRIGGERED) { if (dev_info->modes & INDIO_BUFFER_TRIGGERED) {
if (!dev_info->trig) { if (!dev_info->trig) {
printk(KERN_INFO printk(KERN_INFO
"Buffer not started: no trigger\n"); "Buffer not started: no trigger\n");
...@@ -466,9 +466,9 @@ ssize_t iio_store_ring_enable(struct device *dev, ...@@ -466,9 +466,9 @@ ssize_t iio_store_ring_enable(struct device *dev,
ring->access->unmark_in_use(ring); ring->access->unmark_in_use(ring);
goto error_ret; goto error_ret;
} }
dev_info->currentmode = INDIO_RING_TRIGGERED; dev_info->currentmode = INDIO_BUFFER_TRIGGERED;
} else if (dev_info->modes & INDIO_RING_HARDWARE_BUFFER) } else if (dev_info->modes & INDIO_BUFFER_HARDWARE)
dev_info->currentmode = INDIO_RING_HARDWARE_BUFFER; dev_info->currentmode = INDIO_BUFFER_HARDWARE;
else { /* should never be reached */ else { /* should never be reached */
ret = -EINVAL; ret = -EINVAL;
goto error_ret; goto error_ret;
...@@ -519,7 +519,7 @@ ssize_t iio_show_ring_enable(struct device *dev, ...@@ -519,7 +519,7 @@ ssize_t iio_show_ring_enable(struct device *dev,
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *dev_info = dev_get_drvdata(dev);
return sprintf(buf, "%d\n", !!(dev_info->currentmode return sprintf(buf, "%d\n", !!(dev_info->currentmode
& INDIO_ALL_RING_MODES)); & INDIO_ALL_BUFFER_MODES));
} }
EXPORT_SYMBOL(iio_show_ring_enable); EXPORT_SYMBOL(iio_show_ring_enable);
......
...@@ -329,7 +329,7 @@ static ssize_t iio_trigger_write_current(struct device *dev, ...@@ -329,7 +329,7 @@ static ssize_t iio_trigger_write_current(struct device *dev,
int ret; int ret;
mutex_lock(&dev_info->mlock); mutex_lock(&dev_info->mlock);
if (dev_info->currentmode == INDIO_RING_TRIGGERED) { if (dev_info->currentmode == INDIO_BUFFER_TRIGGERED) {
mutex_unlock(&dev_info->mlock); mutex_unlock(&dev_info->mlock);
return -EBUSY; return -EBUSY;
} }
......
...@@ -801,7 +801,7 @@ static int __devinit ade7758_probe(struct spi_device *spi) ...@@ -801,7 +801,7 @@ static int __devinit ade7758_probe(struct spi_device *spi)
return 0; return 0;
error_remove_trigger: error_remove_trigger:
if (indio_dev->modes & INDIO_RING_TRIGGERED) if (indio_dev->modes & INDIO_BUFFER_TRIGGERED)
ade7758_remove_trigger(indio_dev); ade7758_remove_trigger(indio_dev);
error_uninitialize_ring: error_uninitialize_ring:
ade7758_uninitialize_ring(indio_dev); ade7758_uninitialize_ring(indio_dev);
......
...@@ -158,7 +158,7 @@ int ade7758_configure_ring(struct iio_dev *indio_dev) ...@@ -158,7 +158,7 @@ int ade7758_configure_ring(struct iio_dev *indio_dev)
goto error_iio_sw_rb_free; goto error_iio_sw_rb_free;
} }
indio_dev->modes |= INDIO_RING_TRIGGERED; indio_dev->modes |= INDIO_BUFFER_TRIGGERED;
st->tx_buf[0] = ADE7758_READ_REG(ADE7758_RSTATUS); st->tx_buf[0] = ADE7758_READ_REG(ADE7758_RSTATUS);
st->tx_buf[1] = 0; st->tx_buf[1] = 0;
......
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