Skip to content

Commit 86a7a16

Browse files
committed
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
2 parents 45a4c07 + bce20b2 commit 86a7a16

File tree

6 files changed

+20
-54
lines changed

6 files changed

+20
-54
lines changed

drivers/iio/accel/kxcjk-1013.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@ static const struct attribute_group kxcjk1013_attrs_group = {
894894

895895
static const struct iio_event_spec kxcjk1013_event = {
896896
.type = IIO_EV_TYPE_THRESH,
897-
.dir = IIO_EV_DIR_RISING | IIO_EV_DIR_FALLING,
897+
.dir = IIO_EV_DIR_EITHER,
898898
.mask_separate = BIT(IIO_EV_INFO_VALUE) |
899899
BIT(IIO_EV_INFO_ENABLE) |
900900
BIT(IIO_EV_INFO_PERIOD)

drivers/iio/light/tsl4531.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,12 @@ static int tsl4531_resume(struct device *dev)
230230
return i2c_smbus_write_byte_data(to_i2c_client(dev), TSL4531_CONTROL,
231231
TSL4531_MODE_NORMAL);
232232
}
233-
#endif
234233

235234
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
236239

237240
static const struct i2c_device_id tsl4531_id[] = {
238241
{ "tsl4531", 0 },
@@ -243,7 +246,7 @@ MODULE_DEVICE_TABLE(i2c, tsl4531_id);
243246
static struct i2c_driver tsl4531_driver = {
244247
.driver = {
245248
.name = TSL4531_DRV_NAME,
246-
.pm = &tsl4531_pm_ops,
249+
.pm = TSL4531_PM_OPS,
247250
.owner = THIS_MODULE,
248251
},
249252
.probe = tsl4531_probe,

drivers/iio/proximity/as3935.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ static int as3935_probe(struct spi_device *spi)
330330
return -EINVAL;
331331
}
332332

333-
indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(st));
333+
indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
334334
if (!indio_dev)
335335
return -ENOMEM;
336336

drivers/staging/iio/meter/ade7758.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ struct ade7758_state {
119119
u8 *tx;
120120
u8 *rx;
121121
struct mutex buf_lock;
122-
const struct iio_chan_spec *ade7758_ring_channels;
123122
struct spi_transfer ring_xfer[4];
124123
struct spi_message ring_msg;
125124
/*

drivers/staging/iio/meter/ade7758_core.c

Lines changed: 11 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -634,9 +634,6 @@ static const struct iio_chan_spec ade7758_channels[] = {
634634
.type = IIO_VOLTAGE,
635635
.indexed = 1,
636636
.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),
640637
.address = AD7758_WT(AD7758_PHASE_A, AD7758_VOLTAGE),
641638
.scan_index = 0,
642639
.scan_type = {
@@ -648,9 +645,6 @@ static const struct iio_chan_spec ade7758_channels[] = {
648645
.type = IIO_CURRENT,
649646
.indexed = 1,
650647
.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),
654648
.address = AD7758_WT(AD7758_PHASE_A, AD7758_CURRENT),
655649
.scan_index = 1,
656650
.scan_type = {
@@ -662,9 +656,7 @@ static const struct iio_chan_spec ade7758_channels[] = {
662656
.type = IIO_POWER,
663657
.indexed = 1,
664658
.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",
668660
.address = AD7758_WT(AD7758_PHASE_A, AD7758_APP_PWR),
669661
.scan_index = 2,
670662
.scan_type = {
@@ -676,9 +668,7 @@ static const struct iio_chan_spec ade7758_channels[] = {
676668
.type = IIO_POWER,
677669
.indexed = 1,
678670
.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",
682672
.address = AD7758_WT(AD7758_PHASE_A, AD7758_ACT_PWR),
683673
.scan_index = 3,
684674
.scan_type = {
@@ -690,9 +680,7 @@ static const struct iio_chan_spec ade7758_channels[] = {
690680
.type = IIO_POWER,
691681
.indexed = 1,
692682
.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",
696684
.address = AD7758_WT(AD7758_PHASE_A, AD7758_REACT_PWR),
697685
.scan_index = 4,
698686
.scan_type = {
@@ -704,9 +692,6 @@ static const struct iio_chan_spec ade7758_channels[] = {
704692
.type = IIO_VOLTAGE,
705693
.indexed = 1,
706694
.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),
710695
.address = AD7758_WT(AD7758_PHASE_B, AD7758_VOLTAGE),
711696
.scan_index = 5,
712697
.scan_type = {
@@ -718,9 +703,6 @@ static const struct iio_chan_spec ade7758_channels[] = {
718703
.type = IIO_CURRENT,
719704
.indexed = 1,
720705
.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),
724706
.address = AD7758_WT(AD7758_PHASE_B, AD7758_CURRENT),
725707
.scan_index = 6,
726708
.scan_type = {
@@ -732,9 +714,7 @@ static const struct iio_chan_spec ade7758_channels[] = {
732714
.type = IIO_POWER,
733715
.indexed = 1,
734716
.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",
738718
.address = AD7758_WT(AD7758_PHASE_B, AD7758_APP_PWR),
739719
.scan_index = 7,
740720
.scan_type = {
@@ -746,9 +726,7 @@ static const struct iio_chan_spec ade7758_channels[] = {
746726
.type = IIO_POWER,
747727
.indexed = 1,
748728
.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",
752730
.address = AD7758_WT(AD7758_PHASE_B, AD7758_ACT_PWR),
753731
.scan_index = 8,
754732
.scan_type = {
@@ -760,9 +738,7 @@ static const struct iio_chan_spec ade7758_channels[] = {
760738
.type = IIO_POWER,
761739
.indexed = 1,
762740
.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",
766742
.address = AD7758_WT(AD7758_PHASE_B, AD7758_REACT_PWR),
767743
.scan_index = 9,
768744
.scan_type = {
@@ -774,9 +750,6 @@ static const struct iio_chan_spec ade7758_channels[] = {
774750
.type = IIO_VOLTAGE,
775751
.indexed = 1,
776752
.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),
780753
.address = AD7758_WT(AD7758_PHASE_C, AD7758_VOLTAGE),
781754
.scan_index = 10,
782755
.scan_type = {
@@ -788,9 +761,6 @@ static const struct iio_chan_spec ade7758_channels[] = {
788761
.type = IIO_CURRENT,
789762
.indexed = 1,
790763
.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),
794764
.address = AD7758_WT(AD7758_PHASE_C, AD7758_CURRENT),
795765
.scan_index = 11,
796766
.scan_type = {
@@ -802,9 +772,7 @@ static const struct iio_chan_spec ade7758_channels[] = {
802772
.type = IIO_POWER,
803773
.indexed = 1,
804774
.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",
808776
.address = AD7758_WT(AD7758_PHASE_C, AD7758_APP_PWR),
809777
.scan_index = 12,
810778
.scan_type = {
@@ -816,9 +784,7 @@ static const struct iio_chan_spec ade7758_channels[] = {
816784
.type = IIO_POWER,
817785
.indexed = 1,
818786
.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",
822788
.address = AD7758_WT(AD7758_PHASE_C, AD7758_ACT_PWR),
823789
.scan_index = 13,
824790
.scan_type = {
@@ -830,9 +796,7 @@ static const struct iio_chan_spec ade7758_channels[] = {
830796
.type = IIO_POWER,
831797
.indexed = 1,
832798
.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",
836800
.address = AD7758_WT(AD7758_PHASE_C, AD7758_REACT_PWR),
837801
.scan_index = 14,
838802
.scan_type = {
@@ -873,13 +837,14 @@ static int ade7758_probe(struct spi_device *spi)
873837
goto error_free_rx;
874838
}
875839
st->us = spi;
876-
st->ade7758_ring_channels = &ade7758_channels[0];
877840
mutex_init(&st->buf_lock);
878841

879842
indio_dev->name = spi->dev.driver->name;
880843
indio_dev->dev.parent = &spi->dev;
881844
indio_dev->info = &ade7758_info;
882845
indio_dev->modes = INDIO_DIRECT_MODE;
846+
indio_dev->channels = ade7758_channels;
847+
indio_dev->num_channels = ARRAY_SIZE(ade7758_channels);
883848

884849
ret = ade7758_configure_ring(indio_dev);
885850
if (ret)

drivers/staging/iio/meter/ade7758_ring.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,17 +85,16 @@ static irqreturn_t ade7758_trigger_handler(int irq, void *p)
8585
**/
8686
static int ade7758_ring_preenable(struct iio_dev *indio_dev)
8787
{
88-
struct ade7758_state *st = iio_priv(indio_dev);
8988
unsigned channel;
9089

91-
if (!bitmap_empty(indio_dev->active_scan_mask, indio_dev->masklength))
90+
if (bitmap_empty(indio_dev->active_scan_mask, indio_dev->masklength))
9291
return -EINVAL;
9392

9493
channel = find_first_bit(indio_dev->active_scan_mask,
9594
indio_dev->masklength);
9695

9796
ade7758_write_waveform_type(&indio_dev->dev,
98-
st->ade7758_ring_channels[channel].address);
97+
indio_dev->channels[channel].address);
9998

10099
return 0;
101100
}

0 commit comments

Comments
 (0)