From: Jonathan Cameron <jic23@kernel.org>
To: Fabrice Gasnier <fabrice.gasnier@st.com>
Cc: olivier.moysan@st.com, alexandre.torgue@st.com,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
mcoquelin.stm32@gmail.com,
linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] iio: adc: stm32-dfsdm: fix device used to request dma
Date: Sun, 3 May 2020 14:17:27 +0100 [thread overview]
Message-ID: <20200503141727.13269ac2@archlinux> (raw)
In-Reply-To: <1588238926-23964-2-git-send-email-fabrice.gasnier@st.com>
On Thu, 30 Apr 2020 11:28:46 +0200
Fabrice Gasnier <fabrice.gasnier@st.com> wrote:
> 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: eca949800d2d ("IIO: ADC: add stm32 DFSDM support for PDM microphone")
>
> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Both applied to the fixes-togreg branch of iio.git and marked for stable.
THanks,
Jonathan
> ---
> drivers/iio/adc/stm32-dfsdm-adc.c | 21 +++++++++++----------
> 1 file changed, 11 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/iio/adc/stm32-dfsdm-adc.c b/drivers/iio/adc/stm32-dfsdm-adc.c
> index 76a60d9..506bf51 100644
> --- a/drivers/iio/adc/stm32-dfsdm-adc.c
> +++ b/drivers/iio/adc/stm32-dfsdm-adc.c
> @@ -62,7 +62,7 @@ enum sd_converter_type {
>
> struct stm32_dfsdm_dev_data {
> int type;
> - int (*init)(struct iio_dev *indio_dev);
> + int (*init)(struct device *dev, struct iio_dev *indio_dev);
> unsigned int num_channels;
> const struct regmap_config *regmap_cfg;
> };
> @@ -1365,11 +1365,12 @@ static void stm32_dfsdm_dma_release(struct iio_dev *indio_dev)
> }
> }
>
> -static int stm32_dfsdm_dma_request(struct iio_dev *indio_dev)
> +static int stm32_dfsdm_dma_request(struct device *dev,
> + struct iio_dev *indio_dev)
> {
> struct stm32_dfsdm_adc *adc = iio_priv(indio_dev);
>
> - adc->dma_chan = dma_request_chan(&indio_dev->dev, "rx");
> + adc->dma_chan = dma_request_chan(dev, "rx");
> if (IS_ERR(adc->dma_chan)) {
> int ret = PTR_ERR(adc->dma_chan);
>
> @@ -1425,7 +1426,7 @@ static int stm32_dfsdm_adc_chan_init_one(struct iio_dev *indio_dev,
> &adc->dfsdm->ch_list[ch->channel]);
> }
>
> -static int stm32_dfsdm_audio_init(struct iio_dev *indio_dev)
> +static int stm32_dfsdm_audio_init(struct device *dev, struct iio_dev *indio_dev)
> {
> struct iio_chan_spec *ch;
> struct stm32_dfsdm_adc *adc = iio_priv(indio_dev);
> @@ -1452,10 +1453,10 @@ static int stm32_dfsdm_audio_init(struct iio_dev *indio_dev)
> indio_dev->num_channels = 1;
> indio_dev->channels = ch;
>
> - return stm32_dfsdm_dma_request(indio_dev);
> + return stm32_dfsdm_dma_request(dev, indio_dev);
> }
>
> -static int stm32_dfsdm_adc_init(struct iio_dev *indio_dev)
> +static int stm32_dfsdm_adc_init(struct device *dev, struct iio_dev *indio_dev)
> {
> struct iio_chan_spec *ch;
> struct stm32_dfsdm_adc *adc = iio_priv(indio_dev);
> @@ -1499,17 +1500,17 @@ static int stm32_dfsdm_adc_init(struct iio_dev *indio_dev)
> init_completion(&adc->completion);
>
> /* Optionally request DMA */
> - ret = stm32_dfsdm_dma_request(indio_dev);
> + ret = stm32_dfsdm_dma_request(dev, indio_dev);
> if (ret) {
> 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;
> }
>
> - dev_dbg(&indio_dev->dev, "No DMA support\n");
> + dev_dbg(dev, "No DMA support\n");
> return 0;
> }
>
> @@ -1622,7 +1623,7 @@ static int stm32_dfsdm_adc_probe(struct platform_device *pdev)
> adc->dfsdm->fl_list[adc->fl_id].sync_mode = val;
>
> adc->dev_data = dev_data;
> - ret = dev_data->init(iio);
> + ret = dev_data->init(dev, iio);
> if (ret < 0)
> return ret;
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2020-05-03 13:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-30 9:28 [PATCH] iio: adc: stm32-adc: fix device used to request dma Fabrice Gasnier
2020-04-30 9:28 ` [PATCH] iio: adc: stm32-dfsdm: " Fabrice Gasnier
2020-05-03 13:17 ` Jonathan Cameron [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200503141727.13269ac2@archlinux \
--to=jic23@kernel.org \
--cc=alexandre.torgue@st.com \
--cc=fabrice.gasnier@st.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=olivier.moysan@st.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).