staging: iio: Add stubs for iio_ring_buffer_[un]register and equivalent driver stubs

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Barry Song <21cnbao@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Jonathan Cameron 2010-07-11 16:39:14 +01:00 committed by Greg Kroah-Hartman
parent e0bcb775e8
commit 2662051e08
24 changed files with 42 additions and 190 deletions

View File

@ -147,8 +147,6 @@ ssize_t adis16209_read_data_from_ring(struct device *dev,
int adis16209_configure_ring(struct iio_dev *indio_dev);
void adis16209_unconfigure_ring(struct iio_dev *indio_dev);
int adis16209_initialize_ring(struct iio_ring_buffer *ring);
void adis16209_uninitialize_ring(struct iio_ring_buffer *ring);
#else /* CONFIG_IIO_RING_BUFFER */
static inline void adis16209_remove_trigger(struct iio_dev *indio_dev)
@ -177,14 +175,5 @@ static inline void adis16209_unconfigure_ring(struct iio_dev *indio_dev)
{
}
static inline int adis16209_initialize_ring(struct iio_ring_buffer *ring)
{
return 0;
}
static inline void adis16209_uninitialize_ring(struct iio_ring_buffer *ring)
{
}
#endif /* CONFIG_IIO_RING_BUFFER */
#endif /* SPI_ADIS16209_H_ */

View File

@ -20,6 +20,7 @@
#include "../iio.h"
#include "../sysfs.h"
#include "../ring_generic.h"
#include "accel.h"
#include "inclinometer.h"
#include "../gyro/gyro.h"
@ -520,7 +521,7 @@ static int __devinit adis16209_probe(struct spi_device *spi)
goto error_unreg_ring_funcs;
regdone = 1;
ret = adis16209_initialize_ring(st->indio_dev->ring);
ret = iio_ring_buffer_register(st->indio_dev->ring, 0);
if (ret) {
printk(KERN_ERR "failed to initialize the ring\n");
goto error_unreg_ring_funcs;
@ -552,7 +553,7 @@ error_unregister_line:
if (spi->irq)
iio_unregister_interrupt_line(st->indio_dev, 0);
error_uninitialize_ring:
adis16209_uninitialize_ring(st->indio_dev->ring);
iio_ring_buffer_unregister(st->indio_dev->ring);
error_unreg_ring_funcs:
adis16209_unconfigure_ring(st->indio_dev);
error_free_dev:
@ -581,7 +582,7 @@ static int adis16209_remove(struct spi_device *spi)
if (spi->irq)
iio_unregister_interrupt_line(indio_dev, 0);
adis16209_uninitialize_ring(indio_dev->ring);
iio_ring_buffer_unregister(indio_dev->ring);
iio_device_unregister(indio_dev);
adis16209_unconfigure_ring(indio_dev);
kfree(st->tx);

View File

@ -225,13 +225,3 @@ error_iio_sw_rb_free:
iio_sw_rb_free(indio_dev->ring);
return ret;
}
int adis16209_initialize_ring(struct iio_ring_buffer *ring)
{
return iio_ring_buffer_register(ring, 0);
}
void adis16209_uninitialize_ring(struct iio_ring_buffer *ring)
{
iio_ring_buffer_unregister(ring);
}

View File

@ -173,8 +173,6 @@ ssize_t adis16240_read_data_from_ring(struct device *dev,
int adis16240_configure_ring(struct iio_dev *indio_dev);
void adis16240_unconfigure_ring(struct iio_dev *indio_dev);
int adis16240_initialize_ring(struct iio_ring_buffer *ring);
void adis16240_uninitialize_ring(struct iio_ring_buffer *ring);
#else /* CONFIG_IIO_RING_BUFFER */
static inline void adis16240_remove_trigger(struct iio_dev *indio_dev)
@ -203,14 +201,5 @@ static inline void adis16240_unconfigure_ring(struct iio_dev *indio_dev)
{
}
static inline int adis16240_initialize_ring(struct iio_ring_buffer *ring)
{
return 0;
}
static inline void adis16240_uninitialize_ring(struct iio_ring_buffer *ring)
{
}
#endif /* CONFIG_IIO_RING_BUFFER */
#endif /* SPI_ADIS16240_H_ */

View File

@ -20,6 +20,7 @@
#include "../iio.h"
#include "../sysfs.h"
#include "../ring_generic.h"
#include "accel.h"
#include "../adc/adc.h"
@ -502,7 +503,7 @@ static int __devinit adis16240_probe(struct spi_device *spi)
goto error_unreg_ring_funcs;
regdone = 1;
ret = adis16240_initialize_ring(st->indio_dev->ring);
ret = iio_ring_buffer_register(st->indio_dev->ring, 0);
if (ret) {
printk(KERN_ERR "failed to initialize the ring\n");
goto error_unreg_ring_funcs;
@ -534,7 +535,7 @@ error_unregister_line:
if (spi->irq)
iio_unregister_interrupt_line(st->indio_dev, 0);
error_uninitialize_ring:
adis16240_uninitialize_ring(st->indio_dev->ring);
iio_ring_buffer_unregister(st->indio_dev->ring);
error_unreg_ring_funcs:
adis16240_unconfigure_ring(st->indio_dev);
error_free_dev:
@ -563,7 +564,7 @@ static int adis16240_remove(struct spi_device *spi)
if (spi->irq)
iio_unregister_interrupt_line(indio_dev, 0);
adis16240_uninitialize_ring(indio_dev->ring);
iio_ring_buffer_unregister(indio_dev->ring);
iio_device_unregister(indio_dev);
adis16240_unconfigure_ring(indio_dev);
kfree(st->tx);

View File

@ -214,12 +214,3 @@ error_iio_sw_rb_free:
return ret;
}
int adis16240_initialize_ring(struct iio_ring_buffer *ring)
{
return iio_ring_buffer_register(ring, 0);
}
void adis16240_uninitialize_ring(struct iio_ring_buffer *ring)
{
iio_ring_buffer_unregister(ring);
}

View File

@ -195,8 +195,6 @@ ssize_t lis3l02dq_read_accel_from_ring(struct device *dev,
int lis3l02dq_configure_ring(struct iio_dev *indio_dev);
void lis3l02dq_unconfigure_ring(struct iio_dev *indio_dev);
int lis3l02dq_initialize_ring(struct iio_ring_buffer *ring);
void lis3l02dq_uninitialize_ring(struct iio_ring_buffer *ring);
#else /* CONFIG_IIO_RING_BUFFER */
static inline void lis3l02dq_remove_trigger(struct iio_dev *indio_dev)
@ -222,12 +220,5 @@ static int lis3l02dq_configure_ring(struct iio_dev *indio_dev)
static inline void lis3l02dq_unconfigure_ring(struct iio_dev *indio_dev)
{
}
static inline int lis3l02dq_initialize_ring(struct iio_ring_buffer *ring)
{
return 0;
}
static inline void lis3l02dq_uninitialize_ring(struct iio_ring_buffer *ring)
{
}
#endif /* CONFIG_IIO_RING_BUFFER */
#endif /* SPI_LIS3L02DQ_H_ */

View File

@ -27,6 +27,7 @@
#include "../iio.h"
#include "../sysfs.h"
#include "../ring_generic.h"
#include "accel.h"
#include "lis3l02dq.h"
@ -791,7 +792,7 @@ static int __devinit lis3l02dq_probe(struct spi_device *spi)
goto error_unreg_ring_funcs;
regdone = 1;
ret = lis3l02dq_initialize_ring(st->indio_dev->ring);
ret = iio_ring_buffer_register(st->indio_dev->ring, 0);
if (ret) {
printk(KERN_ERR "failed to initialize the ring\n");
goto error_unreg_ring_funcs;
@ -825,7 +826,7 @@ error_unregister_line:
if (st->indio_dev->modes & INDIO_RING_TRIGGERED)
iio_unregister_interrupt_line(st->indio_dev, 0);
error_uninitialize_ring:
lis3l02dq_uninitialize_ring(st->indio_dev->ring);
iio_ring_buffer_unregister(st->indio_dev->ring);
error_unreg_ring_funcs:
lis3l02dq_unconfigure_ring(st->indio_dev);
error_free_dev:
@ -886,7 +887,7 @@ static int lis3l02dq_remove(struct spi_device *spi)
if (spi->irq && gpio_is_valid(irq_to_gpio(spi->irq)) > 0)
iio_unregister_interrupt_line(indio_dev, 0);
lis3l02dq_uninitialize_ring(indio_dev->ring);
iio_ring_buffer_unregister(indio_dev->ring);
lis3l02dq_unconfigure_ring(indio_dev);
iio_device_unregister(indio_dev);
kfree(st->tx);

View File

@ -559,15 +559,5 @@ error_iio_sw_rb_free:
return ret;
}
int lis3l02dq_initialize_ring(struct iio_ring_buffer *ring)
{
return iio_ring_buffer_register(ring, 0);
}
void lis3l02dq_uninitialize_ring(struct iio_ring_buffer *ring)
{
iio_ring_buffer_unregister(ring);
}

View File

@ -230,26 +230,13 @@ int max1363_single_channel_from_ring(long mask, struct max1363_state *st);
int max1363_register_ring_funcs_and_init(struct iio_dev *indio_dev);
void max1363_ring_cleanup(struct iio_dev *indio_dev);
int max1363_initialize_ring(struct iio_ring_buffer *ring);
void max1363_uninitialize_ring(struct iio_ring_buffer *ring);
#else /* CONFIG_MAX1363_RING_BUFFER */
static inline void max1363_uninitialize_ring(struct iio_ring_buffer *ring)
{
}
static inline int max1363_initialize_ring(struct iio_ring_buffer *ring)
{
return 0;
}
int max1363_single_channel_from_ring(long mask, struct max1363_state *st)
{
return -EINVAL;
}
static inline int
max1363_register_ring_funcs_and_init(struct iio_dev *indio_dev)
{

View File

@ -1653,7 +1653,7 @@ static int __devinit max1363_probe(struct i2c_client *client,
if (ret)
goto error_cleanup_ring;
regdone = 1;
ret = max1363_initialize_ring(st->indio_dev->ring);
ret = iio_ring_buffer_register(st->indio_dev->ring, 0);
if (ret)
goto error_cleanup_ring;
@ -1671,7 +1671,7 @@ static int __devinit max1363_probe(struct i2c_client *client,
return 0;
error_uninit_ring:
max1363_uninitialize_ring(st->indio_dev->ring);
iio_ring_buffer_unregister(st->indio_dev->ring);
error_cleanup_ring:
max1363_ring_cleanup(st->indio_dev);
error_free_available_scan_masks:
@ -1700,7 +1700,7 @@ static int max1363_remove(struct i2c_client *client)
if (st->chip_info->monitor_mode && client->irq)
iio_unregister_interrupt_line(st->indio_dev, 0);
max1363_uninitialize_ring(indio_dev->ring);
iio_ring_buffer_unregister(indio_dev->ring);
max1363_ring_cleanup(indio_dev);
kfree(st->indio_dev->available_scan_masks);
iio_device_unregister(indio_dev);

View File

@ -224,13 +224,3 @@ void max1363_ring_cleanup(struct iio_dev *indio_dev)
kfree(indio_dev->pollfunc);
iio_sw_rb_free(indio_dev->ring);
}
void max1363_uninitialize_ring(struct iio_ring_buffer *ring)
{
iio_ring_buffer_unregister(ring);
}
int max1363_initialize_ring(struct iio_ring_buffer *ring)
{
return iio_ring_buffer_register(ring, 0);
}

View File

@ -130,8 +130,6 @@ ssize_t adis16260_read_data_from_ring(struct device *dev,
int adis16260_configure_ring(struct iio_dev *indio_dev);
void adis16260_unconfigure_ring(struct iio_dev *indio_dev);
int adis16260_initialize_ring(struct iio_ring_buffer *ring);
void adis16260_uninitialize_ring(struct iio_ring_buffer *ring);
#else /* CONFIG_IIO_RING_BUFFER */
static inline void adis16260_remove_trigger(struct iio_dev *indio_dev)
@ -160,14 +158,5 @@ static inline void adis16260_unconfigure_ring(struct iio_dev *indio_dev)
{
}
static inline int adis16260_initialize_ring(struct iio_ring_buffer *ring)
{
return 0;
}
static inline void adis16260_uninitialize_ring(struct iio_ring_buffer *ring)
{
}
#endif /* CONFIG_IIO_RING_BUFFER */
#endif /* SPI_ADIS16260_H_ */

View File

@ -20,6 +20,7 @@
#include "../iio.h"
#include "../sysfs.h"
#include "../ring_generic.h"
#include "../adc/adc.h"
#include "gyro.h"
@ -555,8 +556,7 @@ static int __devinit adis16260_probe(struct spi_device *spi)
if (ret)
goto error_unreg_ring_funcs;
regdone = 1;
ret = adis16260_initialize_ring(st->indio_dev->ring);
ret = iio_ring_buffer_register(st->indio_dev->ring, 0);
if (ret) {
printk(KERN_ERR "failed to initialize the ring\n");
goto error_unreg_ring_funcs;
@ -588,7 +588,7 @@ error_unregister_line:
if (spi->irq)
iio_unregister_interrupt_line(st->indio_dev, 0);
error_uninitialize_ring:
adis16260_uninitialize_ring(st->indio_dev->ring);
iio_ring_buffer_unregister(st->indio_dev->ring);
error_unreg_ring_funcs:
adis16260_unconfigure_ring(st->indio_dev);
error_free_dev:
@ -622,15 +622,13 @@ static int adis16260_remove(struct spi_device *spi)
if (spi->irq)
iio_unregister_interrupt_line(indio_dev, 0);
adis16260_uninitialize_ring(indio_dev->ring);
iio_ring_buffer_unregister(st->indio_dev->ring);
iio_device_unregister(indio_dev);
adis16260_unconfigure_ring(indio_dev);
kfree(st->tx);
kfree(st->rx);
kfree(st);
return 0;
err_ret:
return ret;
}

View File

@ -215,13 +215,3 @@ error_iio_sw_rb_free:
iio_sw_rb_free(indio_dev->ring);
return ret;
}
int adis16260_initialize_ring(struct iio_ring_buffer *ring)
{
return iio_ring_buffer_register(ring, 0);
}
void adis16260_uninitialize_ring(struct iio_ring_buffer *ring)
{
iio_ring_buffer_unregister(ring);
}

View File

@ -20,6 +20,7 @@
#include "../iio.h"
#include "../sysfs.h"
#include "../ring_generic.h"
#include "../accel/accel.h"
#include "../accel/inclinometer.h"
#include "../gyro/gyro.h"
@ -644,7 +645,7 @@ static int __devinit adis16300_probe(struct spi_device *spi)
goto error_unreg_ring_funcs;
regdone = 1;
ret = adis16300_initialize_ring(st->indio_dev->ring);
ret = iio_ring_buffer_register(st->indio_dev->ring, 0);
if (ret) {
printk(KERN_ERR "failed to initialize the ring\n");
goto error_unreg_ring_funcs;
@ -676,7 +677,7 @@ error_unregister_line:
if (spi->irq)
iio_unregister_interrupt_line(st->indio_dev, 0);
error_uninitialize_ring:
adis16300_uninitialize_ring(st->indio_dev->ring);
iio_ring_buffer_unregister(st->indio_dev->ring);
error_unreg_ring_funcs:
adis16300_unconfigure_ring(st->indio_dev);
error_free_dev:
@ -710,7 +711,7 @@ static int adis16300_remove(struct spi_device *spi)
if (spi->irq)
iio_unregister_interrupt_line(indio_dev, 0);
adis16300_uninitialize_ring(indio_dev->ring);
iio_ring_buffer_unregister(indio_dev->ring);
iio_device_unregister(indio_dev);
adis16300_unconfigure_ring(indio_dev);
kfree(st->tx);

View File

@ -241,12 +241,3 @@ error_iio_sw_rb_free:
return ret;
}
int adis16300_initialize_ring(struct iio_ring_buffer *ring)
{
return iio_ring_buffer_register(ring, 0);
}
void adis16300_uninitialize_ring(struct iio_ring_buffer *ring)
{
iio_ring_buffer_unregister(ring);
}

View File

@ -148,8 +148,6 @@ ssize_t adis16350_read_data_from_ring(struct device *dev,
int adis16350_configure_ring(struct iio_dev *indio_dev);
void adis16350_unconfigure_ring(struct iio_dev *indio_dev);
int adis16350_initialize_ring(struct iio_ring_buffer *ring);
void adis16350_uninitialize_ring(struct iio_ring_buffer *ring);
#else /* CONFIG_IIO_RING_BUFFER */
static inline void adis16350_remove_trigger(struct iio_dev *indio_dev)
@ -169,23 +167,5 @@ adis16350_read_data_from_ring(struct device *dev,
return 0;
}
static int adis16350_configure_ring(struct iio_dev *indio_dev)
{
return 0;
}
static inline void adis16350_unconfigure_ring(struct iio_dev *indio_dev)
{
}
static inline int adis16350_initialize_ring(struct iio_ring_buffer *ring)
{
return 0;
}
static inline void adis16350_uninitialize_ring(struct iio_ring_buffer *ring)
{
}
#endif /* CONFIG_IIO_RING_BUFFER */
#endif /* SPI_ADIS16350_H_ */

View File

@ -20,6 +20,7 @@
#include "../iio.h"
#include "../sysfs.h"
#include "../ring_generic.h"
#include "../accel/accel.h"
#include "../adc/adc.h"
#include "../gyro/gyro.h"
@ -619,7 +620,7 @@ static int __devinit adis16350_probe(struct spi_device *spi)
goto error_unreg_ring_funcs;
regdone = 1;
ret = adis16350_initialize_ring(st->indio_dev->ring);
ret = iio_ring_buffer_register(st->indio_dev->ring, 0);
if (ret) {
printk(KERN_ERR "failed to initialize the ring\n");
goto error_unreg_ring_funcs;
@ -651,7 +652,7 @@ error_unregister_line:
if (spi->irq)
iio_unregister_interrupt_line(st->indio_dev, 0);
error_uninitialize_ring:
adis16350_uninitialize_ring(st->indio_dev->ring);
iio_ring_buffer_unregister(st->indio_dev->ring);
error_unreg_ring_funcs:
adis16350_unconfigure_ring(st->indio_dev);
error_free_dev:
@ -685,7 +686,7 @@ static int adis16350_remove(struct spi_device *spi)
if (spi->irq)
iio_unregister_interrupt_line(indio_dev, 0);
adis16350_uninitialize_ring(indio_dev->ring);
iio_ring_buffer_unregister(indio_dev->ring);
iio_device_unregister(indio_dev);
adis16350_unconfigure_ring(indio_dev);
kfree(st->tx);

View File

@ -246,12 +246,3 @@ error_iio_sw_rb_free:
return ret;
}
int adis16350_initialize_ring(struct iio_ring_buffer *ring)
{
return iio_ring_buffer_register(ring, 0);
}
void adis16350_uninitialize_ring(struct iio_ring_buffer *ring)
{
iio_ring_buffer_unregister(ring);
}

View File

@ -178,8 +178,6 @@ ssize_t adis16400_read_data_from_ring(struct device *dev,
int adis16400_configure_ring(struct iio_dev *indio_dev);
void adis16400_unconfigure_ring(struct iio_dev *indio_dev);
int adis16400_initialize_ring(struct iio_ring_buffer *ring);
void adis16400_uninitialize_ring(struct iio_ring_buffer *ring);
#else /* CONFIG_IIO_RING_BUFFER */
static inline void adis16400_remove_trigger(struct iio_dev *indio_dev)
@ -208,14 +206,5 @@ static inline void adis16400_unconfigure_ring(struct iio_dev *indio_dev)
{
}
static inline int adis16400_initialize_ring(struct iio_ring_buffer *ring)
{
return 0;
}
static inline void adis16400_uninitialize_ring(struct iio_ring_buffer *ring)
{
}
#endif /* CONFIG_IIO_RING_BUFFER */
#endif /* SPI_ADIS16400_H_ */

View File

@ -27,6 +27,7 @@
#include "../iio.h"
#include "../sysfs.h"
#include "../ring_generic.h"
#include "../accel/accel.h"
#include "../adc/adc.h"
#include "../gyro/gyro.h"
@ -641,7 +642,7 @@ static int __devinit adis16400_probe(struct spi_device *spi)
goto error_unreg_ring_funcs;
regdone = 1;
ret = adis16400_initialize_ring(st->indio_dev->ring);
ret = iio_ring_buffer_register(st->indio_dev->ring, 0);
if (ret) {
printk(KERN_ERR "failed to initialize the ring\n");
goto error_unreg_ring_funcs;
@ -674,7 +675,7 @@ error_unregister_line:
if (st->indio_dev->modes & INDIO_RING_TRIGGERED)
iio_unregister_interrupt_line(st->indio_dev, 0);
error_uninitialize_ring:
adis16400_uninitialize_ring(st->indio_dev->ring);
iio_ring_buffer_unregister(st->indio_dev->ring);
error_unreg_ring_funcs:
adis16400_unconfigure_ring(st->indio_dev);
error_free_dev:
@ -709,7 +710,7 @@ static int adis16400_remove(struct spi_device *spi)
if (spi->irq && gpio_is_valid(irq_to_gpio(spi->irq)) > 0)
iio_unregister_interrupt_line(indio_dev, 0);
adis16400_uninitialize_ring(indio_dev->ring);
iio_ring_buffer_unregister(st->indio_dev->ring);
adis16400_unconfigure_ring(indio_dev);
iio_device_unregister(indio_dev);
kfree(st->tx);

View File

@ -252,13 +252,3 @@ error_iio_sw_rb_free:
iio_sw_rb_free(indio_dev->ring);
return ret;
}
int adis16400_initialize_ring(struct iio_ring_buffer *ring)
{
return iio_ring_buffer_register(ring, 0);
}
void adis16400_uninitialize_ring(struct iio_ring_buffer *ring)
{
iio_ring_buffer_unregister(ring);
}

View File

@ -11,6 +11,8 @@
#define _IIO_RING_GENERIC_H_
#include "iio.h"
#ifdef CONFIG_IIO_RING_BUFFER
struct iio_handler;
struct iio_ring_buffer;
struct iio_dev;
@ -287,5 +289,14 @@ ssize_t iio_show_ring_enable(struct device *dev,
#define IIO_RING_ENABLE_ATTR DEVICE_ATTR(ring_enable, S_IRUGO | S_IWUSR, \
iio_show_ring_enable, \
iio_store_ring_enable)
#else /* CONFIG_IIO_RING_BUFFER */
static inline int iio_ring_buffer_register(struct iio_ring_buffer *ring, int id)
{
return 0;
};
static inline void iio_ring_buffer_unregister(struct iio_ring_buffer *ring)
{};
#endif /* CONFIG_IIO_RING_BUFFER */
#endif /* _IIO_RING_GENERIC_H_ */