aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2013-12-07 05:45:00 -0500
committerJonathan Cameron <jic23@kernel.org>2013-12-08 08:13:52 -0500
commitcb955852a48c29ef7bd847ce993102e2b58295d4 (patch)
treeed64e5c2f4510d90ab09724aa726d9689061a33b
parentbb7f9d90a5c0c29885cc37418ae208118e04bd4f (diff)
iio: Remove support for the legacy event config interface
Now that all drivers have been converted to the new event config interface we can remove for the legacy event config interface. Also drop the '_new' suffix for the event config interface callbacks, since those are the only callbacks now. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
-rw-r--r--drivers/iio/adc/max1363.c8
-rw-r--r--drivers/iio/dac/ad5421.c6
-rw-r--r--drivers/iio/industrialio-event.c154
-rw-r--r--drivers/iio/light/apds9300.c8
-rw-r--r--drivers/iio/light/cm36651.c8
-rw-r--r--drivers/iio/light/gp2ap020a00f.c8
-rw-r--r--drivers/iio/light/tsl2563.c8
-rw-r--r--drivers/staging/iio/accel/lis3l02dq_core.c8
-rw-r--r--drivers/staging/iio/accel/sca3000_core.c16
-rw-r--r--drivers/staging/iio/adc/ad7291.c8
-rw-r--r--drivers/staging/iio/adc/ad799x_core.c6
-rw-r--r--drivers/staging/iio/cdc/ad7150.c8
-rw-r--r--drivers/staging/iio/iio_simple_dummy.c8
-rw-r--r--drivers/staging/iio/light/tsl2x7x_core.c40
-rw-r--r--include/linux/iio/events.h4
-rw-r--r--include/linux/iio/iio.h34
16 files changed, 97 insertions, 235 deletions
diff --git a/drivers/iio/adc/max1363.c b/drivers/iio/adc/max1363.c
index 6118dced02b6..e283f2f2ee2f 100644
--- a/drivers/iio/adc/max1363.c
+++ b/drivers/iio/adc/max1363.c
@@ -1039,10 +1039,10 @@ static const struct iio_info max1238_info = {
1039}; 1039};
1040 1040
1041static const struct iio_info max1363_info = { 1041static const struct iio_info max1363_info = {
1042 .read_event_value_new = &max1363_read_thresh, 1042 .read_event_value = &max1363_read_thresh,
1043 .write_event_value_new = &max1363_write_thresh, 1043 .write_event_value = &max1363_write_thresh,
1044 .read_event_config_new = &max1363_read_event_config, 1044 .read_event_config = &max1363_read_event_config,
1045 .write_event_config_new = &max1363_write_event_config, 1045 .write_event_config = &max1363_write_event_config,
1046 .read_raw = &max1363_read_raw, 1046 .read_raw = &max1363_read_raw,
1047 .update_scan_mode = &max1363_update_scan_mode, 1047 .update_scan_mode = &max1363_update_scan_mode,
1048 .driver_module = THIS_MODULE, 1048 .driver_module = THIS_MODULE,
diff --git a/drivers/iio/dac/ad5421.c b/drivers/iio/dac/ad5421.c
index 59a0cb51265c..1cb15d8e94b7 100644
--- a/drivers/iio/dac/ad5421.c
+++ b/drivers/iio/dac/ad5421.c
@@ -458,9 +458,9 @@ static int ad5421_read_event_value(struct iio_dev *indio_dev,
458static const struct iio_info ad5421_info = { 458static const struct iio_info ad5421_info = {
459 .read_raw = ad5421_read_raw, 459 .read_raw = ad5421_read_raw,
460 .write_raw = ad5421_write_raw, 460 .write_raw = ad5421_write_raw,
461 .read_event_config_new = ad5421_read_event_config, 461 .read_event_config = ad5421_read_event_config,
462 .write_event_config_new = ad5421_write_event_config, 462 .write_event_config = ad5421_write_event_config,
463 .read_event_value_new = ad5421_read_event_value, 463 .read_event_value = ad5421_read_event_value,
464 .driver_module = THIS_MODULE, 464 .driver_module = THIS_MODULE,
465}; 465};
466 466
diff --git a/drivers/iio/industrialio-event.c b/drivers/iio/industrialio-event.c
index bc043fab4cd1..c9c1419fe6e0 100644
--- a/drivers/iio/industrialio-event.c
+++ b/drivers/iio/industrialio-event.c
@@ -242,13 +242,9 @@ static ssize_t iio_ev_state_store(struct device *dev,
242 if (ret < 0) 242 if (ret < 0)
243 return ret; 243 return ret;
244 244
245 if (indio_dev->info->write_event_config) 245 ret = indio_dev->info->write_event_config(indio_dev,
246 ret = indio_dev->info->write_event_config(indio_dev, 246 this_attr->c, iio_ev_attr_type(this_attr),
247 this_attr->address, val); 247 iio_ev_attr_dir(this_attr), val);
248 else
249 ret = indio_dev->info->write_event_config_new(indio_dev,
250 this_attr->c, iio_ev_attr_type(this_attr),
251 iio_ev_attr_dir(this_attr), val);
252 248
253 return (ret < 0) ? ret : len; 249 return (ret < 0) ? ret : len;
254} 250}
@@ -261,13 +257,9 @@ static ssize_t iio_ev_state_show(struct device *dev,
261 struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); 257 struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
262 int val; 258 int val;
263 259
264 if (indio_dev->info->read_event_config) 260 val = indio_dev->info->read_event_config(indio_dev,
265 val = indio_dev->info->read_event_config(indio_dev, 261 this_attr->c, iio_ev_attr_type(this_attr),
266 this_attr->address); 262 iio_ev_attr_dir(this_attr));
267 else
268 val = indio_dev->info->read_event_config_new(indio_dev,
269 this_attr->c, iio_ev_attr_type(this_attr),
270 iio_ev_attr_dir(this_attr));
271 if (val < 0) 263 if (val < 0)
272 return val; 264 return val;
273 else 265 else
@@ -283,21 +275,13 @@ static ssize_t iio_ev_value_show(struct device *dev,
283 int val, val2; 275 int val, val2;
284 int ret; 276 int ret;
285 277
286 if (indio_dev->info->read_event_value) { 278 ret = indio_dev->info->read_event_value(indio_dev,
287 ret = indio_dev->info->read_event_value(indio_dev, 279 this_attr->c, iio_ev_attr_type(this_attr),
288 this_attr->address, &val); 280 iio_ev_attr_dir(this_attr), iio_ev_attr_info(this_attr),
289 if (ret < 0) 281 &val, &val2);
290 return ret; 282 if (ret < 0)
291 return sprintf(buf, "%d\n", val); 283 return ret;
292 } else { 284 return iio_format_value(buf, ret, val, val2);
293 ret = indio_dev->info->read_event_value_new(indio_dev,
294 this_attr->c, iio_ev_attr_type(this_attr),
295 iio_ev_attr_dir(this_attr), iio_ev_attr_info(this_attr),
296 &val, &val2);
297 if (ret < 0)
298 return ret;
299 return iio_format_value(buf, ret, val, val2);
300 }
301} 285}
302 286
303static ssize_t iio_ev_value_store(struct device *dev, 287static ssize_t iio_ev_value_store(struct device *dev,
@@ -310,25 +294,16 @@ static ssize_t iio_ev_value_store(struct device *dev,
310 int val, val2; 294 int val, val2;
311 int ret; 295 int ret;
312 296
313 if (!indio_dev->info->write_event_value && 297 if (!indio_dev->info->write_event_value)
314 !indio_dev->info->write_event_value_new)
315 return -EINVAL; 298 return -EINVAL;
316 299
317 if (indio_dev->info->write_event_value) { 300 ret = iio_str_to_fixpoint(buf, 100000, &val, &val2);
318 ret = kstrtoint(buf, 10, &val); 301 if (ret)
319 if (ret) 302 return ret;
320 return ret; 303 ret = indio_dev->info->write_event_value(indio_dev,
321 ret = indio_dev->info->write_event_value(indio_dev, 304 this_attr->c, iio_ev_attr_type(this_attr),
322 this_attr->address, val); 305 iio_ev_attr_dir(this_attr), iio_ev_attr_info(this_attr),
323 } else { 306 val, val2);
324 ret = iio_str_to_fixpoint(buf, 100000, &val, &val2);
325 if (ret)
326 return ret;
327 ret = indio_dev->info->write_event_value_new(indio_dev,
328 this_attr->c, iio_ev_attr_type(this_attr),
329 iio_ev_attr_dir(this_attr), iio_ev_attr_info(this_attr),
330 val, val2);
331 }
332 if (ret < 0) 307 if (ret < 0)
333 return ret; 308 return ret;
334 309
@@ -377,7 +352,7 @@ static int iio_device_add_event(struct iio_dev *indio_dev,
377 return attrcount; 352 return attrcount;
378} 353}
379 354
380static int iio_device_add_event_sysfs_new(struct iio_dev *indio_dev, 355static int iio_device_add_event_sysfs(struct iio_dev *indio_dev,
381 struct iio_chan_spec const *chan) 356 struct iio_chan_spec const *chan)
382{ 357{
383 int ret = 0, i, attrcount = 0; 358 int ret = 0, i, attrcount = 0;
@@ -420,89 +395,6 @@ error_ret:
420 return ret; 395 return ret;
421} 396}
422 397
423static int iio_device_add_event_sysfs_old(struct iio_dev *indio_dev,
424 struct iio_chan_spec const *chan)
425{
426 int ret = 0, i, attrcount = 0;
427 u64 mask = 0;
428 char *postfix;
429 if (!chan->event_mask)
430 return 0;
431
432 for_each_set_bit(i, &chan->event_mask, sizeof(chan->event_mask)*8) {
433 postfix = kasprintf(GFP_KERNEL, "%s_%s_en",
434 iio_ev_type_text[i/IIO_EV_DIR_MAX],
435 iio_ev_dir_text[i%IIO_EV_DIR_MAX]);
436 if (postfix == NULL) {
437 ret = -ENOMEM;
438 goto error_ret;
439 }
440 if (chan->modified)
441 mask = IIO_MOD_EVENT_CODE(chan->type, 0, chan->channel2,
442 i/IIO_EV_DIR_MAX,
443 i%IIO_EV_DIR_MAX);
444 else if (chan->differential)
445 mask = IIO_EVENT_CODE(chan->type,
446 0, 0,
447 i%IIO_EV_DIR_MAX,
448 i/IIO_EV_DIR_MAX,
449 0,
450 chan->channel,
451 chan->channel2);
452 else
453 mask = IIO_UNMOD_EVENT_CODE(chan->type,
454 chan->channel,
455 i/IIO_EV_DIR_MAX,
456 i%IIO_EV_DIR_MAX);
457
458 ret = __iio_add_chan_devattr(postfix,
459 chan,
460 &iio_ev_state_show,
461 iio_ev_state_store,
462 mask,
463 0,
464 &indio_dev->dev,
465 &indio_dev->event_interface->
466 dev_attr_list);
467 kfree(postfix);
468 if (ret)
469 goto error_ret;
470 attrcount++;
471 postfix = kasprintf(GFP_KERNEL, "%s_%s_value",
472 iio_ev_type_text[i/IIO_EV_DIR_MAX],
473 iio_ev_dir_text[i%IIO_EV_DIR_MAX]);
474 if (postfix == NULL) {
475 ret = -ENOMEM;
476 goto error_ret;
477 }
478 ret = __iio_add_chan_devattr(postfix, chan,
479 iio_ev_value_show,
480 iio_ev_value_store,
481 mask,
482 0,
483 &indio_dev->dev,
484 &indio_dev->event_interface->
485 dev_attr_list);
486 kfree(postfix);
487 if (ret)
488 goto error_ret;
489 attrcount++;
490 }
491 ret = attrcount;
492error_ret:
493 return ret;
494}
495
496
497static int iio_device_add_event_sysfs(struct iio_dev *indio_dev,
498 struct iio_chan_spec const *chan)
499{
500 if (chan->event_mask)
501 return iio_device_add_event_sysfs_old(indio_dev, chan);
502 else
503 return iio_device_add_event_sysfs_new(indio_dev, chan);
504}
505
506static inline int __iio_add_event_config_attrs(struct iio_dev *indio_dev) 398static inline int __iio_add_event_config_attrs(struct iio_dev *indio_dev)
507{ 399{
508 int j, ret, attrcount = 0; 400 int j, ret, attrcount = 0;
@@ -523,8 +415,6 @@ static bool iio_check_for_dynamic_events(struct iio_dev *indio_dev)
523 int j; 415 int j;
524 416
525 for (j = 0; j < indio_dev->num_channels; j++) { 417 for (j = 0; j < indio_dev->num_channels; j++) {
526 if (indio_dev->channels[j].event_mask != 0)
527 return true;
528 if (indio_dev->channels[j].num_event_specs != 0) 418 if (indio_dev->channels[j].num_event_specs != 0)
529 return true; 419 return true;
530 } 420 }
diff --git a/drivers/iio/light/apds9300.c b/drivers/iio/light/apds9300.c
index 51097bbd59c9..9ddde0ca9c34 100644
--- a/drivers/iio/light/apds9300.c
+++ b/drivers/iio/light/apds9300.c
@@ -344,10 +344,10 @@ static const struct iio_info apds9300_info_no_irq = {
344static const struct iio_info apds9300_info = { 344static const struct iio_info apds9300_info = {
345 .driver_module = THIS_MODULE, 345 .driver_module = THIS_MODULE,
346 .read_raw = apds9300_read_raw, 346 .read_raw = apds9300_read_raw,
347 .read_event_value_new = apds9300_read_thresh, 347 .read_event_value = apds9300_read_thresh,
348 .write_event_value_new = apds9300_write_thresh, 348 .write_event_value = apds9300_write_thresh,
349 .read_event_config_new = apds9300_read_interrupt_config, 349 .read_event_config = apds9300_read_interrupt_config,
350 .write_event_config_new = apds9300_write_interrupt_config, 350 .write_event_config = apds9300_write_interrupt_config,
351}; 351};
352 352
353static const struct iio_event_spec apds9300_event_spec[] = { 353static const struct iio_event_spec apds9300_event_spec[] = {
diff --git a/drivers/iio/light/cm36651.c b/drivers/iio/light/cm36651.c
index 2a0eb8de3396..000cc8eb362d 100644
--- a/drivers/iio/light/cm36651.c
+++ b/drivers/iio/light/cm36651.c
@@ -614,10 +614,10 @@ static const struct iio_info cm36651_info = {
614 .driver_module = THIS_MODULE, 614 .driver_module = THIS_MODULE,
615 .read_raw = &cm36651_read_raw, 615 .read_raw = &cm36651_read_raw,
616 .write_raw = &cm36651_write_raw, 616 .write_raw = &cm36651_write_raw,
617 .read_event_value_new = &cm36651_read_prox_thresh, 617 .read_event_value = &cm36651_read_prox_thresh,
618 .write_event_value_new = &cm36651_write_prox_thresh, 618 .write_event_value = &cm36651_write_prox_thresh,
619 .read_event_config_new = &cm36651_read_prox_event_config, 619 .read_event_config = &cm36651_read_prox_event_config,
620 .write_event_config_new = &cm36651_write_prox_event_config, 620 .write_event_config = &cm36651_write_prox_event_config,
621 .attrs = &cm36651_attribute_group, 621 .attrs = &cm36651_attribute_group,
622}; 622};
623 623
diff --git a/drivers/iio/light/gp2ap020a00f.c b/drivers/iio/light/gp2ap020a00f.c
index dc79835be308..5ea4a03c7e71 100644
--- a/drivers/iio/light/gp2ap020a00f.c
+++ b/drivers/iio/light/gp2ap020a00f.c
@@ -1388,10 +1388,10 @@ static const struct iio_chan_spec gp2ap020a00f_channels[] = {
1388 1388
1389static const struct iio_info gp2ap020a00f_info = { 1389static const struct iio_info gp2ap020a00f_info = {
1390 .read_raw = &gp2ap020a00f_read_raw, 1390 .read_raw = &gp2ap020a00f_read_raw,
1391 .read_event_value_new = &gp2ap020a00f_read_event_val, 1391 .read_event_value = &gp2ap020a00f_read_event_val,
1392 .read_event_config_new = &gp2ap020a00f_read_event_config, 1392 .read_event_config = &gp2ap020a00f_read_event_config,
1393 .write_event_value_new = &gp2ap020a00f_write_event_val, 1393 .write_event_value = &gp2ap020a00f_write_event_val,
1394 .write_event_config_new = &gp2ap020a00f_write_event_config, 1394 .write_event_config = &gp2ap020a00f_write_event_config,
1395 .driver_module = THIS_MODULE, 1395 .driver_module = THIS_MODULE,
1396}; 1396};
1397 1397
diff --git a/drivers/iio/light/tsl2563.c b/drivers/iio/light/tsl2563.c
index 0c6e459c86b1..3d8110157f2d 100644
--- a/drivers/iio/light/tsl2563.c
+++ b/drivers/iio/light/tsl2563.c
@@ -702,10 +702,10 @@ static const struct iio_info tsl2563_info = {
702 .driver_module = THIS_MODULE, 702 .driver_module = THIS_MODULE,
703 .read_raw = &tsl2563_read_raw, 703 .read_raw = &tsl2563_read_raw,
704 .write_raw = &tsl2563_write_raw, 704 .write_raw = &tsl2563_write_raw,
705 .read_event_value_new = &tsl2563_read_thresh, 705 .read_event_value = &tsl2563_read_thresh,
706 .write_event_value_new = &tsl2563_write_thresh, 706 .write_event_value = &tsl2563_write_thresh,
707 .read_event_config_new = &tsl2563_read_interrupt_config, 707 .read_event_config = &tsl2563_read_interrupt_config,
708 .write_event_config_new = &tsl2563_write_interrupt_config, 708 .write_event_config = &tsl2563_write_interrupt_config,
709}; 709};
710 710
711static int tsl2563_probe(struct i2c_client *client, 711static int tsl2563_probe(struct i2c_client *client,
diff --git a/drivers/staging/iio/accel/lis3l02dq_core.c b/drivers/staging/iio/accel/lis3l02dq_core.c
index 735c0a34fa93..898653c09279 100644
--- a/drivers/staging/iio/accel/lis3l02dq_core.c
+++ b/drivers/staging/iio/accel/lis3l02dq_core.c
@@ -676,10 +676,10 @@ static const struct attribute_group lis3l02dq_attribute_group = {
676static const struct iio_info lis3l02dq_info = { 676static const struct iio_info lis3l02dq_info = {
677 .read_raw = &lis3l02dq_read_raw, 677 .read_raw = &lis3l02dq_read_raw,
678 .write_raw = &lis3l02dq_write_raw, 678 .write_raw = &lis3l02dq_write_raw,
679 .read_event_value_new = &lis3l02dq_read_thresh, 679 .read_event_value = &lis3l02dq_read_thresh,
680 .write_event_value_new = &lis3l02dq_write_thresh, 680 .write_event_value = &lis3l02dq_write_thresh,
681 .write_event_config_new = &lis3l02dq_write_event_config, 681 .write_event_config = &lis3l02dq_write_event_config,
682 .read_event_config_new = &lis3l02dq_read_event_config, 682 .read_event_config = &lis3l02dq_read_event_config,
683 .driver_module = THIS_MODULE, 683 .driver_module = THIS_MODULE,
684 .attrs = &lis3l02dq_attribute_group, 684 .attrs = &lis3l02dq_attribute_group,
685}; 685};
diff --git a/drivers/staging/iio/accel/sca3000_core.c b/drivers/staging/iio/accel/sca3000_core.c
index c49e6ef9d05f..7f6ccdfaf168 100644
--- a/drivers/staging/iio/accel/sca3000_core.c
+++ b/drivers/staging/iio/accel/sca3000_core.c
@@ -1126,20 +1126,20 @@ static const struct iio_info sca3000_info = {
1126 .attrs = &sca3000_attribute_group, 1126 .attrs = &sca3000_attribute_group,
1127 .read_raw = &sca3000_read_raw, 1127 .read_raw = &sca3000_read_raw,
1128 .event_attrs = &sca3000_event_attribute_group, 1128 .event_attrs = &sca3000_event_attribute_group,
1129 .read_event_value_new = &sca3000_read_thresh, 1129 .read_event_value = &sca3000_read_thresh,
1130 .write_event_value_new = &sca3000_write_thresh, 1130 .write_event_value = &sca3000_write_thresh,
1131 .read_event_config_new = &sca3000_read_event_config, 1131 .read_event_config = &sca3000_read_event_config,
1132 .write_event_config_new = &sca3000_write_event_config, 1132 .write_event_config = &sca3000_write_event_config,
1133 .driver_module = THIS_MODULE, 1133 .driver_module = THIS_MODULE,
1134}; 1134};
1135 1135
1136static const struct iio_info sca3000_info_with_temp = { 1136static const struct iio_info sca3000_info_with_temp = {
1137 .attrs = &sca3000_attribute_group_with_temp, 1137 .attrs = &sca3000_attribute_group_with_temp,
1138 .read_raw = &sca3000_read_raw, 1138 .read_raw = &sca3000_read_raw,
1139 .read_event_value_new = &sca3000_read_thresh, 1139 .read_event_value = &sca3000_read_thresh,
1140 .write_event_value_new = &sca3000_write_thresh, 1140 .write_event_value = &sca3000_write_thresh,
1141 .read_event_config_new = &sca3000_read_event_config, 1141 .read_event_config = &sca3000_read_event_config,
1142 .write_event_config_new = &sca3000_write_event_config, 1142 .write_event_config = &sca3000_write_event_config,
1143 .driver_module = THIS_MODULE, 1143 .driver_module = THIS_MODULE,
1144}; 1144};
1145 1145
diff --git a/drivers/staging/iio/adc/ad7291.c b/drivers/staging/iio/adc/ad7291.c
index d13f8aeeb62f..357cef2a6f4c 100644
--- a/drivers/staging/iio/adc/ad7291.c
+++ b/drivers/staging/iio/adc/ad7291.c
@@ -452,10 +452,10 @@ static const struct iio_chan_spec ad7291_channels[] = {
452 452
453static const struct iio_info ad7291_info = { 453static const struct iio_info ad7291_info = {
454 .read_raw = &ad7291_read_raw, 454 .read_raw = &ad7291_read_raw,
455 .read_event_config_new = &ad7291_read_event_config, 455 .read_event_config = &ad7291_read_event_config,
456 .write_event_config_new = &ad7291_write_event_config, 456 .write_event_config = &ad7291_write_event_config,
457 .read_event_value_new = &ad7291_read_event_value, 457 .read_event_value = &ad7291_read_event_value,
458 .write_event_value_new = &ad7291_write_event_value, 458 .write_event_value = &ad7291_write_event_value,
459 .driver_module = THIS_MODULE, 459 .driver_module = THIS_MODULE,
460}; 460};
461 461
diff --git a/drivers/staging/iio/adc/ad799x_core.c b/drivers/staging/iio/adc/ad799x_core.c
index 9428be82b655..5ea36410f716 100644
--- a/drivers/staging/iio/adc/ad799x_core.c
+++ b/drivers/staging/iio/adc/ad799x_core.c
@@ -377,9 +377,9 @@ static const struct iio_info ad7991_info = {
377static const struct iio_info ad7993_4_7_8_info = { 377static const struct iio_info ad7993_4_7_8_info = {
378 .read_raw = &ad799x_read_raw, 378 .read_raw = &ad799x_read_raw,
379 .event_attrs = &ad799x_event_attrs_group, 379 .event_attrs = &ad799x_event_attrs_group,
380 .read_event_config_new = &ad799x_read_event_config, 380 .read_event_config = &ad799x_read_event_config,
381 .read_event_value_new = &ad799x_read_event_value, 381 .read_event_value = &ad799x_read_event_value,
382 .write_event_value_new = &ad799x_write_event_value, 382 .write_event_value = &ad799x_write_event_value,
383 .driver_module = THIS_MODULE, 383 .driver_module = THIS_MODULE,
384 .update_scan_mode = ad7997_8_update_scan_mode, 384 .update_scan_mode = ad7997_8_update_scan_mode,
385}; 385};
diff --git a/drivers/staging/iio/cdc/ad7150.c b/drivers/staging/iio/cdc/ad7150.c
index 7e7f9890a642..047af2376300 100644
--- a/drivers/staging/iio/cdc/ad7150.c
+++ b/drivers/staging/iio/cdc/ad7150.c
@@ -576,10 +576,10 @@ static const struct iio_info ad7150_info = {
576 .event_attrs = &ad7150_event_attribute_group, 576 .event_attrs = &ad7150_event_attribute_group,
577 .driver_module = THIS_MODULE, 577 .driver_module = THIS_MODULE,
578 .read_raw = &ad7150_read_raw, 578 .read_raw = &ad7150_read_raw,
579 .read_event_config_new = &ad7150_read_event_config, 579 .read_event_config = &ad7150_read_event_config,
580 .write_event_config_new = &ad7150_write_event_config, 580 .write_event_config = &ad7150_write_event_config,
581 .read_event_value_new = &ad7150_read_event_value, 581 .read_event_value = &ad7150_read_event_value,
582 .write_event_value_new = &ad7150_write_event_value, 582 .write_event_value = &ad7150_write_event_value,
583}; 583};
584 584
585/* 585/*
diff --git a/drivers/staging/iio/iio_simple_dummy.c b/drivers/staging/iio/iio_simple_dummy.c
index 1fac9894b18c..fd334a03a49a 100644
--- a/drivers/staging/iio/iio_simple_dummy.c
+++ b/drivers/staging/iio/iio_simple_dummy.c
@@ -370,10 +370,10 @@ static const struct iio_info iio_dummy_info = {
370 .read_raw = &iio_dummy_read_raw, 370 .read_raw = &iio_dummy_read_raw,
371 .write_raw = &iio_dummy_write_raw, 371 .write_raw = &iio_dummy_write_raw,
372#ifdef CONFIG_IIO_SIMPLE_DUMMY_EVENTS 372#ifdef CONFIG_IIO_SIMPLE_DUMMY_EVENTS
373 .read_event_config_new = &iio_simple_dummy_read_event_config, 373 .read_event_config = &iio_simple_dummy_read_event_config,
374 .write_event_config_new = &iio_simple_dummy_write_event_config, 374 .write_event_config = &iio_simple_dummy_write_event_config,
375 .read_event_value_new = &iio_simple_dummy_read_event_value, 375 .read_event_value = &iio_simple_dummy_read_event_value,
376 .write_event_value_new = &iio_simple_dummy_write_event_value, 376 .write_event_value = &iio_simple_dummy_write_event_value,
377#endif /* CONFIG_IIO_SIMPLE_DUMMY_EVENTS */ 377#endif /* CONFIG_IIO_SIMPLE_DUMMY_EVENTS */
378}; 378};
379 379
diff --git a/drivers/staging/iio/light/tsl2x7x_core.c b/drivers/staging/iio/light/tsl2x7x_core.c
index 18805029d2a9..1e538086d48b 100644
--- a/drivers/staging/iio/light/tsl2x7x_core.c
+++ b/drivers/staging/iio/light/tsl2x7x_core.c
@@ -1672,10 +1672,10 @@ static const struct iio_info tsl2X7X_device_info[] = {
1672 .driver_module = THIS_MODULE, 1672 .driver_module = THIS_MODULE,
1673 .read_raw = &tsl2x7x_read_raw, 1673 .read_raw = &tsl2x7x_read_raw,
1674 .write_raw = &tsl2x7x_write_raw, 1674 .write_raw = &tsl2x7x_write_raw,
1675 .read_event_value_new = &tsl2x7x_read_thresh, 1675 .read_event_value = &tsl2x7x_read_thresh,
1676 .write_event_value_new = &tsl2x7x_write_thresh, 1676 .write_event_value = &tsl2x7x_write_thresh,
1677 .read_event_config_new = &tsl2x7x_read_interrupt_config, 1677 .read_event_config = &tsl2x7x_read_interrupt_config,
1678 .write_event_config_new = &tsl2x7x_write_interrupt_config, 1678 .write_event_config = &tsl2x7x_write_interrupt_config,
1679 }, 1679 },
1680 [PRX] = { 1680 [PRX] = {
1681 .attrs = &tsl2X7X_device_attr_group_tbl[PRX], 1681 .attrs = &tsl2X7X_device_attr_group_tbl[PRX],
@@ -1683,10 +1683,10 @@ static const struct iio_info tsl2X7X_device_info[] = {
1683 .driver_module = THIS_MODULE, 1683 .driver_module = THIS_MODULE,
1684 .read_raw = &tsl2x7x_read_raw, 1684 .read_raw = &tsl2x7x_read_raw,
1685 .write_raw = &tsl2x7x_write_raw, 1685 .write_raw = &tsl2x7x_write_raw,
1686 .read_event_value_new = &tsl2x7x_read_thresh, 1686 .read_event_value = &tsl2x7x_read_thresh,
1687 .write_event_value_new = &tsl2x7x_write_thresh, 1687 .write_event_value = &tsl2x7x_write_thresh,
1688 .read_event_config_new = &tsl2x7x_read_interrupt_config, 1688 .read_event_config = &tsl2x7x_read_interrupt_config,
1689 .write_event_config_new = &tsl2x7x_write_interrupt_config, 1689 .write_event_config = &tsl2x7x_write_interrupt_config,
1690 }, 1690 },
1691 [ALSPRX] = { 1691 [ALSPRX] = {
1692 .attrs = &tsl2X7X_device_attr_group_tbl[ALSPRX], 1692 .attrs = &tsl2X7X_device_attr_group_tbl[ALSPRX],
@@ -1694,10 +1694,10 @@ static const struct iio_info tsl2X7X_device_info[] = {
1694 .driver_module = THIS_MODULE, 1694 .driver_module = THIS_MODULE,
1695 .read_raw = &tsl2x7x_read_raw, 1695 .read_raw = &tsl2x7x_read_raw,
1696 .write_raw = &tsl2x7x_write_raw, 1696 .write_raw = &tsl2x7x_write_raw,
1697 .read_event_value_new = &tsl2x7x_read_thresh, 1697 .read_event_value = &tsl2x7x_read_thresh,
1698 .write_event_value_new = &tsl2x7x_write_thresh, 1698 .write_event_value = &tsl2x7x_write_thresh,
1699 .read_event_config_new = &tsl2x7x_read_interrupt_config, 1699 .read_event_config = &tsl2x7x_read_interrupt_config,
1700 .write_event_config_new = &tsl2x7x_write_interrupt_config, 1700 .write_event_config = &tsl2x7x_write_interrupt_config,
1701 }, 1701 },
1702 [PRX2] = { 1702 [PRX2] = {
1703 .attrs = &tsl2X7X_device_attr_group_tbl[PRX2], 1703 .attrs = &tsl2X7X_device_attr_group_tbl[PRX2],
@@ -1705,10 +1705,10 @@ static const struct iio_info tsl2X7X_device_info[] = {
1705 .driver_module = THIS_MODULE, 1705 .driver_module = THIS_MODULE,
1706 .read_raw = &tsl2x7x_read_raw, 1706 .read_raw = &tsl2x7x_read_raw,
1707 .write_raw = &tsl2x7x_write_raw, 1707 .write_raw = &tsl2x7x_write_raw,
1708 .read_event_value_new = &tsl2x7x_read_thresh, 1708 .read_event_value = &tsl2x7x_read_thresh,
1709 .write_event_value_new = &tsl2x7x_write_thresh, 1709 .write_event_value = &tsl2x7x_write_thresh,
1710 .read_event_config_new = &tsl2x7x_read_interrupt_config, 1710 .read_event_config = &tsl2x7x_read_interrupt_config,
1711 .write_event_config_new = &tsl2x7x_write_interrupt_config, 1711 .write_event_config = &tsl2x7x_write_interrupt_config,
1712 }, 1712 },
1713 [ALSPRX2] = { 1713 [ALSPRX2] = {
1714 .attrs = &tsl2X7X_device_attr_group_tbl[ALSPRX2], 1714 .attrs = &tsl2X7X_device_attr_group_tbl[ALSPRX2],
@@ -1716,10 +1716,10 @@ static const struct iio_info tsl2X7X_device_info[] = {
1716 .driver_module = THIS_MODULE, 1716 .driver_module = THIS_MODULE,
1717 .read_raw = &tsl2x7x_read_raw, 1717 .read_raw = &tsl2x7x_read_raw,
1718 .write_raw = &tsl2x7x_write_raw, 1718 .write_raw = &tsl2x7x_write_raw,
1719 .read_event_value_new = &tsl2x7x_read_thresh, 1719 .read_event_value = &tsl2x7x_read_thresh,
1720 .write_event_value_new = &tsl2x7x_write_thresh, 1720 .write_event_value = &tsl2x7x_write_thresh,
1721 .read_event_config_new = &tsl2x7x_read_interrupt_config, 1721 .read_event_config = &tsl2x7x_read_interrupt_config,
1722 .write_event_config_new = &tsl2x7x_write_interrupt_config, 1722 .write_event_config = &tsl2x7x_write_interrupt_config,
1723 }, 1723 },
1724}; 1724};
1725 1725
diff --git a/include/linux/iio/events.h b/include/linux/iio/events.h
index 5dab2c41031f..8bbd7bc1043d 100644
--- a/include/linux/iio/events.h
+++ b/include/linux/iio/events.h
@@ -46,10 +46,6 @@ struct iio_event_data {
46 ((u16)chan)) 46 ((u16)chan))
47 47
48 48
49#define IIO_EV_DIR_MAX 4
50#define IIO_EV_BIT(type, direction) \
51 (1 << (type*IIO_EV_DIR_MAX + direction))
52
53/** 49/**
54 * IIO_MOD_EVENT_CODE() - create event identifier for modified channels 50 * IIO_MOD_EVENT_CODE() - create event identifier for modified channels
55 * @chan_type: Type of the channel. Should be one of enum iio_chan_type. 51 * @chan_type: Type of the channel. Should be one of enum iio_chan_type.
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index 5b125fd554e4..75a8a20c8179 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -185,7 +185,6 @@ struct iio_event_spec {
185 * by all channels of the same direction. 185 * by all channels of the same direction.
186 * @info_mask_shared_by_all: What information is to be exported that is shared 186 * @info_mask_shared_by_all: What information is to be exported that is shared
187 * by all channels. 187 * by all channels.
188 * @event_mask: What events can this channel produce.
189 * @event_spec: Array of events which should be registered for this 188 * @event_spec: Array of events which should be registered for this
190 * channel. 189 * channel.
191 * @num_event_specs: Size of the event_spec array. 190 * @num_event_specs: Size of the event_spec array.
@@ -226,7 +225,6 @@ struct iio_chan_spec {
226 long info_mask_shared_by_type; 225 long info_mask_shared_by_type;
227 long info_mask_shared_by_dir; 226 long info_mask_shared_by_dir;
228 long info_mask_shared_by_all; 227 long info_mask_shared_by_all;
229 long event_mask;
230 const struct iio_event_spec *event_spec; 228 const struct iio_event_spec *event_spec;
231 unsigned int num_event_specs; 229 unsigned int num_event_specs;
232 const struct iio_chan_spec_ext_info *ext_info; 230 const struct iio_chan_spec_ext_info *ext_info;
@@ -307,16 +305,8 @@ struct iio_dev;
307 * returns IIO_VAL_INT_PLUS_MICRO. 305 * returns IIO_VAL_INT_PLUS_MICRO.
308 * @read_event_config: find out if the event is enabled. 306 * @read_event_config: find out if the event is enabled.
309 * @write_event_config: set if the event is enabled. 307 * @write_event_config: set if the event is enabled.
310 * @read_event_value: read a value associated with the event. Meaning 308 * @read_event_value: read a configuration value associated with the event.
311 * is event dependant. event_code specifies which event. 309 * @write_event_value: write a configuration value for the event.
312 * @write_event_value: write the value associated with the event.
313 * Meaning is event dependent.
314 * @read_event_config_new: find out if the event is enabled. New style interface.
315 * @write_event_config_new: set if the event is enabled. New style interface.
316 * @read_event_value_new: read a configuration value associated with the event.
317 * New style interface.
318 * @write_event_value_new: write a configuration value for the event. New style
319 * interface.
320 * @validate_trigger: function to validate the trigger when the 310 * @validate_trigger: function to validate the trigger when the
321 * current trigger gets changed. 311 * current trigger gets changed.
322 * @update_scan_mode: function to configure device and scan buffer when 312 * @update_scan_mode: function to configure device and scan buffer when
@@ -345,37 +335,23 @@ struct iio_info {
345 long mask); 335 long mask);
346 336
347 int (*read_event_config)(struct iio_dev *indio_dev, 337 int (*read_event_config)(struct iio_dev *indio_dev,
348 u64 event_code);
349
350 int (*write_event_config)(struct iio_dev *indio_dev,
351 u64 event_code,
352 int state);
353
354 int (*read_event_value)(struct iio_dev *indio_dev,
355 u64 event_code,
356 int *val);
357 int (*write_event_value)(struct iio_dev *indio_dev,
358 u64 event_code,
359 int val);
360
361 int (*read_event_config_new)(struct iio_dev *indio_dev,
362 const struct iio_chan_spec *chan, 338 const struct iio_chan_spec *chan,
363 enum iio_event_type type, 339 enum iio_event_type type,
364 enum iio_event_direction dir); 340 enum iio_event_direction dir);
365 341
366 int (*write_event_config_new)(struct iio_dev *indio_dev, 342 int (*write_event_config)(struct iio_dev *indio_dev,
367 const struct iio_chan_spec *chan, 343 const struct iio_chan_spec *chan,
368 enum iio_event_type type, 344 enum iio_event_type type,
369 enum iio_event_direction dir, 345 enum iio_event_direction dir,
370 int state); 346 int state);
371 347
372 int (*read_event_value_new)(struct iio_dev *indio_dev, 348 int (*read_event_value)(struct iio_dev *indio_dev,
373 const struct iio_chan_spec *chan, 349 const struct iio_chan_spec *chan,
374 enum iio_event_type type, 350 enum iio_event_type type,
375 enum iio_event_direction dir, 351 enum iio_event_direction dir,
376 enum iio_event_info info, int *val, int *val2); 352 enum iio_event_info info, int *val, int *val2);
377 353
378 int (*write_event_value_new)(struct iio_dev *indio_dev, 354 int (*write_event_value)(struct iio_dev *indio_dev,
379 const struct iio_chan_spec *chan, 355 const struct iio_chan_spec *chan,
380 enum iio_event_type type, 356 enum iio_event_type type,
381 enum iio_event_direction dir, 357 enum iio_event_direction dir,