aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Hennerich <michael.hennerich@analog.com>2012-04-27 04:58:36 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-04-29 21:26:17 -0400
commitfc6d11398e22a3b2cfd7c3b8421653c6075b624b (patch)
tree9347433ec6449472a10b48d3d01c8526b048a03b
parent73e016ef94d801bd0278959606d2f72f07a2abab (diff)
iio: core: iio_chan_spec_ext_info: Add private handle
There is currently no user, but we might need it in future. So better add it now, before we have to convert drivers afterwards. Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Acked-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/iio/industrialio-core.c5
-rw-r--r--drivers/staging/iio/dac/ad5064.c12
-rw-r--r--drivers/staging/iio/dac/ad5446.c6
-rw-r--r--include/linux/iio/iio.h11
4 files changed, 22 insertions, 12 deletions
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index 47a72473d0b5..72e33b819f91 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -281,7 +281,7 @@ static ssize_t iio_read_channel_ext_info(struct device *dev,
281 281
282 ext_info = &this_attr->c->ext_info[this_attr->address]; 282 ext_info = &this_attr->c->ext_info[this_attr->address];
283 283
284 return ext_info->read(indio_dev, this_attr->c, buf); 284 return ext_info->read(indio_dev, ext_info->private, this_attr->c, buf);
285} 285}
286 286
287static ssize_t iio_write_channel_ext_info(struct device *dev, 287static ssize_t iio_write_channel_ext_info(struct device *dev,
@@ -295,7 +295,8 @@ static ssize_t iio_write_channel_ext_info(struct device *dev,
295 295
296 ext_info = &this_attr->c->ext_info[this_attr->address]; 296 ext_info = &this_attr->c->ext_info[this_attr->address];
297 297
298 return ext_info->write(indio_dev, this_attr->c, buf, len); 298 return ext_info->write(indio_dev, ext_info->private,
299 this_attr->c, buf, len);
299} 300}
300 301
301static ssize_t iio_read_channel_info(struct device *dev, 302static ssize_t iio_read_channel_info(struct device *dev,
diff --git a/drivers/staging/iio/dac/ad5064.c b/drivers/staging/iio/dac/ad5064.c
index bce641a1cf82..047148aa66b2 100644
--- a/drivers/staging/iio/dac/ad5064.c
+++ b/drivers/staging/iio/dac/ad5064.c
@@ -144,14 +144,14 @@ static const char ad5064_powerdown_modes[][15] = {
144}; 144};
145 145
146static ssize_t ad5064_read_powerdown_mode_available(struct iio_dev *indio_dev, 146static ssize_t ad5064_read_powerdown_mode_available(struct iio_dev *indio_dev,
147 const struct iio_chan_spec *chan, char *buf) 147 uintptr_t private, const struct iio_chan_spec *chan, char *buf)
148{ 148{
149 return sprintf(buf, "%s %s %s\n", ad5064_powerdown_modes[1], 149 return sprintf(buf, "%s %s %s\n", ad5064_powerdown_modes[1],
150 ad5064_powerdown_modes[2], ad5064_powerdown_modes[3]); 150 ad5064_powerdown_modes[2], ad5064_powerdown_modes[3]);
151} 151}
152 152
153static ssize_t ad5064_read_powerdown_mode(struct iio_dev *indio_dev, 153static ssize_t ad5064_read_powerdown_mode(struct iio_dev *indio_dev,
154 const struct iio_chan_spec *chan, char *buf) 154 uintptr_t private, const struct iio_chan_spec *chan, char *buf)
155{ 155{
156 struct ad5064_state *st = iio_priv(indio_dev); 156 struct ad5064_state *st = iio_priv(indio_dev);
157 157
@@ -160,7 +160,8 @@ static ssize_t ad5064_read_powerdown_mode(struct iio_dev *indio_dev,
160} 160}
161 161
162static ssize_t ad5064_write_powerdown_mode(struct iio_dev *indio_dev, 162static ssize_t ad5064_write_powerdown_mode(struct iio_dev *indio_dev,
163 const struct iio_chan_spec *chan, const char *buf, size_t len) 163 uintptr_t private, const struct iio_chan_spec *chan, const char *buf,
164 size_t len)
164{ 165{
165 struct ad5064_state *st = iio_priv(indio_dev); 166 struct ad5064_state *st = iio_priv(indio_dev);
166 unsigned int mode, i; 167 unsigned int mode, i;
@@ -187,7 +188,7 @@ static ssize_t ad5064_write_powerdown_mode(struct iio_dev *indio_dev,
187} 188}
188 189
189static ssize_t ad5064_read_dac_powerdown(struct iio_dev *indio_dev, 190static ssize_t ad5064_read_dac_powerdown(struct iio_dev *indio_dev,
190 const struct iio_chan_spec *chan, char *buf) 191 uintptr_t private, const struct iio_chan_spec *chan, char *buf)
191{ 192{
192 struct ad5064_state *st = iio_priv(indio_dev); 193 struct ad5064_state *st = iio_priv(indio_dev);
193 194
@@ -195,7 +196,8 @@ static ssize_t ad5064_read_dac_powerdown(struct iio_dev *indio_dev,
195} 196}
196 197
197static ssize_t ad5064_write_dac_powerdown(struct iio_dev *indio_dev, 198static ssize_t ad5064_write_dac_powerdown(struct iio_dev *indio_dev,
198 const struct iio_chan_spec *chan, const char *buf, size_t len) 199 uintptr_t private, const struct iio_chan_spec *chan, const char *buf,
200 size_t len)
199{ 201{
200 struct ad5064_state *st = iio_priv(indio_dev); 202 struct ad5064_state *st = iio_priv(indio_dev);
201 bool pwr_down; 203 bool pwr_down;
diff --git a/drivers/staging/iio/dac/ad5446.c b/drivers/staging/iio/dac/ad5446.c
index 3b2551f67a0d..daa65b384c13 100644
--- a/drivers/staging/iio/dac/ad5446.c
+++ b/drivers/staging/iio/dac/ad5446.c
@@ -46,13 +46,14 @@ static const char * const ad5446_powerdown_modes[] = {
46}; 46};
47 47
48static ssize_t ad5446_read_powerdown_mode_available(struct iio_dev *indio_dev, 48static ssize_t ad5446_read_powerdown_mode_available(struct iio_dev *indio_dev,
49 const struct iio_chan_spec *chan, char *buf) 49 uintptr_t private, const struct iio_chan_spec *chan, char *buf)
50{ 50{
51 return sprintf(buf, "%s %s %s\n", ad5446_powerdown_modes[1], 51 return sprintf(buf, "%s %s %s\n", ad5446_powerdown_modes[1],
52 ad5446_powerdown_modes[2], ad5446_powerdown_modes[3]); 52 ad5446_powerdown_modes[2], ad5446_powerdown_modes[3]);
53} 53}
54 54
55static ssize_t ad5446_write_powerdown_mode(struct iio_dev *indio_dev, 55static ssize_t ad5446_write_powerdown_mode(struct iio_dev *indio_dev,
56 uintptr_t private,
56 const struct iio_chan_spec *chan, 57 const struct iio_chan_spec *chan,
57 const char *buf, size_t len) 58 const char *buf, size_t len)
58{ 59{
@@ -73,6 +74,7 @@ static ssize_t ad5446_write_powerdown_mode(struct iio_dev *indio_dev,
73} 74}
74 75
75static ssize_t ad5446_read_powerdown_mode(struct iio_dev *indio_dev, 76static ssize_t ad5446_read_powerdown_mode(struct iio_dev *indio_dev,
77 uintptr_t private,
76 const struct iio_chan_spec *chan, 78 const struct iio_chan_spec *chan,
77 char *buf) 79 char *buf)
78{ 80{
@@ -82,6 +84,7 @@ static ssize_t ad5446_read_powerdown_mode(struct iio_dev *indio_dev,
82} 84}
83 85
84static ssize_t ad5446_read_dac_powerdown(struct iio_dev *indio_dev, 86static ssize_t ad5446_read_dac_powerdown(struct iio_dev *indio_dev,
87 uintptr_t private,
85 const struct iio_chan_spec *chan, 88 const struct iio_chan_spec *chan,
86 char *buf) 89 char *buf)
87{ 90{
@@ -91,6 +94,7 @@ static ssize_t ad5446_read_dac_powerdown(struct iio_dev *indio_dev,
91} 94}
92 95
93static ssize_t ad5446_write_dac_powerdown(struct iio_dev *indio_dev, 96static ssize_t ad5446_write_dac_powerdown(struct iio_dev *indio_dev,
97 uintptr_t private,
94 const struct iio_chan_spec *chan, 98 const struct iio_chan_spec *chan,
95 const char *buf, size_t len) 99 const char *buf, size_t len)
96{ 100{
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index 43002b2b1e38..6fdbdb858e35 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -111,14 +111,17 @@ struct iio_dev;
111 * @shared: Whether this attribute is shared between all channels. 111 * @shared: Whether this attribute is shared between all channels.
112 * @read: Read callback for this info attribute, may be NULL. 112 * @read: Read callback for this info attribute, may be NULL.
113 * @write: Write callback for this info attribute, may be NULL. 113 * @write: Write callback for this info attribute, may be NULL.
114 * @private: Data private to the driver.
114 */ 115 */
115struct iio_chan_spec_ext_info { 116struct iio_chan_spec_ext_info {
116 const char *name; 117 const char *name;
117 bool shared; 118 bool shared;
118 ssize_t (*read)(struct iio_dev *, struct iio_chan_spec const *, 119 ssize_t (*read)(struct iio_dev *, uintptr_t private,
119 char *buf); 120 struct iio_chan_spec const *, char *buf);
120 ssize_t (*write)(struct iio_dev *, struct iio_chan_spec const *, 121 ssize_t (*write)(struct iio_dev *, uintptr_t private,
121 const char *buf, size_t len); 122 struct iio_chan_spec const *, const char *buf,
123 size_t len);
124 uintptr_t private;
122}; 125};
123 126
124/** 127/**