aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2013-01-31 16:43:00 -0500
committerJonathan Cameron <jic23@kernel.org>2013-02-02 06:58:46 -0500
commitca7d98dbd7db6aa8bc4b08e26be1249436d21af3 (patch)
treeb0a094e0a28b62adace30b549a550305064a72d7 /drivers/iio
parent482bb4e6c648a68598cde9d4a56b066df26d5ae6 (diff)
iio: Update iio_channel_get_all and iio_channel_get_all_cb API
Pass device pointer instead of device name as parameter to iio_channel_get_all and iio_channel_get_all_cb. This will enable us to use OF information to retrieve consumer channel information. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio')
-rw-r--r--drivers/iio/buffer_cb.c4
-rw-r--r--drivers/iio/inkern.c6
2 files changed, 6 insertions, 4 deletions
diff --git a/drivers/iio/buffer_cb.c b/drivers/iio/buffer_cb.c
index 4d40e24f3721..9201022945e9 100644
--- a/drivers/iio/buffer_cb.c
+++ b/drivers/iio/buffer_cb.c
@@ -25,7 +25,7 @@ static struct iio_buffer_access_funcs iio_cb_access = {
25 .store_to = &iio_buffer_cb_store_to, 25 .store_to = &iio_buffer_cb_store_to,
26}; 26};
27 27
28struct iio_cb_buffer *iio_channel_get_all_cb(const char *name, 28struct iio_cb_buffer *iio_channel_get_all_cb(struct device *dev,
29 int (*cb)(u8 *data, 29 int (*cb)(u8 *data,
30 void *private), 30 void *private),
31 void *private) 31 void *private)
@@ -46,7 +46,7 @@ struct iio_cb_buffer *iio_channel_get_all_cb(const char *name,
46 cb_buff->buffer.access = &iio_cb_access; 46 cb_buff->buffer.access = &iio_cb_access;
47 INIT_LIST_HEAD(&cb_buff->buffer.demux_list); 47 INIT_LIST_HEAD(&cb_buff->buffer.demux_list);
48 48
49 cb_buff->channels = iio_channel_get_all(name); 49 cb_buff->channels = iio_channel_get_all(dev);
50 if (IS_ERR(cb_buff->channels)) { 50 if (IS_ERR(cb_buff->channels)) {
51 ret = PTR_ERR(cb_buff->channels); 51 ret = PTR_ERR(cb_buff->channels);
52 goto error_free_cb_buff; 52 goto error_free_cb_buff;
diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c
index d55e98fb300e..58d0ffe856b6 100644
--- a/drivers/iio/inkern.c
+++ b/drivers/iio/inkern.c
@@ -167,16 +167,18 @@ void iio_channel_release(struct iio_channel *channel)
167} 167}
168EXPORT_SYMBOL_GPL(iio_channel_release); 168EXPORT_SYMBOL_GPL(iio_channel_release);
169 169
170struct iio_channel *iio_channel_get_all(const char *name) 170struct iio_channel *iio_channel_get_all(struct device *dev)
171{ 171{
172 const char *name;
172 struct iio_channel *chans; 173 struct iio_channel *chans;
173 struct iio_map_internal *c = NULL; 174 struct iio_map_internal *c = NULL;
174 int nummaps = 0; 175 int nummaps = 0;
175 int mapind = 0; 176 int mapind = 0;
176 int i, ret; 177 int i, ret;
177 178
178 if (name == NULL) 179 if (dev == NULL)
179 return ERR_PTR(-EINVAL); 180 return ERR_PTR(-EINVAL);
181 name = dev_name(dev);
180 182
181 mutex_lock(&iio_map_list_lock); 183 mutex_lock(&iio_map_list_lock);
182 /* first count the matching maps */ 184 /* first count the matching maps */