aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2012-05-12 09:39:33 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-05-14 16:37:45 -0400
commite53f5ac52ec19c8c606aeacdd13fed2a03d7365a (patch)
tree8463a43fb6121066350373dc9cc045afdf4c39d0 /drivers
parent7a7913f11ddf932e20d2bde72bec57f2f7a9b49e (diff)
iio: Use dev_to_iio_dev()
Replace open-coded instances of getting a iio_dev struct from a device struct with dev_to_iio_dev(). Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/iio/industrialio-buffer.c16
-rw-r--r--drivers/iio/industrialio-core.c12
-rw-r--r--drivers/iio/industrialio-event.c8
-rw-r--r--drivers/iio/industrialio-trigger.c4
4 files changed, 20 insertions, 20 deletions
diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
index b5b2c38045c5..ac185b8694bd 100644
--- a/drivers/iio/industrialio-buffer.c
+++ b/drivers/iio/industrialio-buffer.c
@@ -105,7 +105,7 @@ static ssize_t iio_scan_el_show(struct device *dev,
105 char *buf) 105 char *buf)
106{ 106{
107 int ret; 107 int ret;
108 struct iio_dev *indio_dev = dev_get_drvdata(dev); 108 struct iio_dev *indio_dev = dev_to_iio_dev(dev);
109 109
110 ret = test_bit(to_iio_dev_attr(attr)->address, 110 ret = test_bit(to_iio_dev_attr(attr)->address,
111 indio_dev->buffer->scan_mask); 111 indio_dev->buffer->scan_mask);
@@ -126,7 +126,7 @@ static ssize_t iio_scan_el_store(struct device *dev,
126{ 126{
127 int ret; 127 int ret;
128 bool state; 128 bool state;
129 struct iio_dev *indio_dev = dev_get_drvdata(dev); 129 struct iio_dev *indio_dev = dev_to_iio_dev(dev);
130 struct iio_buffer *buffer = indio_dev->buffer; 130 struct iio_buffer *buffer = indio_dev->buffer;
131 struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); 131 struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
132 132
@@ -162,7 +162,7 @@ static ssize_t iio_scan_el_ts_show(struct device *dev,
162 struct device_attribute *attr, 162 struct device_attribute *attr,
163 char *buf) 163 char *buf)
164{ 164{
165 struct iio_dev *indio_dev = dev_get_drvdata(dev); 165 struct iio_dev *indio_dev = dev_to_iio_dev(dev);
166 return sprintf(buf, "%d\n", indio_dev->buffer->scan_timestamp); 166 return sprintf(buf, "%d\n", indio_dev->buffer->scan_timestamp);
167} 167}
168 168
@@ -172,7 +172,7 @@ static ssize_t iio_scan_el_ts_store(struct device *dev,
172 size_t len) 172 size_t len)
173{ 173{
174 int ret; 174 int ret;
175 struct iio_dev *indio_dev = dev_get_drvdata(dev); 175 struct iio_dev *indio_dev = dev_to_iio_dev(dev);
176 bool state; 176 bool state;
177 177
178 ret = strtobool(buf, &state); 178 ret = strtobool(buf, &state);
@@ -352,7 +352,7 @@ ssize_t iio_buffer_read_length(struct device *dev,
352 struct device_attribute *attr, 352 struct device_attribute *attr,
353 char *buf) 353 char *buf)
354{ 354{
355 struct iio_dev *indio_dev = dev_get_drvdata(dev); 355 struct iio_dev *indio_dev = dev_to_iio_dev(dev);
356 struct iio_buffer *buffer = indio_dev->buffer; 356 struct iio_buffer *buffer = indio_dev->buffer;
357 357
358 if (buffer->access->get_length) 358 if (buffer->access->get_length)
@@ -370,7 +370,7 @@ ssize_t iio_buffer_write_length(struct device *dev,
370{ 370{
371 int ret; 371 int ret;
372 ulong val; 372 ulong val;
373 struct iio_dev *indio_dev = dev_get_drvdata(dev); 373 struct iio_dev *indio_dev = dev_to_iio_dev(dev);
374 struct iio_buffer *buffer = indio_dev->buffer; 374 struct iio_buffer *buffer = indio_dev->buffer;
375 375
376 ret = strict_strtoul(buf, 10, &val); 376 ret = strict_strtoul(buf, 10, &val);
@@ -403,7 +403,7 @@ ssize_t iio_buffer_store_enable(struct device *dev,
403 int ret; 403 int ret;
404 bool requested_state, current_state; 404 bool requested_state, current_state;
405 int previous_mode; 405 int previous_mode;
406 struct iio_dev *indio_dev = dev_get_drvdata(dev); 406 struct iio_dev *indio_dev = dev_to_iio_dev(dev);
407 struct iio_buffer *buffer = indio_dev->buffer; 407 struct iio_buffer *buffer = indio_dev->buffer;
408 408
409 mutex_lock(&indio_dev->mlock); 409 mutex_lock(&indio_dev->mlock);
@@ -489,7 +489,7 @@ ssize_t iio_buffer_show_enable(struct device *dev,
489 struct device_attribute *attr, 489 struct device_attribute *attr,
490 char *buf) 490 char *buf)
491{ 491{
492 struct iio_dev *indio_dev = dev_get_drvdata(dev); 492 struct iio_dev *indio_dev = dev_to_iio_dev(dev);
493 return sprintf(buf, "%d\n", iio_buffer_enabled(indio_dev)); 493 return sprintf(buf, "%d\n", iio_buffer_enabled(indio_dev));
494} 494}
495EXPORT_SYMBOL(iio_buffer_show_enable); 495EXPORT_SYMBOL(iio_buffer_show_enable);
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index 86f34600a3aa..1ddd8861c71b 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -265,7 +265,7 @@ static ssize_t iio_read_channel_ext_info(struct device *dev,
265 struct device_attribute *attr, 265 struct device_attribute *attr,
266 char *buf) 266 char *buf)
267{ 267{
268 struct iio_dev *indio_dev = dev_get_drvdata(dev); 268 struct iio_dev *indio_dev = dev_to_iio_dev(dev);
269 struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); 269 struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
270 const struct iio_chan_spec_ext_info *ext_info; 270 const struct iio_chan_spec_ext_info *ext_info;
271 271
@@ -279,7 +279,7 @@ static ssize_t iio_write_channel_ext_info(struct device *dev,
279 const char *buf, 279 const char *buf,
280 size_t len) 280 size_t len)
281{ 281{
282 struct iio_dev *indio_dev = dev_get_drvdata(dev); 282 struct iio_dev *indio_dev = dev_to_iio_dev(dev);
283 struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); 283 struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
284 const struct iio_chan_spec_ext_info *ext_info; 284 const struct iio_chan_spec_ext_info *ext_info;
285 285
@@ -293,7 +293,7 @@ static ssize_t iio_read_channel_info(struct device *dev,
293 struct device_attribute *attr, 293 struct device_attribute *attr,
294 char *buf) 294 char *buf)
295{ 295{
296 struct iio_dev *indio_dev = dev_get_drvdata(dev); 296 struct iio_dev *indio_dev = dev_to_iio_dev(dev);
297 struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); 297 struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
298 int val, val2; 298 int val, val2;
299 bool scale_db = false; 299 bool scale_db = false;
@@ -330,7 +330,7 @@ static ssize_t iio_write_channel_info(struct device *dev,
330 const char *buf, 330 const char *buf,
331 size_t len) 331 size_t len)
332{ 332{
333 struct iio_dev *indio_dev = dev_get_drvdata(dev); 333 struct iio_dev *indio_dev = dev_to_iio_dev(dev);
334 struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); 334 struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
335 int ret, integer = 0, fract = 0, fract_mult = 100000; 335 int ret, integer = 0, fract = 0, fract_mult = 100000;
336 bool integer_part = true, negative = false; 336 bool integer_part = true, negative = false;
@@ -638,7 +638,7 @@ static ssize_t iio_show_dev_name(struct device *dev,
638 struct device_attribute *attr, 638 struct device_attribute *attr,
639 char *buf) 639 char *buf)
640{ 640{
641 struct iio_dev *indio_dev = dev_get_drvdata(dev); 641 struct iio_dev *indio_dev = dev_to_iio_dev(dev);
642 return sprintf(buf, "%s\n", indio_dev->name); 642 return sprintf(buf, "%s\n", indio_dev->name);
643} 643}
644 644
@@ -724,7 +724,7 @@ static void iio_device_unregister_sysfs(struct iio_dev *indio_dev)
724 724
725static void iio_dev_release(struct device *device) 725static void iio_dev_release(struct device *device)
726{ 726{
727 struct iio_dev *indio_dev = container_of(device, struct iio_dev, dev); 727 struct iio_dev *indio_dev = dev_to_iio_dev(device);
728 cdev_del(&indio_dev->chrdev); 728 cdev_del(&indio_dev->chrdev);
729 if (indio_dev->modes & INDIO_BUFFER_TRIGGERED) 729 if (indio_dev->modes & INDIO_BUFFER_TRIGGERED)
730 iio_device_unregister_trigger_consumer(indio_dev); 730 iio_device_unregister_trigger_consumer(indio_dev);
diff --git a/drivers/iio/industrialio-event.c b/drivers/iio/industrialio-event.c
index 5fcf50b1ae5a..b49059de5d02 100644
--- a/drivers/iio/industrialio-event.c
+++ b/drivers/iio/industrialio-event.c
@@ -186,7 +186,7 @@ static ssize_t iio_ev_state_store(struct device *dev,
186 const char *buf, 186 const char *buf,
187 size_t len) 187 size_t len)
188{ 188{
189 struct iio_dev *indio_dev = dev_get_drvdata(dev); 189 struct iio_dev *indio_dev = dev_to_iio_dev(dev);
190 struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); 190 struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
191 int ret; 191 int ret;
192 bool val; 192 bool val;
@@ -205,7 +205,7 @@ static ssize_t iio_ev_state_show(struct device *dev,
205 struct device_attribute *attr, 205 struct device_attribute *attr,
206 char *buf) 206 char *buf)
207{ 207{
208 struct iio_dev *indio_dev = dev_get_drvdata(dev); 208 struct iio_dev *indio_dev = dev_to_iio_dev(dev);
209 struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); 209 struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
210 int val = indio_dev->info->read_event_config(indio_dev, 210 int val = indio_dev->info->read_event_config(indio_dev,
211 this_attr->address); 211 this_attr->address);
@@ -220,7 +220,7 @@ static ssize_t iio_ev_value_show(struct device *dev,
220 struct device_attribute *attr, 220 struct device_attribute *attr,
221 char *buf) 221 char *buf)
222{ 222{
223 struct iio_dev *indio_dev = dev_get_drvdata(dev); 223 struct iio_dev *indio_dev = dev_to_iio_dev(dev);
224 struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); 224 struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
225 int val, ret; 225 int val, ret;
226 226
@@ -237,7 +237,7 @@ static ssize_t iio_ev_value_store(struct device *dev,
237 const char *buf, 237 const char *buf,
238 size_t len) 238 size_t len)
239{ 239{
240 struct iio_dev *indio_dev = dev_get_drvdata(dev); 240 struct iio_dev *indio_dev = dev_to_iio_dev(dev);
241 struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); 241 struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
242 unsigned long val; 242 unsigned long val;
243 int ret; 243 int ret;
diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c
index 1dbd7b86a694..0f582df75a19 100644
--- a/drivers/iio/industrialio-trigger.c
+++ b/drivers/iio/industrialio-trigger.c
@@ -310,7 +310,7 @@ static ssize_t iio_trigger_read_current(struct device *dev,
310 struct device_attribute *attr, 310 struct device_attribute *attr,
311 char *buf) 311 char *buf)
312{ 312{
313 struct iio_dev *indio_dev = dev_get_drvdata(dev); 313 struct iio_dev *indio_dev = dev_to_iio_dev(dev);
314 314
315 if (indio_dev->trig) 315 if (indio_dev->trig)
316 return sprintf(buf, "%s\n", indio_dev->trig->name); 316 return sprintf(buf, "%s\n", indio_dev->trig->name);
@@ -329,7 +329,7 @@ static ssize_t iio_trigger_write_current(struct device *dev,
329 const char *buf, 329 const char *buf,
330 size_t len) 330 size_t len)
331{ 331{
332 struct iio_dev *indio_dev = dev_get_drvdata(dev); 332 struct iio_dev *indio_dev = dev_to_iio_dev(dev);
333 struct iio_trigger *oldtrig = indio_dev->trig; 333 struct iio_trigger *oldtrig = indio_dev->trig;
334 struct iio_trigger *trig; 334 struct iio_trigger *trig;
335 int ret; 335 int ret;