diff options
author | Michael Hennerich <michael.hennerich@analog.com> | 2011-05-18 09:42:28 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-05-19 19:15:03 -0400 |
commit | 44039a671ecceaf023209b0446ca7443ec11c57c (patch) | |
tree | 955c8545b47f2d82ee6089f31904bafadcb3542c | |
parent | b9c445155e0bc805f0f668fd32ec4a3e808931fe (diff) |
staging:iio:adc: AD7606: Drop dev_data in favour of iio_priv()
Some other small cleanups including excess header removals.
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/staging/iio/adc/ad7606.h | 2 | ||||
-rw-r--r-- | drivers/staging/iio/adc/ad7606_core.c | 22 | ||||
-rw-r--r-- | drivers/staging/iio/adc/ad7606_ring.c | 11 |
3 files changed, 16 insertions, 19 deletions
diff --git a/drivers/staging/iio/adc/ad7606.h b/drivers/staging/iio/adc/ad7606.h index 4d9d780c309d..b8b3d8ef1ff2 100644 --- a/drivers/staging/iio/adc/ad7606.h +++ b/drivers/staging/iio/adc/ad7606.h | |||
@@ -109,7 +109,7 @@ enum ad7606_supported_device_ids { | |||
109 | ID_AD7606_4 | 109 | ID_AD7606_4 |
110 | }; | 110 | }; |
111 | 111 | ||
112 | int ad7606_scan_from_ring(struct ad7606_state *st, unsigned ch); | 112 | int ad7606_scan_from_ring(struct iio_dev *indio_dev, unsigned ch); |
113 | int ad7606_register_ring_funcs_and_init(struct iio_dev *indio_dev); | 113 | int ad7606_register_ring_funcs_and_init(struct iio_dev *indio_dev); |
114 | void ad7606_ring_cleanup(struct iio_dev *indio_dev); | 114 | void ad7606_ring_cleanup(struct iio_dev *indio_dev); |
115 | #endif /* IIO_ADC_AD7606_H_ */ | 115 | #endif /* IIO_ADC_AD7606_H_ */ |
diff --git a/drivers/staging/iio/adc/ad7606_core.c b/drivers/staging/iio/adc/ad7606_core.c index 0db11f1b761b..fb96802819fc 100644 --- a/drivers/staging/iio/adc/ad7606_core.c +++ b/drivers/staging/iio/adc/ad7606_core.c | |||
@@ -7,12 +7,10 @@ | |||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/interrupt.h> | 9 | #include <linux/interrupt.h> |
10 | #include <linux/workqueue.h> | ||
11 | #include <linux/device.h> | 10 | #include <linux/device.h> |
12 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
13 | #include <linux/slab.h> | 12 | #include <linux/slab.h> |
14 | #include <linux/sysfs.h> | 13 | #include <linux/sysfs.h> |
15 | #include <linux/list.h> | ||
16 | #include <linux/regulator/consumer.h> | 14 | #include <linux/regulator/consumer.h> |
17 | #include <linux/err.h> | 15 | #include <linux/err.h> |
18 | #include <linux/gpio.h> | 16 | #include <linux/gpio.h> |
@@ -38,8 +36,9 @@ int ad7606_reset(struct ad7606_state *st) | |||
38 | return -ENODEV; | 36 | return -ENODEV; |
39 | } | 37 | } |
40 | 38 | ||
41 | static int ad7606_scan_direct(struct ad7606_state *st, unsigned ch) | 39 | static int ad7606_scan_direct(struct iio_dev *indio_dev, unsigned ch) |
42 | { | 40 | { |
41 | struct ad7606_state *st = iio_priv(indio_dev); | ||
43 | int ret; | 42 | int ret; |
44 | 43 | ||
45 | st->done = false; | 44 | st->done = false; |
@@ -85,16 +84,16 @@ static int ad7606_read_raw(struct iio_dev *indio_dev, | |||
85 | long m) | 84 | long m) |
86 | { | 85 | { |
87 | int ret; | 86 | int ret; |
88 | struct ad7606_state *st = indio_dev->dev_data; | 87 | struct ad7606_state *st = iio_priv(indio_dev); |
89 | unsigned int scale_uv; | 88 | unsigned int scale_uv; |
90 | 89 | ||
91 | switch (m) { | 90 | switch (m) { |
92 | case 0: | 91 | case 0: |
93 | mutex_lock(&indio_dev->mlock); | 92 | mutex_lock(&indio_dev->mlock); |
94 | if (iio_ring_enabled(indio_dev)) | 93 | if (iio_ring_enabled(indio_dev)) |
95 | ret = ad7606_scan_from_ring(st, chan->address); | 94 | ret = ad7606_scan_from_ring(indio_dev, chan->address); |
96 | else | 95 | else |
97 | ret = ad7606_scan_direct(st, chan->address); | 96 | ret = ad7606_scan_direct(indio_dev, chan->address); |
98 | mutex_unlock(&indio_dev->mlock); | 97 | mutex_unlock(&indio_dev->mlock); |
99 | 98 | ||
100 | if (ret < 0) | 99 | if (ret < 0) |
@@ -115,7 +114,7 @@ static ssize_t ad7606_show_range(struct device *dev, | |||
115 | struct device_attribute *attr, char *buf) | 114 | struct device_attribute *attr, char *buf) |
116 | { | 115 | { |
117 | struct iio_dev *indio_dev = dev_get_drvdata(dev); | 116 | struct iio_dev *indio_dev = dev_get_drvdata(dev); |
118 | struct ad7606_state *st = iio_dev_get_devdata(indio_dev); | 117 | struct ad7606_state *st = iio_priv(indio_dev); |
119 | 118 | ||
120 | return sprintf(buf, "%u\n", st->range); | 119 | return sprintf(buf, "%u\n", st->range); |
121 | } | 120 | } |
@@ -124,7 +123,7 @@ static ssize_t ad7606_store_range(struct device *dev, | |||
124 | struct device_attribute *attr, const char *buf, size_t count) | 123 | struct device_attribute *attr, const char *buf, size_t count) |
125 | { | 124 | { |
126 | struct iio_dev *indio_dev = dev_get_drvdata(dev); | 125 | struct iio_dev *indio_dev = dev_get_drvdata(dev); |
127 | struct ad7606_state *st = iio_dev_get_devdata(indio_dev); | 126 | struct ad7606_state *st = iio_priv(indio_dev); |
128 | unsigned long lval; | 127 | unsigned long lval; |
129 | 128 | ||
130 | if (strict_strtoul(buf, 10, &lval)) | 129 | if (strict_strtoul(buf, 10, &lval)) |
@@ -149,7 +148,7 @@ static ssize_t ad7606_show_oversampling_ratio(struct device *dev, | |||
149 | struct device_attribute *attr, char *buf) | 148 | struct device_attribute *attr, char *buf) |
150 | { | 149 | { |
151 | struct iio_dev *indio_dev = dev_get_drvdata(dev); | 150 | struct iio_dev *indio_dev = dev_get_drvdata(dev); |
152 | struct ad7606_state *st = iio_dev_get_devdata(indio_dev); | 151 | struct ad7606_state *st = iio_priv(indio_dev); |
153 | 152 | ||
154 | return sprintf(buf, "%u\n", st->oversampling); | 153 | return sprintf(buf, "%u\n", st->oversampling); |
155 | } | 154 | } |
@@ -170,7 +169,7 @@ static ssize_t ad7606_store_oversampling_ratio(struct device *dev, | |||
170 | struct device_attribute *attr, const char *buf, size_t count) | 169 | struct device_attribute *attr, const char *buf, size_t count) |
171 | { | 170 | { |
172 | struct iio_dev *indio_dev = dev_get_drvdata(dev); | 171 | struct iio_dev *indio_dev = dev_get_drvdata(dev); |
173 | struct ad7606_state *st = iio_dev_get_devdata(indio_dev); | 172 | struct ad7606_state *st = iio_priv(indio_dev); |
174 | unsigned long lval; | 173 | unsigned long lval; |
175 | int ret; | 174 | int ret; |
176 | 175 | ||
@@ -211,7 +210,7 @@ static mode_t ad7606_attr_is_visible(struct kobject *kobj, | |||
211 | { | 210 | { |
212 | struct device *dev = container_of(kobj, struct device, kobj); | 211 | struct device *dev = container_of(kobj, struct device, kobj); |
213 | struct iio_dev *indio_dev = dev_get_drvdata(dev); | 212 | struct iio_dev *indio_dev = dev_get_drvdata(dev); |
214 | struct ad7606_state *st = iio_dev_get_devdata(indio_dev); | 213 | struct ad7606_state *st = iio_priv(indio_dev); |
215 | 214 | ||
216 | mode_t mode = attr->mode; | 215 | mode_t mode = attr->mode; |
217 | 216 | ||
@@ -472,7 +471,6 @@ struct iio_dev *ad7606_probe(struct device *dev, int irq, | |||
472 | 471 | ||
473 | indio_dev->dev.parent = dev; | 472 | indio_dev->dev.parent = dev; |
474 | indio_dev->attrs = &ad7606_attribute_group; | 473 | indio_dev->attrs = &ad7606_attribute_group; |
475 | indio_dev->dev_data = (void *)(st); | ||
476 | indio_dev->driver_module = THIS_MODULE; | 474 | indio_dev->driver_module = THIS_MODULE; |
477 | indio_dev->modes = INDIO_DIRECT_MODE; | 475 | indio_dev->modes = INDIO_DIRECT_MODE; |
478 | indio_dev->name = st->chip_info->name; | 476 | indio_dev->name = st->chip_info->name; |
diff --git a/drivers/staging/iio/adc/ad7606_ring.c b/drivers/staging/iio/adc/ad7606_ring.c index 925806c9cd53..85cde6a92070 100644 --- a/drivers/staging/iio/adc/ad7606_ring.c +++ b/drivers/staging/iio/adc/ad7606_ring.c | |||
@@ -7,7 +7,6 @@ | |||
7 | 7 | ||
8 | #include <linux/interrupt.h> | 8 | #include <linux/interrupt.h> |
9 | #include <linux/gpio.h> | 9 | #include <linux/gpio.h> |
10 | #include <linux/workqueue.h> | ||
11 | #include <linux/device.h> | 10 | #include <linux/device.h> |
12 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
13 | #include <linux/slab.h> | 12 | #include <linux/slab.h> |
@@ -21,9 +20,9 @@ | |||
21 | 20 | ||
22 | #include "ad7606.h" | 21 | #include "ad7606.h" |
23 | 22 | ||
24 | int ad7606_scan_from_ring(struct ad7606_state *st, unsigned ch) | 23 | int ad7606_scan_from_ring(struct iio_dev *indio_dev, unsigned ch) |
25 | { | 24 | { |
26 | struct iio_ring_buffer *ring = iio_priv_to_dev(st)->ring; | 25 | struct iio_ring_buffer *ring = indio_dev->ring; |
27 | int ret; | 26 | int ret; |
28 | u16 *ring_data; | 27 | u16 *ring_data; |
29 | 28 | ||
@@ -54,7 +53,7 @@ error_ret: | |||
54 | **/ | 53 | **/ |
55 | static int ad7606_ring_preenable(struct iio_dev *indio_dev) | 54 | static int ad7606_ring_preenable(struct iio_dev *indio_dev) |
56 | { | 55 | { |
57 | struct ad7606_state *st = indio_dev->dev_data; | 56 | struct ad7606_state *st = iio_priv(indio_dev); |
58 | struct iio_ring_buffer *ring = indio_dev->ring; | 57 | struct iio_ring_buffer *ring = indio_dev->ring; |
59 | size_t d_size; | 58 | size_t d_size; |
60 | 59 | ||
@@ -84,7 +83,7 @@ static irqreturn_t ad7606_trigger_handler_th_bh(int irq, void *p) | |||
84 | { | 83 | { |
85 | struct iio_poll_func *pf = p; | 84 | struct iio_poll_func *pf = p; |
86 | struct iio_dev *indio_dev = pf->private_data; | 85 | struct iio_dev *indio_dev = pf->private_data; |
87 | struct ad7606_state *st = indio_dev->dev_data; | 86 | struct ad7606_state *st = iio_priv(indio_dev); |
88 | 87 | ||
89 | gpio_set_value(st->pdata->gpio_convst, 1); | 88 | gpio_set_value(st->pdata->gpio_convst, 1); |
90 | 89 | ||
@@ -159,7 +158,7 @@ static const struct iio_ring_setup_ops ad7606_ring_setup_ops = { | |||
159 | 158 | ||
160 | int ad7606_register_ring_funcs_and_init(struct iio_dev *indio_dev) | 159 | int ad7606_register_ring_funcs_and_init(struct iio_dev *indio_dev) |
161 | { | 160 | { |
162 | struct ad7606_state *st = indio_dev->dev_data; | 161 | struct ad7606_state *st = iio_priv(indio_dev); |
163 | int ret; | 162 | int ret; |
164 | 163 | ||
165 | indio_dev->ring = iio_sw_rb_allocate(indio_dev); | 164 | indio_dev->ring = iio_sw_rb_allocate(indio_dev); |