Commit 86a7a1676a5a34082470869178d2e5fe54f5c3b9

Authored by Linus Torvalds

Merge tag 'staging-3.18-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

Pull staging driver fixes from Greg KH:
 "Here are some staging/iio fixes for 3.18-rc4.

  Nothing major, just a few bugfixes of things that have been reported"

* tag 'staging-3.18-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
  staging:iio:ade7758: Remove "raw" from channel name
  staging:iio:ade7758: Fix check if channels are enabled in prenable
  staging:iio:ade7758: Fix NULL pointer deref when enabling buffer
  iio: as3935: allocate correct iio_device size
  io: accel: kxcjk-1013: Fix iio_event_spec direction
  iio: tsl4531: Fix compiler error when CONFIG_PM_OPS is not defined
  iio: adc: mxs-lradc: Disable the clock on probe failure
  iio: st_sensors: Fix buffer copy
  staging:iio:ad5933: Drop "raw" from channel names
  staging:iio:ad5933: Fix NULL pointer deref when enabling buffer

Showing 6 changed files Side-by-side Diff

drivers/iio/accel/kxcjk-1013.c
... ... @@ -894,7 +894,7 @@
894 894  
895 895 static const struct iio_event_spec kxcjk1013_event = {
896 896 .type = IIO_EV_TYPE_THRESH,
897   - .dir = IIO_EV_DIR_RISING | IIO_EV_DIR_FALLING,
  897 + .dir = IIO_EV_DIR_EITHER,
898 898 .mask_separate = BIT(IIO_EV_INFO_VALUE) |
899 899 BIT(IIO_EV_INFO_ENABLE) |
900 900 BIT(IIO_EV_INFO_PERIOD)
drivers/iio/light/tsl4531.c
... ... @@ -230,9 +230,12 @@
230 230 return i2c_smbus_write_byte_data(to_i2c_client(dev), TSL4531_CONTROL,
231 231 TSL4531_MODE_NORMAL);
232 232 }
233   -#endif
234 233  
235 234 static SIMPLE_DEV_PM_OPS(tsl4531_pm_ops, tsl4531_suspend, tsl4531_resume);
  235 +#define TSL4531_PM_OPS (&tsl4531_pm_ops)
  236 +#else
  237 +#define TSL4531_PM_OPS NULL
  238 +#endif
236 239  
237 240 static const struct i2c_device_id tsl4531_id[] = {
238 241 { "tsl4531", 0 },
... ... @@ -243,7 +246,7 @@
243 246 static struct i2c_driver tsl4531_driver = {
244 247 .driver = {
245 248 .name = TSL4531_DRV_NAME,
246   - .pm = &tsl4531_pm_ops,
  249 + .pm = TSL4531_PM_OPS,
247 250 .owner = THIS_MODULE,
248 251 },
249 252 .probe = tsl4531_probe,
drivers/iio/proximity/as3935.c
... ... @@ -330,7 +330,7 @@
330 330 return -EINVAL;
331 331 }
332 332  
333   - indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(st));
  333 + indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
