diff options
Diffstat (limited to 'drivers/iio')
-rw-r--r-- | drivers/iio/adc/max1363.c | 8 | ||||
-rw-r--r-- | drivers/iio/dac/ad5421.c | 6 | ||||
-rw-r--r-- | drivers/iio/industrialio-event.c | 154 | ||||
-rw-r--r-- | drivers/iio/light/apds9300.c | 8 | ||||
-rw-r--r-- | drivers/iio/light/cm36651.c | 8 | ||||
-rw-r--r-- | drivers/iio/light/gp2ap020a00f.c | 8 | ||||
-rw-r--r-- | drivers/iio/light/tsl2563.c | 8 |
7 files changed, 45 insertions, 155 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 | ||
1041 | static const struct iio_info max1363_info = { | 1041 | static 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, | |||
458 | static const struct iio_info ad5421_info = { | 458 | static 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 | ||
303 | static ssize_t iio_ev_value_store(struct device *dev, | 287 | static 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 | ||
380 | static int iio_device_add_event_sysfs_new(struct iio_dev *indio_dev, | 355 | static 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 | ||
423 | static 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; | ||
492 | error_ret: | ||
493 | return ret; | ||
494 | } | ||
495 | |||
496 | |||
497 | static 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 | |||
506 | static inline int __iio_add_event_config_attrs(struct iio_dev *indio_dev) | 398 | static 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 = { | |||
344 | static const struct iio_info apds9300_info = { | 344 | static 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 | ||
353 | static const struct iio_event_spec apds9300_event_spec[] = { | 353 | static 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 | ||
1389 | static const struct iio_info gp2ap020a00f_info = { | 1389 | static 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 | ||
711 | static int tsl2563_probe(struct i2c_client *client, | 711 | static int tsl2563_probe(struct i2c_client *client, |