Skip to content

Commit 52cd91c

Browse files
Fabrice Gasnierjic23
authored andcommitted
iio: adc: stm32-adc: fix device used to request dma
DMA channel request should use device struct from platform device struct. Currently it's using iio device struct. But at this stage when probing, device struct isn't yet registered (e.g. device_register is done in iio_device_register). Since commit 71723a9 ("dmaengine: Create symlinks between DMA channels and slaves"), a warning message is printed as the links in sysfs can't be created, due to device isn't yet registered: - Cannot create DMA slave symlink - Cannot create DMA dma:rx symlink Fix this by using device struct from platform device to request dma chan. Fixes: 2763ea0 ("iio: adc: stm32: add optional dma support") Signed-off-by: Fabrice Gasnier <[email protected]> Cc: <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
1 parent bcfa1e2 commit 52cd91c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

0 commit comments

Comments
 (0)