334 334 if (!indio_dev)
335 335 return -ENOMEM;
336 336  
drivers/staging/iio/meter/ade7758.h
... ... @@ -119,7 +119,6 @@
119 119 u8 *tx;
120 120 u8 *rx;
121 121 struct mutex buf_lock;
122   - const struct iio_chan_spec *ade7758_ring_channels;
123 122 struct spi_transfer ring_xfer[4];
124 123 struct spi_message ring_msg;
125 124 /*
drivers/staging/iio/meter/ade7758_core.c
... ... @@ -634,9 +634,6 @@
634 634 .type = IIO_VOLTAGE,
635 635 .indexed = 1,
636 636 .channel = 0,
637   - .extend_name = "raw",
638   - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
639   - .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
640 637 .address = AD7758_WT(AD7758_PHASE_A, AD7758_VOLTAGE),
641 638 .scan_index = 0,
642 639 .scan_type = {
... ... @@ -648,9 +645,6 @@
648 645 .type = IIO_CURRENT,
649 646 .indexed = 1,
650 647 .channel = 0,
651   - .extend_name = "raw",
652   - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
653   - .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
654 648 .address = AD7758_WT(AD7758_PHASE_A, AD7758_CURRENT),
655 649 .scan_index = 1,
656 650 .scan_type = {
... ... @@ -662,9 +656,7 @@
662 656 .type = IIO_POWER,
663 657 .indexed = 1,
664 658 .channel = 0,
665   - .extend_name = "apparent_raw",
666   - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
667   - .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
  659 + .extend_name = "apparent",
668 660 .address = AD7758_WT(AD7758_PHASE_A, AD7758_APP_PWR),
669 661 .scan_index = 2,
670 662 .scan_type = {
... ... @@ -676,9 +668,7 @@
676 668 .type = IIO_POWER,
677 669 .indexed = 1,
678 670 .channel = 0,
679   - .extend_name = "active_raw",
680   - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
681   - .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
  671 + .extend_name = "active",
682 672 .address = AD7758_WT(AD7758_PHASE_A, AD7758_ACT_PWR),
683 673 .scan_index = 3,
684 674 .scan_type = {
... ... @@ -690,9 +680,7 @@
690 680 .type = IIO_POWER,
691 681 .indexed = 1,
692 682 .channel = 0,
693   - .extend_name = "reactive_raw",
694   - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
695   - .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
  683 + .extend_name = "reactive",
696 684 .address = AD7758_WT(AD7758_PHASE_A, AD7758_REACT_PWR),
697 685 .scan_index = 4,
698 686 .scan_type = {
... ... @@ -704,9 +692,6 @@
704 692 .type = IIO_VOLTAGE,
705 693 .indexed = 1,
706 694 .channel = 1,
707   - .extend_name = "raw",
708   - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
709   - .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
710 695 .address = AD7758_WT(AD7758_PHASE_B, AD7758_VOLTAGE),
711 696 .scan_index = 5,
712 697 .scan_type = {
... ... @@ -718,9 +703,6 @@
718 703 .type = IIO_CURRENT,
719 704 .indexed = 1,
720 705 .channel = 1,
721   - .extend_name = "raw",
722   - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
723   - .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
724 706 .address = AD7758_WT(AD7758_PHASE_B, AD7758_CURRENT),
725 707 .scan_index = 6,
726 708 .scan_type = {
... ... @@ -732,9 +714,7 @@
732 714 .type = IIO_POWER,
733 715 .indexed = 1,
734 716 .channel = 1,
735   - .extend_name = "apparent_raw",
736   - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
737   - .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
  717 + .extend_name = "apparent",
738 718 .address = AD7758_WT(AD7758_PHASE_B, AD7758_APP_PWR),
739 719 .scan_index = 7,
740 720 .scan_type = {
... ... @@ -746,9 +726,7 @@
746 726 .type = IIO_POWER,
747 727 .indexed = 1,
748 728 .channel = 1,
749   - .extend_name = "active_raw",
750   - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
751   - .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
  729 + .extend_name = "active",
752 730 .address = AD7758_WT(AD7758_PHASE_B, AD7758_ACT_PWR),
753 731 .scan_index = 8,
754 732 .scan_type = {
... ... @@ -760,9 +738,7 @@
760 738 .type = IIO_POWER,
761 739 .indexed = 1,
762 740 .channel = 1,
763   - .extend_name = "reactive_raw",
764   - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
765   - .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
  741 + .extend_name = "reactive",
766 742 .address = AD7758_WT(AD7758_PHASE_B, AD7758_REACT_PWR),
767 743 .scan_index = 9,
768 744 .scan_type = {
... ... @@ -774,9 +750,6 @@
774 750 .type = IIO_VOLTAGE,
775 751 .indexed = 1,
776 752 .channel = 2,
777   - .extend_name = "raw",
778   - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
779   - .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
780 753 .address = AD7758_WT(AD7758_PHASE_C, AD7758_VOLTAGE),
781 754 .scan_index = 10,
782 755 .scan_type = {
... ... @@ -788,9 +761,6 @@
788 761 .type = IIO_CURRENT,
789 762 .indexed = 1,
790 763 .channel = 2,
791   - .extend_name = "raw",
792   - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
793   - .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
794 764 .address = AD7758_WT(AD7758_PHASE_C, AD7758_CURRENT),
795 765 .scan_index = 11,
796 766 .scan_type = {
... ... @@ -802,9 +772,7 @@
802 772 .type = IIO_POWER,
803 773 .indexed = 1,
804 774 .channel = 2,
805   - .extend_name = "apparent_raw",
806   - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
807   - .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
  775 + .extend_name = "apparent",
808 776 .address = AD7758_WT(AD7758_PHASE_C, AD7758_APP_PWR),
809 777 .scan_index = 12,
810 778 .scan_type = {
... ... @@ -816,9 +784,7 @@
816 784 .type = IIO_POWER,
817 785 .indexed = 1,
818 786 .channel = 2,
819   - .extend_name = "active_raw",
820   - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
821   - .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
  787 + .extend_name = "active",
822 788 .address = AD7758_WT(AD7758_PHASE_C, AD7758_ACT_PWR),
823 789 .scan_index = 13,
824 790 .scan_type = {
... ... @@ -830,9 +796,7 @@
830 796 .type = IIO_POWER,
831 797 .indexed = 1,
832 798 .channel = 2,
833   - .extend_name = "reactive_raw",
834   - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
835   - .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
  799 + .extend_name = "reactive",
836 800 .address = AD7758_WT(AD7758_PHASE_C, AD7758_REACT_PWR),
837 801 .scan_index = 14,
838 802 .scan_type = {
839 803  
... ... @@ -873,13 +837,14 @@
873 837 goto error_free_rx;
874 838 }
875 839 st->us = spi;
876   - st->ade7758_ring_channels = &ade7758_channels[0];
877 840 mutex_init(&st->buf_lock);
878 841  
879 842 indio_dev->name = spi->dev.driver->name;
880 843 indio_dev->dev.parent = &spi->dev;
881 844 indio_dev->info = &ade7758_info;
882 845 indio_dev->modes = INDIO_DIRECT_MODE;
  846 + indio_dev->channels = ade7758_channels;
  847 + indio_dev->num_channels = ARRAY_SIZE(ade7758_channels);
883 848  
884 849 ret = ade7758_configure_ring(indio_dev);
885 850 if (ret)
drivers/staging/iio/meter/ade7758_ring.c
... ... @@ -85,17 +85,16 @@
85 85 **/
86 86 static int ade7758_ring_preenable(struct iio_dev *indio_dev)
87 87 {
88   - struct ade7758_state *st = iio_priv(indio_dev);
89 88 unsigned channel;
90 89  
91   - if (!bitmap_empty(indio_dev->active_scan_mask, indio_dev->masklength))
  90 + if (bitmap_empty(indio_dev->active_scan_mask, indio_dev->masklength))
92 91 return -EINVAL;
93 92  
94 93 channel = find_first_bit(indio_dev->active_scan_mask,
95 94 indio_dev->masklength);
96 95  
97 96 ade7758_write_waveform_type(&indio_dev->dev,
98   - st->ade7758_ring_channels[channel].address);
  97 + indio_dev->channels[channel].address);
99 98  
100 99 return 0;
101 100 }