lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190324164506.595f35e3@archlinux>
Date:   Sun, 24 Mar 2019 16:45:06 +0000
From:   Jonathan Cameron <jic23@...nel.org>
To:     Fabrice Gasnier <fabrice.gasnier@...com>
Cc:     <linux-arm-kernel@...ts.infradead.org>,
        <linux-kernel@...r.kernel.org>, <mcoquelin.stm32@...il.com>,
        <alexandre.torgue@...com>, <linux-iio@...r.kernel.org>,
        <lars@...afoo.de>, <knaack.h@....de>, <pmeerw@...erw.net>,
        <linux-stm32@...md-mailman.stormreply.com>,
        <arnaud.pouliquen@...com>, <olivier.moysan@...com>
Subject: Re: [PATCH v2 4/8] iio: adc: stm32-dfsdm: move dma slave config to
 start routine

On Thu, 21 Mar 2019 17:47:25 +0100
Fabrice Gasnier <fabrice.gasnier@...com> wrote:

> Move DMA slave configuration to start routine: depending on regular or
> injected mode is in use, DMA needs to read resp. RDATAR or JDATAR.
> This is precursor patch to introduce injected mode (used for scan).
> 
> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@...com>

Applied, thanks,

Jonathan
> ---
>  drivers/iio/adc/stm32-dfsdm-adc.c | 31 +++++++++++--------------------
>  1 file changed, 11 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/iio/adc/stm32-dfsdm-adc.c b/drivers/iio/adc/stm32-dfsdm-adc.c
> index 818627f..66e2ea0 100644
> --- a/drivers/iio/adc/stm32-dfsdm-adc.c
> +++ b/drivers/iio/adc/stm32-dfsdm-adc.c
> @@ -556,6 +556,11 @@ static void stm32_dfsdm_audio_dma_buffer_done(void *data)
>  static int stm32_dfsdm_adc_dma_start(struct iio_dev *indio_dev)
>  {
>  	struct stm32_dfsdm_adc *adc = iio_priv(indio_dev);
> +	struct dma_slave_config config = {
> +		.src_addr = (dma_addr_t)adc->dfsdm->phys_base +
> +			DFSDM_RDATAR(adc->fl_id),
> +		.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES,
> +	};
>  	struct dma_async_tx_descriptor *desc;
>  	dma_cookie_t cookie;
>  	int ret;
> @@ -566,6 +571,10 @@ static int stm32_dfsdm_adc_dma_start(struct iio_dev *indio_dev)
>  	dev_dbg(&indio_dev->dev, "%s size=%d watermark=%d\n", __func__,
>  		adc->buf_sz, adc->buf_sz / 2);
>  
> +	ret = dmaengine_slave_config(adc->dma_chan, &config);
> +	if (ret)
> +		return ret;
> +
>  	/* Prepare a DMA cyclic transaction */
>  	desc = dmaengine_prep_dma_cyclic(adc->dma_chan,
>  					 adc->dma_buf,
> @@ -925,12 +934,6 @@ static void stm32_dfsdm_dma_release(struct iio_dev *indio_dev)
>  static int stm32_dfsdm_dma_request(struct iio_dev *indio_dev)
>  {
>  	struct stm32_dfsdm_adc *adc = iio_priv(indio_dev);
> -	struct dma_slave_config config = {
> -		.src_addr = (dma_addr_t)adc->dfsdm->phys_base +
> -			DFSDM_RDATAR(adc->fl_id),
> -		.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES,
> -	};
> -	int ret;
>  
>  	adc->dma_chan = dma_request_slave_channel(&indio_dev->dev, "rx");
>  	if (!adc->dma_chan)
> @@ -940,23 +943,11 @@ static int stm32_dfsdm_dma_request(struct iio_dev *indio_dev)
>  					 DFSDM_DMA_BUFFER_SIZE,
>  					 &adc->dma_buf, GFP_KERNEL);
>  	if (!adc->rx_buf) {
> -		ret = -ENOMEM;
> -		goto err_release;
> +		dma_release_channel(adc->dma_chan);
> +		return -ENOMEM;
>  	}
>  
> -	ret = dmaengine_slave_config(adc->dma_chan, &config);
> -	if (ret)
> -		goto err_free;
> -
>  	return 0;
> -
> -err_free:
> -	dma_free_coherent(adc->dma_chan->device->dev, DFSDM_DMA_BUFFER_SIZE,
> -			  adc->rx_buf, adc->dma_buf);
> -err_release:
> -	dma_release_channel(adc->dma_chan);
> -
> -	return ret;
>  }
>  
>  static int stm32_dfsdm_adc_chan_init_one(struct iio_dev *indio_dev,

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