aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2012-06-04 04:50:03 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-06-05 00:21:29 -0400
commit1875ffd218ddafd78f0f8e78198c137cef97fd8a (patch)
treeefc440ffd76f489b2079adc92b571ae6f9583f44 /drivers/iio
parente4e8b7765867e8f4705bcc18b8930edbe0e4ef3c (diff)
iio:inkern: Use iio_device_{get,put}
Use iio_device_get and iio_device_put instead of open-coding it. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/iio')
-rw-r--r--drivers/iio/inkern.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c
index 922645893dc8..d4760bd1e9b1 100644
--- a/drivers/iio/inkern.c
+++ b/drivers/iio/inkern.c
@@ -125,7 +125,7 @@ struct iio_channel *iio_st_channel_get(const char *name,
125 strcmp(channel_name, c_i->map->consumer_channel) != 0)) 125 strcmp(channel_name, c_i->map->consumer_channel) != 0))
126 continue; 126 continue;
127 c = c_i; 127 c = c_i;
128 get_device(&c->indio_dev->dev); 128 iio_device_get(c->indio_dev);
129 break; 129 break;
130 } 130 }
131 mutex_unlock(&iio_map_list_lock); 131 mutex_unlock(&iio_map_list_lock);
@@ -149,7 +149,7 @@ EXPORT_SYMBOL_GPL(iio_st_channel_get);
149 149
150void iio_st_channel_release(struct iio_channel *channel) 150void iio_st_channel_release(struct iio_channel *channel)
151{ 151{
152 put_device(&channel->indio_dev->dev); 152 iio_device_put(channel->indio_dev);
153 kfree(channel); 153 kfree(channel);
154} 154}
155EXPORT_SYMBOL_GPL(iio_st_channel_release); 155EXPORT_SYMBOL_GPL(iio_st_channel_release);
@@ -195,10 +195,10 @@ struct iio_channel *iio_st_channel_get_all(const char *name)
195 c->map->adc_channel_label); 195 c->map->adc_channel_label);
196 if (chans[mapind].channel == NULL) { 196 if (chans[mapind].channel == NULL) {
197 ret = -EINVAL; 197 ret = -EINVAL;
198 put_device(&chans[mapind].indio_dev->dev); 198 iio_device_put(chans[mapind].indio_dev);
199 goto error_free_chans; 199 goto error_free_chans;
200 } 200 }
201 get_device(&chans[mapind].indio_dev->dev); 201 iio_device_get(chans[mapind].indio_dev);
202 mapind++; 202 mapind++;
203 } 203 }
204 mutex_unlock(&iio_map_list_lock); 204 mutex_unlock(&iio_map_list_lock);
@@ -210,8 +210,7 @@ struct iio_channel *iio_st_channel_get_all(const char *name)
210 210
211error_free_chans: 211error_free_chans:
212 for (i = 0; i < nummaps; i++) 212 for (i = 0; i < nummaps; i++)
213 if (chans[i].indio_dev) 213 iio_device_put(chans[i].indio_dev);
214 put_device(&chans[i].indio_dev->dev);
215 kfree(chans); 214 kfree(chans);
216error_ret: 215error_ret:
217 mutex_unlock(&iio_map_list_lock); 216 mutex_unlock(&iio_map_list_lock);
@@ -225,7 +224,7 @@ void iio_st_channel_release_all(struct iio_channel *channels)
225 struct iio_channel *chan = &channels[0]; 224 struct iio_channel *chan = &channels[0];
226 225
227 while (chan->indio_dev) { 226 while (chan->indio_dev) {
228 put_device(&chan->indio_dev->dev); 227 iio_device_put(chan->indio_dev);
229 chan++; 228 chan++;
230 } 229 }
231 kfree(channels); 230 kfree(channels);