Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio:cm36651: Convert to new event config interface

Switch the cm36651 driver to the new IIO event config interface as the old one
is going to be removed.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: Beomho Seo <beomho.seo@samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>

authored by

Lars-Peter Clausen and committed by
Jonathan Cameron
bb7f9d90 c8231a9a

+32 -9
+32 -9
drivers/iio/light/cm36651.c
··· 488 488 } 489 489 490 490 static int cm36651_read_prox_thresh(struct iio_dev *indio_dev, 491 - u64 event_code, int *val) 491 + const struct iio_chan_spec *chan, 492 + enum iio_event_type type, 493 + enum iio_event_direction dir, 494 + enum iio_event_info info, 495 + int *val, int *val2) 492 496 { 493 497 struct cm36651_data *cm36651 = iio_priv(indio_dev); 494 498 ··· 502 498 } 503 499 504 500 static int cm36651_write_prox_thresh(struct iio_dev *indio_dev, 505 - u64 event_code, int val) 501 + const struct iio_chan_spec *chan, 502 + enum iio_event_type type, 503 + enum iio_event_direction dir, 504 + enum iio_event_info info, 505 + int val, int val2) 506 506 { 507 507 struct cm36651_data *cm36651 = iio_priv(indio_dev); 508 508 struct i2c_client *client = cm36651->client; ··· 528 520 } 529 521 530 522 static int cm36651_write_prox_event_config(struct iio_dev *indio_dev, 531 - u64 event_code, int state) 523 + const struct iio_chan_spec *chan, 524 + enum iio_event_type type, 525 + enum iio_event_direction dir, 526 + int state) 532 527 { 533 528 struct cm36651_data *cm36651 = iio_priv(indio_dev); 534 529 int cmd, ret = -EINVAL; ··· 547 536 } 548 537 549 538 static int cm36651_read_prox_event_config(struct iio_dev *indio_dev, 550 - u64 event_code) 539 + const struct iio_chan_spec *chan, 540 + enum iio_event_type type, 541 + enum iio_event_direction dir) 551 542 { 552 543 struct cm36651_data *cm36651 = iio_priv(indio_dev); 553 544 int event_en; ··· 572 559 .channel2 = IIO_MOD_LIGHT_##_color, \ 573 560 } \ 574 561 562 + static const struct iio_event_spec cm36651_event_spec[] = { 563 + { 564 + .type = IIO_EV_TYPE_THRESH, 565 + .dir = IIO_EV_DIR_EITHER, 566 + .mask_separate = BIT(IIO_EV_INFO_VALUE) | 567 + BIT(IIO_EV_INFO_ENABLE), 568 + } 569 + }; 570 + 575 571 static const struct iio_chan_spec cm36651_channels[] = { 576 572 { 577 573 .type = IIO_PROXIMITY, 578 574 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | 579 575 BIT(IIO_CHAN_INFO_INT_TIME), 580 - .event_mask = IIO_EV_BIT(IIO_EV_TYPE_THRESH, IIO_EV_DIR_EITHER) 576 + .event_spec = cm36651_event_spec, 577 + .num_event_specs = ARRAY_SIZE(cm36651_event_spec), 581 578 }, 582 579 CM36651_LIGHT_CHANNEL(RED, CM36651_LIGHT_CHANNEL_IDX_RED), 583 580 CM36651_LIGHT_CHANNEL(GREEN, CM36651_LIGHT_CHANNEL_IDX_GREEN), ··· 614 591 .driver_module = THIS_MODULE, 615 592 .read_raw = &cm36651_read_raw, 616 593 .write_raw = &cm36651_write_raw, 617 - .read_event_value = &cm36651_read_prox_thresh, 618 - .write_event_value = &cm36651_write_prox_thresh, 619 - .read_event_config = &cm36651_read_prox_event_config, 620 - .write_event_config = &cm36651_write_prox_event_config, 594 + .read_event_value_new = &cm36651_read_prox_thresh, 595 + .write_event_value_new = &cm36651_write_prox_thresh, 596 + .read_event_config_new = &cm36651_read_prox_event_config, 597 + .write_event_config_new = &cm36651_write_prox_event_config, 621 598 .attrs = &cm36651_attribute_group, 622 599 }; 623 600