Skip to content

Commit bcb3928

Browse files
committed
Merge tag 'iio-fixes-for-5.7b' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus
Jonathan writes: iio-fixes-for-5.7b Second set of fixes for IIO in the 5.7 cycle. Usual mixed bag of breakage in new code and ancient bugs. ad2s1210 - Fix missing CS change needed to actually read anything. atlas-sensor - Avoid clashing scan index with the timestamp channel. sca3000 - Fix a randomly placed get_device in an error message print. st_lsm6dsx - Fix missing unlock in error path. stm32-adc - Fix which device is used to request DMA to ensure it's one that has actually been registered at point of use. stm32-dfsdm - Fix which device is used to request DMA to ensure it's one that has actually been registered at poitn of use. ti-ads8344 - Fix channel selection. vf610 dac - Fix some missing error handling code. * tag 'iio-fixes-for-5.7b' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: iio: sca3000: Remove an erroneous 'get_device()' iio: adc: stm32-dfsdm: fix device used to request dma iio: adc: stm32-adc: fix device used to request dma iio: adc: ti-ads8344: Fix channel selection staging: iio: ad2s1210: Fix SPI reading iio: dac: vf610: Fix an error handling path in 'vf610_dac_probe()' iio: imu: st_lsm6dsx: unlock on error in st_lsm6dsx_shub_write_raw() iio: chemical: atlas-sensor: correct DO-SM channels
2 parents f0b9d87 + 928edef commit bcb3928

File tree

8 files changed

+52
-26
lines changed

8 files changed

+52
-26
lines changed

drivers/iio/accel/sca3000.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,7 @@ static int sca3000_read_data(struct sca3000_state *st,
980980
st->tx[0] = SCA3000_READ_REG(reg_address_high);
981981
ret = spi_sync_transfer(st->us, xfer, ARRAY_SIZE(xfer));
982982
if (ret) {
983-
dev_err(get_device(&st->us->dev), "problem reading register");
983+
dev_err(&st->us->dev, "problem reading register\n");
984984
return ret;
985985
}
986986

drivers/iio/adc/stm32-adc.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1812,18 +1812,18 @@ static int stm32_adc_chan_of_init(struct iio_dev *indio_dev)
18121812
return 0;
18131813
}
18141814

