public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: vkoul@kernel.org (Vinod)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v1 2/4] dmaengine: imx-sdma: add check_bd_buswidth() to kill the dulicated code
Date: Tue, 10 Jul 2018 21:01:04 +0530	[thread overview]
Message-ID: <20180710153104.GF3219@vkoul-mobl> (raw)
In-Reply-To: <1531239793-11781-3-git-send-email-yibin.gong@nxp.com>

On 11-07-18, 00:23, Robin Gong wrote:
> Add check_bd_buswidth() to minimize the code size.

this looks mostly fine and I think this should be first patch..

> 
> Signed-off-by: Robin Gong <yibin.gong@nxp.com>
> ---
>  drivers/dma/imx-sdma.c | 64 +++++++++++++++++++++++---------------------------
>  1 file changed, 29 insertions(+), 35 deletions(-)
> 
> diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
> index 27ccabf..ed2267d 100644
> --- a/drivers/dma/imx-sdma.c
> +++ b/drivers/dma/imx-sdma.c
> @@ -1326,6 +1326,33 @@ static struct sdma_desc *sdma_transfer_init(struct sdma_channel *sdmac,
>  	return NULL;
>  }
>  
> +static int check_bd_buswidth(struct sdma_buffer_descriptor *bd,
> +			     struct sdma_channel *sdmac, int count,
> +			     dma_addr_t dma_dst, dma_addr_t dma_src)
> +{
> +	int ret = 0;
> +
> +	switch (sdmac->word_size) {
> +	case DMA_SLAVE_BUSWIDTH_4_BYTES:
> +		bd->mode.command = 0;
> +		if ((count | dma_dst | dma_src) & 3)
> +			ret = -EINVAL;
> +		break;

empty line after each break please

> +	case DMA_SLAVE_BUSWIDTH_2_BYTES:
> +		bd->mode.command = 2;
> +		if ((count | dma_dst | dma_src) & 1)
> +			ret = -EINVAL;
> +		break;
> +	case DMA_SLAVE_BUSWIDTH_1_BYTE:
> +		 bd->mode.command = 1;
> +		break;
> +	default:
> +		return -EINVAL;
> +	}
> +
> +	return ret;
> +}
> +
-- 
~Vinod

  reply	other threads:[~2018-07-10 15:31 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-10 16:23 [PATCH v1 0/4] add memcpy support for sdma Robin Gong
2018-07-10 16:23 ` [PATCH v1 1/4] dmaengine: imx-sdma: add memcpy interface Robin Gong
2018-07-10 15:29   ` Vinod
2018-07-11  5:34     ` Robin Gong
2018-07-11  7:12       ` Vinod
2018-07-11  6:24   ` Sascha Hauer
2018-07-11  6:56     ` Robin Gong
2018-07-11  7:01       ` Sascha Hauer
2018-07-11  7:05         ` Robin Gong
2018-07-11  7:08           ` Sascha Hauer
2018-07-10 16:23 ` [PATCH v1 2/4] dmaengine: imx-sdma: add check_bd_buswidth() to kill the dulicated code Robin Gong
2018-07-10 15:31   ` Vinod [this message]
2018-07-11  5:36     ` Robin Gong
2018-07-11  6:32   ` Sascha Hauer
2018-07-10 16:23 ` [PATCH v1 3/4] dmaengine: imx-sdma: support dmatest Robin Gong
2018-07-10 15:33   ` Vinod
2018-07-11  6:37     ` Robin Gong
2018-07-11  6:53       ` s.hauer at pengutronix.de
2018-07-11  7:14         ` Robin Gong
2018-07-11  7:19         ` Vinod
2018-07-11  8:16           ` Robin Gong
2018-07-11  8:58             ` Vinod
2018-07-10 16:23 ` [PATCH v1 4/4] ARM: configs: imx_v6_v7_defconfig: add DMATEST support Robin Gong

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=20180710153104.GF3219@vkoul-mobl \
    --to=vkoul@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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