From df9c1c42c26f9a516dd44c956cff301741a0884e Mon Sep 17 00:00:00 2001 From: Jonathan Cameron Date: Fri, 12 Aug 2011 17:56:03 +0100 Subject: staging:iio: Introduce iio_core.h and move all core only stuff out of iio.h. Also get rid of a few function defs where they are only now in one core file anyway. Whilst here add mask = 0 to get rid of warning. Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/iio_core.h | 48 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 drivers/staging/iio/iio_core.h (limited to 'drivers/staging/iio/iio_core.h') diff --git a/drivers/staging/iio/iio_core.h b/drivers/staging/iio/iio_core.h new file mode 100644 index 0000000..00e894d --- /dev/null +++ b/drivers/staging/iio/iio_core.h @@ -0,0 +1,48 @@ +/* The industrial I/O core function defs. + * + * Copyright (c) 2008 Jonathan Cameron + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. + * + * These definitions are meant for use only within the IIO core, not indvidual + * drivers. + */ + +/** + * iio_device_get_chrdev_minor() - get an unused minor number + **/ +int iio_device_get_chrdev_minor(void); +void iio_device_free_chrdev_minor(int val); + + +/** + * iio_put() - internal module reference count reduce + **/ +void iio_put(void); + +/** + * iio_get() - internal module reference count increase + **/ +void iio_get(void); + +extern dev_t iio_devt; + +int __iio_add_chan_devattr(const char *postfix, + const char *group, + struct iio_chan_spec const *chan, + ssize_t (*func)(struct device *dev, + struct device_attribute *attr, + char *buf), + ssize_t (*writefunc)(struct device *dev, + struct device_attribute *attr, + const char *buf, + size_t len), + int mask, + bool generic, + struct device *dev, + struct list_head *attr_list); + +/* Event interface flags */ +#define IIO_BUSY_BIT_POS 1 -- cgit v1.1 From 1aa042783251c27a93e31929c24647729db326d4 Mon Sep 17 00:00:00 2001 From: Jonathan Cameron Date: Tue, 30 Aug 2011 12:32:47 +0100 Subject: staging: iio: push the main buffer chrdev down to the top level. Sorry all, this one is very invasive, though the driver changes are just trivial interface fixes. Not all done yet. V2 - bring the sca3000 with us. V3 - fix ade7758 bugs in conversion. V4 - add ad5933 Signed-off-by: Jonathan Cameron Acked-by: Michael Hennerich Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/iio_core.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'drivers/staging/iio/iio_core.h') diff --git a/drivers/staging/iio/iio_core.h b/drivers/staging/iio/iio_core.h index 00e894d..a27fa05 100644 --- a/drivers/staging/iio/iio_core.h +++ b/drivers/staging/iio/iio_core.h @@ -10,6 +10,9 @@ * drivers. */ +#ifndef _IIO_CORE_H_ +#define _IIO_CORE_H_ + /** * iio_device_get_chrdev_minor() - get an unused minor number **/ @@ -46,3 +49,32 @@ int __iio_add_chan_devattr(const char *postfix, /* Event interface flags */ #define IIO_BUSY_BIT_POS 1 + +#ifdef CONFIG_IIO_RING_BUFFER +struct poll_table_struct; + +void iio_chrdev_ring_open(struct iio_dev *indio_dev); +void iio_chrdev_ring_release(struct iio_dev *indio_dev); + +unsigned int iio_ring_poll(struct file *filp, + struct poll_table_struct *wait); +ssize_t iio_ring_read_first_n_outer(struct file *filp, char __user *buf, + size_t n, loff_t *f_ps); + + +#define iio_ring_poll_addr (&iio_ring_poll) +#define iio_ring_read_first_n_outer_addr (&iio_ring_read_first_n_outer) + +#else + +static inline void iio_chrdev_ring_open(struct iio_dev *indio_dev) +{} +static inline void iio_chrdev_ring_release(struct iio_dev *indio_dev) +{} + +#define iio_ring_poll_addr NULL +#define iio_ring_read_first_n_outer_addr NULL + +#endif + +#endif -- cgit v1.1 From f625cb97d4d58f311a9606a4bcf9d9a334ca9952 Mon Sep 17 00:00:00 2001 From: Jonathan Cameron Date: Tue, 30 Aug 2011 12:32:48 +0100 Subject: staging: iio: remove now defunct header definitions and add some statics Now we have combined all chrdevs into one, some bits and bobs are only needed in industrialio-core.c and don't need to be in the core header. Also remove some unused defines. Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/iio_core.h | 9 --------- 1 file changed, 9 deletions(-) (limited to 'drivers/staging/iio/iio_core.h') diff --git a/drivers/staging/iio/iio_core.h b/drivers/staging/iio/iio_core.h index a27fa05..433952b 100644 --- a/drivers/staging/iio/iio_core.h +++ b/drivers/staging/iio/iio_core.h @@ -14,13 +14,6 @@ #define _IIO_CORE_H_ /** - * iio_device_get_chrdev_minor() - get an unused minor number - **/ -int iio_device_get_chrdev_minor(void); -void iio_device_free_chrdev_minor(int val); - - -/** * iio_put() - internal module reference count reduce **/ void iio_put(void); @@ -30,8 +23,6 @@ void iio_put(void); **/ void iio_get(void); -extern dev_t iio_devt; - int __iio_add_chan_devattr(const char *postfix, const char *group, struct iio_chan_spec const *chan, -- cgit v1.1 From 9019309c2f32a4479c88047532552bdeea38585a Mon Sep 17 00:00:00 2001 From: Jonathan Cameron Date: Tue, 30 Aug 2011 12:41:08 +0100 Subject: staging:iio: remove defunct iio_put and iio_get. All iio dependent modules statically depend on industrialio so these aren't needed. Not sure why they originally existed, but they aren't now. Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/iio_core.h | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'drivers/staging/iio/iio_core.h') diff --git a/drivers/staging/iio/iio_core.h b/drivers/staging/iio/iio_core.h index 433952b..edc295e 100644 --- a/drivers/staging/iio/iio_core.h +++ b/drivers/staging/iio/iio_core.h @@ -13,16 +13,6 @@ #ifndef _IIO_CORE_H_ #define _IIO_CORE_H_ -/** - * iio_put() - internal module reference count reduce - **/ -void iio_put(void); - -/** - * iio_get() - internal module reference count increase - **/ -void iio_get(void); - int __iio_add_chan_devattr(const char *postfix, const char *group, struct iio_chan_spec const *chan, -- cgit v1.1 From cecfb931c87c52ae5fda842e4b5a74f1537d5f9d Mon Sep 17 00:00:00 2001 From: Michael Hennerich Date: Tue, 30 Aug 2011 12:41:10 +0100 Subject: staging:iio: fix typo Signed-off-by: Michael Hennerich Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/iio_core.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging/iio/iio_core.h') diff --git a/drivers/staging/iio/iio_core.h b/drivers/staging/iio/iio_core.h index edc295e..d7eb0d8 100644 --- a/drivers/staging/iio/iio_core.h +++ b/drivers/staging/iio/iio_core.h @@ -6,7 +6,7 @@ * under the terms of the GNU General Public License version 2 as published by * the Free Software Foundation. * - * These definitions are meant for use only within the IIO core, not indvidual + * These definitions are meant for use only within the IIO core, not individual * drivers. */ -- cgit v1.1 From 26d25ae3f0d8ffe350aacc75b71198d6b35bd1f4 Mon Sep 17 00:00:00 2001 From: Jonathan Cameron Date: Fri, 2 Sep 2011 17:14:40 +0100 Subject: staging:iio: rework of attribute registration. This set also includes quite a number of bug fixes of particularly remove functions. Necessary due to issue pointed out in Bart Van Assche's patch: docs/driver-model: Document device.groups V2: Rebase due to patch reordering. V3: Pull various error fixes and cleanups out into their own patches. Signed-off-by: Jonathan Cameron Acked-by: Michael Hennerich Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/iio_core.h | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging/iio/iio_core.h') diff --git a/drivers/staging/iio/iio_core.h b/drivers/staging/iio/iio_core.h index d7eb0d8..3a80dbf 100644 --- a/drivers/staging/iio/iio_core.h +++ b/drivers/staging/iio/iio_core.h @@ -14,7 +14,6 @@ #define _IIO_CORE_H_ int __iio_add_chan_devattr(const char *postfix, - const char *group, struct iio_chan_spec const *chan, ssize_t (*func)(struct device *dev, struct device_attribute *attr, -- cgit v1.1 From e614a54b296185b266b4bd91193e08a5fbd32422 Mon Sep 17 00:00:00 2001 From: Jonathan Cameron Date: Fri, 2 Sep 2011 17:14:41 +0100 Subject: staging:iio:attrs - make address a u64 to allow event codes to be used. Makes unusual event related attributes look a lot more like the core ones. V2: Make sure the utils that set these up can handle the codes. V3: rebase Reported-by: Michael Hennerich Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/iio_core.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging/iio/iio_core.h') diff --git a/drivers/staging/iio/iio_core.h b/drivers/staging/iio/iio_core.h index 3a80dbf..803bdd8 100644 --- a/drivers/staging/iio/iio_core.h +++ b/drivers/staging/iio/iio_core.h @@ -22,7 +22,7 @@ int __iio_add_chan_devattr(const char *postfix, struct device_attribute *attr, const char *buf, size_t len), - int mask, + u64 mask, bool generic, struct device *dev, struct list_head *attr_list); -- cgit v1.1 From f2a96245baccc07f770d5993f6a523e84e44336f Mon Sep 17 00:00:00 2001 From: Jonathan Cameron Date: Wed, 21 Sep 2011 11:15:55 +0100 Subject: staging:iio: tree wide IIO_RING_BUFFER config symbol to IIO_BUFFER Functionality is generic, so name is missleading. Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/iio_core.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging/iio/iio_core.h') diff --git a/drivers/staging/iio/iio_core.h b/drivers/staging/iio/iio_core.h index 803bdd8..a173321 100644 --- a/drivers/staging/iio/iio_core.h +++ b/drivers/staging/iio/iio_core.h @@ -30,7 +30,7 @@ int __iio_add_chan_devattr(const char *postfix, /* Event interface flags */ #define IIO_BUSY_BIT_POS 1 -#ifdef CONFIG_IIO_RING_BUFFER +#ifdef CONFIG_IIO_BUFFER struct poll_table_struct; void iio_chrdev_ring_open(struct iio_dev *indio_dev); -- cgit v1.1 From 14555b14455f9acbdf0e500ae96140828a970796 Mon Sep 17 00:00:00 2001 From: Jonathan Cameron Date: Wed, 21 Sep 2011 11:15:57 +0100 Subject: staging:iio: replacing term ring with buffer in the IIO core. They aren't always ring buffers, so just use buffer for all naming. Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/iio_core.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'drivers/staging/iio/iio_core.h') diff --git a/drivers/staging/iio/iio_core.h b/drivers/staging/iio/iio_core.h index a173321..dde9e3e 100644 --- a/drivers/staging/iio/iio_core.h +++ b/drivers/staging/iio/iio_core.h @@ -33,27 +33,27 @@ int __iio_add_chan_devattr(const char *postfix, #ifdef CONFIG_IIO_BUFFER struct poll_table_struct; -void iio_chrdev_ring_open(struct iio_dev *indio_dev); -void iio_chrdev_ring_release(struct iio_dev *indio_dev); +void iio_chrdev_buffer_open(struct iio_dev *indio_dev); +void iio_chrdev_buffer_release(struct iio_dev *indio_dev); -unsigned int iio_ring_poll(struct file *filp, - struct poll_table_struct *wait); -ssize_t iio_ring_read_first_n_outer(struct file *filp, char __user *buf, - size_t n, loff_t *f_ps); +unsigned int iio_buffer_poll(struct file *filp, + struct poll_table_struct *wait); +ssize_t iio_buffer_read_first_n_outer(struct file *filp, char __user *buf, + size_t n, loff_t *f_ps); -#define iio_ring_poll_addr (&iio_ring_poll) -#define iio_ring_read_first_n_outer_addr (&iio_ring_read_first_n_outer) +#define iio_buffer_poll_addr (&iio_buffer_poll) +#define iio_buffer_read_first_n_outer_addr (&iio_buffer_read_first_n_outer) #else -static inline void iio_chrdev_ring_open(struct iio_dev *indio_dev) +static inline void iio_chrdev_buffer_open(struct iio_dev *indio_dev) {} -static inline void iio_chrdev_ring_release(struct iio_dev *indio_dev) +static inline void iio_chrdev_buffer_release(struct iio_dev *indio_dev) {} -#define iio_ring_poll_addr NULL -#define iio_ring_read_first_n_outer_addr NULL +#define iio_buffer_poll_addr NULL +#define iio_buffer_read_first_n_outer_addr NULL #endif -- cgit v1.1 From 30eb82f05dd1f12b18a0ad054401a0b5690fb3c3 Mon Sep 17 00:00:00 2001 From: Jonathan Cameron Date: Wed, 21 Sep 2011 11:16:02 +0100 Subject: staging:iio: Prevent reading from buffer chrdev when device has no buffer. Silly bug introduced during the chrdev merge series. Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/iio_core.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'drivers/staging/iio/iio_core.h') diff --git a/drivers/staging/iio/iio_core.h b/drivers/staging/iio/iio_core.h index dde9e3e..36159e0 100644 --- a/drivers/staging/iio/iio_core.h +++ b/drivers/staging/iio/iio_core.h @@ -33,7 +33,7 @@ int __iio_add_chan_devattr(const char *postfix, #ifdef CONFIG_IIO_BUFFER struct poll_table_struct; -void iio_chrdev_buffer_open(struct iio_dev *indio_dev); +int iio_chrdev_buffer_open(struct iio_dev *indio_dev); void iio_chrdev_buffer_release(struct iio_dev *indio_dev); unsigned int iio_buffer_poll(struct file *filp, @@ -47,8 +47,11 @@ ssize_t iio_buffer_read_first_n_outer(struct file *filp, char __user *buf, #else -static inline void iio_chrdev_buffer_open(struct iio_dev *indio_dev) -{} +static inline int iio_chrdev_buffer_open(struct iio_dev *indio_dev) +{ + return -EINVAL; +} + static inline void iio_chrdev_buffer_release(struct iio_dev *indio_dev) {} -- cgit v1.1