1815-
static int stm32_adc_dma_request(struct iio_dev *indio_dev)
1815+
static int stm32_adc_dma_request(struct device *dev, struct iio_dev *indio_dev)
18161816
{
18171817
struct stm32_adc *adc = iio_priv(indio_dev);
18181818
struct dma_slave_config config;
18191819
int ret;
18201820

1821-
adc->dma_chan = dma_request_chan(&indio_dev->dev, "rx");
1821+
adc->dma_chan = dma_request_chan(dev, "rx");
18221822
if (IS_ERR(adc->dma_chan)) {
18231823
ret = PTR_ERR(adc->dma_chan);
18241824
if (ret != -ENODEV) {
18251825
if (ret != -EPROBE_DEFER)
1826-
dev_err(&indio_dev->dev,
1826+
dev_err(dev,
18271827
"DMA channel request failed with %d\n",
18281828
ret);
18291829
return ret;
@@ -1930,7 +1930,7 @@ static int stm32_adc_probe(struct platform_device *pdev)
19301930
if (ret < 0)
19311931
return ret;
19321932

1933-
ret = stm32_adc_dma_request(indio_dev);
1933+
ret = stm32_adc_dma_request(dev, indio_dev);
19341934
if (ret < 0)
19351935
return ret;
19361936

drivers/iio/adc/stm32-dfsdm-adc.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ enum sd_converter_type {
6262

6363
struct stm32_dfsdm_dev_data {
6464
int type;
65-
int (*init)(struct iio_dev *indio_dev);
65+
int (*init)(struct device *dev, struct iio_dev *indio_dev);
6666
unsigned int num_channels;
6767
const struct regmap_config *regmap_cfg;
6868
};
@@ -1365,11 +1365,12 @@ static void stm32_dfsdm_dma_release(struct iio_dev *indio_dev)
13651365
}
13661366
}
13671367

1368-
static int stm32_dfsdm_dma_request(struct iio_dev *indio_dev)
1368+
static int stm32_dfsdm_dma_request(struct device *dev,
1369+
struct iio_dev *indio_dev)
13691370
{
13701371
struct stm32_dfsdm_adc *adc = iio_priv(indio_dev);
13711372

1372-
adc->dma_chan = dma_request_chan(&indio_dev->dev, "rx");
1373+
adc->dma_chan = dma_request_chan(dev, "rx");
13731374
if (IS_ERR(adc->dma_chan)) {
13741375
int ret = PTR_ERR(adc->dma_chan);
13751376

@@ -1425,7 +1426,7 @@ static int stm32_dfsdm_adc_chan_init_one(struct iio_dev *indio_dev,
14251426
&adc->dfsdm->ch_list[ch->channel]);
14261427
}
14271428

1428-
static int stm32_dfsdm_audio_init(struct iio_dev *indio_dev)
1429+
static int stm32_dfsdm_audio_init(struct device *dev, struct iio_dev *indio_dev)
14291430
{
14301431
struct iio_chan_spec *ch;
14311432
struct stm32_dfsdm_adc *adc = iio_priv(indio_dev);
@@ -1452,10 +1453,10 @@ static int stm32_dfsdm_audio_init(struct iio_dev *indio_dev)
14521453
indio_dev->num_channels = 1;
14531454
indio_dev->channels = ch;
14541455

1455-
return stm32_dfsdm_dma_request(indio_dev);
1456+
return stm32_dfsdm_dma_request(dev, indio_dev);
14561457
}
14571458

1458-
static int stm32_dfsdm_adc_init(struct iio_dev *indio_dev)
1459+
static int stm32_dfsdm_adc_init(struct device *dev, struct iio_dev *indio_dev)
14591460
{
14601461
struct iio_chan_spec *ch;
14611462
struct stm32_dfsdm_adc *adc = iio_priv(indio_dev);
@@ -1499,17 +1500,17 @@ static int stm32_dfsdm_adc_init(struct iio_dev *indio_dev)
14991500
init_completion(&adc->completion);
15001501

15011502
/* Optionally request DMA */
1502-
ret = stm32_dfsdm_dma_request(indio_dev);
1503+
ret = stm32_dfsdm_dma_request(dev, indio_dev);
15031504
if (ret) {
15041505
if (ret != -ENODEV) {
15051506
if (ret != -EPROBE_DEFER)
1506-
dev_err(&indio_dev->dev,
1507+
dev_err(dev,
15071508
"DMA channel request failed with %d\n",
15081509
ret);
15091510
return ret;
15101511
}
15111512

1512-
dev_dbg(&indio_dev->dev, "No DMA support\n");
1513+
dev_dbg(dev, "No DMA support\n");
15131514
return 0;
15141515
}
15151516

@@ -1622,7 +1623,7 @@ static int stm32_dfsdm_adc_probe(struct platform_device *pdev)
16221623
adc->dfsdm->fl_list[adc->fl_id].sync_mode = val;
16231624

16241625
adc->dev_data = dev_data;
1625-
ret = dev_data->init(iio);
1626+
ret = dev_data->init(dev, iio);
16261627
if (ret < 0)
16271628
return ret;
16281629

drivers/iio/adc/ti-ads8344.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,17 @@ struct ads8344 {
3232
u8 rx_buf[3];
3333
};
3434

35-
#define ADS8344_VOLTAGE_CHANNEL(chan, si) \
35+
#define ADS8344_VOLTAGE_CHANNEL(chan, addr) \
3636
{ \
3737
.type = IIO_VOLTAGE, \
3838
.indexed = 1, \
3939
.channel = chan, \
4040
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
4141
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
42+
.address = addr, \
4243
}
4344

44-
#define ADS8344_VOLTAGE_CHANNEL_DIFF(chan1, chan2, si) \
45+
#define ADS8344_VOLTAGE_CHANNEL_DIFF(chan1, chan2, addr) \
4546
{ \
4647
.type = IIO_VOLTAGE, \
4748
.indexed = 1, \
@@ -50,6 +51,7 @@ struct ads8344 {
5051
.differential = 1, \
5152
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
5253
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
54+
.address = addr, \
5355
}
5456

5557
static const struct iio_chan_spec ads8344_channels[] = {
@@ -105,7 +107,7 @@ static int ads8344_read_raw(struct iio_dev *iio,
105107
switch (mask) {
106108
case IIO_CHAN_INFO_RAW:
107109
mutex_lock(&adc->lock);
108-
*value = ads8344_adc_conversion(adc, channel->scan_index,
110+
*value = ads8344_adc_conversion(adc, channel->address,
109111
channel->differential);
110112
mutex_unlock(&adc->lock);
111113
if (*value < 0)

drivers/iio/chemical/atlas-sensor.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,19 @@ static const struct iio_chan_spec atlas_orp_channels[] = {
194194
};
195195

196196
static const struct iio_chan_spec atlas_do_channels[] = {
197-
ATLAS_CONCENTRATION_CHANNEL(0, ATLAS_REG_DO_DATA),
197+
{
198+
.type = IIO_CONCENTRATION,
199+
.address = ATLAS_REG_DO_DATA,
200+
.info_mask_separate =
201+
BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
202+
.scan_index = 0,
203+
.scan_type = {
204+
.sign = 'u',
205+
.realbits = 32,
206+
.storagebits = 32,
207+
.endianness = IIO_BE,
208+
},
209+
},
198210
IIO_CHAN_SOFT_TIMESTAMP(1),
199211
{
200212
.type = IIO_TEMP,

drivers/iio/dac/vf610_dac.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ static int vf610_dac_probe(struct platform_device *pdev)
223223
return 0;
224224

225225
error_iio_device_register:
226+
vf610_dac_exit(info);
226227
clk_disable_unprepare(info->clk);
227228

228229
return ret;

drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -544,8 +544,10 @@ st_lsm6dsx_shub_write_raw(struct iio_dev *iio_dev,
544544

545545
ref_sensor = iio_priv(hw->iio_devs[ST_LSM6DSX_ID_ACC]);
546546
odr = st_lsm6dsx_check_odr(ref_sensor, val, &odr_val);
547-
if (odr < 0)
548-
return odr;
547+
if (odr < 0) {
548+
err = odr;
549+
goto release;
550+
}
549551

550552
sensor->ext_info.slv_odr = val;
551553
sensor->odr = odr;
@@ -557,6 +559,7 @@ st_lsm6dsx_shub_write_raw(struct iio_dev *iio_dev,
557559
break;
558560
}
559561

562+
release:
560563
iio_device_release_direct_mode(iio_dev);
561564

562565
return err;

drivers/staging/iio/resolver/ad2s1210.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,17 +130,24 @@ static int ad2s1210_config_write(struct ad2s1210_state *st, u8 data)
130130
static int ad2s1210_config_read(struct ad2s1210_state *st,
131131
unsigned char address)
132132
{
133-
struct spi_transfer xfer = {
134-
.len = 2,
135-
.rx_buf = st->rx,
136-
.tx_buf = st->tx,
133+
struct spi_transfer xfers[] = {
134+
{
135+
.len = 1,
136+
.rx_buf = &st->rx[0],
137+
.tx_buf = &st->tx[0],
138+
.cs_change = 1,
139+
}, {
140+
.len = 1,
141+
.rx_buf = &st->rx[1],
142+
.tx_buf = &st->tx[1],
143+
},
137144
};
138145
int ret = 0;
139146

140147
ad2s1210_set_mode(MOD_CONFIG, st);
141148
st->tx[0] = address | AD2S1210_MSB_IS_HIGH;
142149
st->tx[1] = AD2S1210_REG_FAULT;
143-
ret = spi_sync_transfer(st->sdev, &xfer, 1);
150+
ret = spi_sync_transfer(st->sdev, xfers, 2);
144151
if (ret < 0)
145152
return ret;
146153

0 commit comments

Comments
 (0)