]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 4.14
authorSasha Levin <sashal@kernel.org>
Mon, 25 May 2020 20:56:03 +0000 (16:56 -0400)
committerSasha Levin <sashal@kernel.org>
Mon, 25 May 2020 20:56:03 +0000 (16:56 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-4.14/iio-adc-stm32-adc-fix-device-used-to-request-dma.patch [new file with mode: 0644]
queue-4.14/iio-adc-stm32-adc-use-dma_request_chan-instead-dma_r.patch [new file with mode: 0644]
queue-4.14/series

diff --git a/queue-4.14/iio-adc-stm32-adc-fix-device-used-to-request-dma.patch b/queue-4.14/iio-adc-stm32-adc-fix-device-used-to-request-dma.patch
new file mode 100644 (file)
index 0000000..df949a9
--- /dev/null
@@ -0,0 +1,68 @@
+From 9330cba839c6349b5949f05c7be64a9db6077072 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 30 Apr 2020 11:28:45 +0200
+Subject: iio: adc: stm32-adc: fix device used to request dma
+
+From: Fabrice Gasnier <fabrice.gasnier@st.com>
+
+[ Upstream commit 52cd91c27f3908b88e8b25aed4a4d20660abcc45 ]
+
+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 71723a96b8b1 ("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: 2763ea0585c99 ("iio: adc: stm32: add optional dma support")
+
+Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
+Cc: <Stable@vger.kernel.org>
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/iio/adc/stm32-adc.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c
+index 9a243f06389d..206feefbc456 100644
+--- a/drivers/iio/adc/stm32-adc.c
++++ b/drivers/iio/adc/stm32-adc.c
+@@ -1627,18 +1627,18 @@ static int stm32_adc_chan_of_init(struct iio_dev *indio_dev)
+       return 0;
+ }
+-static int stm32_adc_dma_request(struct iio_dev *indio_dev)
++static int stm32_adc_dma_request(struct device *dev, struct iio_dev *indio_dev)
+ {
+       struct stm32_adc *adc = iio_priv(indio_dev);
+       struct dma_slave_config config;
+       int ret;
+-      adc->dma_chan = dma_request_chan(&indio_dev->dev, "rx");
++      adc->dma_chan = dma_request_chan(dev, "rx");
+       if (IS_ERR(adc->dma_chan)) {
+               ret = PTR_ERR(adc->dma_chan);
+               if (ret != -ENODEV) {
+                       if (ret != -EPROBE_DEFER)
+-                              dev_err(&indio_dev->dev,
++                              dev_err(dev,
+                                       "DMA channel request failed with %d\n",
+                                       ret);
+                       return ret;
+@@ -1761,7 +1761,7 @@ static int stm32_adc_probe(struct platform_device *pdev)
+       if (ret < 0)
+               goto err_clk_disable;
+-      ret = stm32_adc_dma_request(indio_dev);
++      ret = stm32_adc_dma_request(dev, indio_dev);
+       if (ret < 0)
+               goto err_clk_disable;
+-- 
+2.25.1
+
diff --git a/queue-4.14/iio-adc-stm32-adc-use-dma_request_chan-instead-dma_r.patch b/queue-4.14/iio-adc-stm32-adc-use-dma_request_chan-instead-dma_r.patch
new file mode 100644 (file)
index 0000000..80a2035
--- /dev/null
@@ -0,0 +1,55 @@
+From 02d4bb0e3621911ce0a6e0d62b55c44db159c0b1 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 8 Jan 2020 10:08:01 +0200
+Subject: iio: adc: stm32-adc: Use dma_request_chan() instead
+ dma_request_slave_channel()
+
+From: Peter Ujfalusi <peter.ujfalusi@ti.com>
+
+[ Upstream commit 735404b846dffcb320264f62b76e6f70012214dd ]
+
+dma_request_slave_channel() is a wrapper on top of dma_request_chan()
+eating up the error code.
+
+By using dma_request_chan() directly the driver can support deferred
+probing against DMA.
+
+Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
+Acked-by: Fabrice Gasnier <fabrice.gasnier@st.com>
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/iio/adc/stm32-adc.c | 16 ++++++++++++++--
+ 1 file changed, 14 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c
+index 3cfb2d4b2441..9a243f06389d 100644
+--- a/drivers/iio/adc/stm32-adc.c
++++ b/drivers/iio/adc/stm32-adc.c
+@@ -1633,9 +1633,21 @@ static int stm32_adc_dma_request(struct iio_dev *indio_dev)
+       struct dma_slave_config config;
+       int ret;
+-      adc->dma_chan = dma_request_slave_channel(&indio_dev->dev, "rx");
+-      if (!adc->dma_chan)
++      adc->dma_chan = dma_request_chan(&indio_dev->dev, "rx");
++      if (IS_ERR(adc->dma_chan)) {
++              ret = PTR_ERR(adc->dma_chan);
++              if (ret != -ENODEV) {
++                      if (ret != -EPROBE_DEFER)
++                              dev_err(&indio_dev->dev,
++                                      "DMA channel request failed with %d\n",
++                                      ret);
++                      return ret;
++              }
++
++              /* DMA is optional: fall back to IRQ mode */
++              adc->dma_chan = NULL;
+               return 0;
++      }
+       adc->rx_buf = dma_alloc_coherent(adc->dma_chan->device->dev,
+                                        STM32_DMA_BUFFER_SIZE,
+-- 
+2.25.1
+
index cede6c1680bc3617bf3d787c65aa39005a1a6293..10147603198ce516b8104b30914ebe339f4f584b 100644 (file)
@@ -56,3 +56,5 @@ mei-release-me_cl-object-reference.patch
 rapidio-fix-an-error-in-get_user_pages_fast-error-handling.patch
 rxrpc-fix-a-memory-leak-in-rxkad_verify_response.patch
 x86-unwind-orc-fix-unwind_get_return_address_ptr-for-inactive-tasks.patch
+iio-adc-stm32-adc-use-dma_request_chan-instead-dma_r.patch
+iio-adc-stm32-adc-fix-device-used-to-request-dma.patch