devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Rameshwar Prasad Sahu <rsahu@apm.com>
Cc: vinod.koul@intel.com, dan.j.williams@intel.com,
	dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	jcm@redhat.com, patches@apm.com
Subject: Re: [PATCH v2] dmaengine: xgene-dma: Fix sparse wannings and coccinelle warnings
Date: Thu, 16 Apr 2015 17:33:21 +0200	[thread overview]
Message-ID: <2380730.12OTUPVkl5@wuerfel> (raw)
In-Reply-To: <1429197631-15070-1-git-send-email-rsahu@apm.com>

On Thursday 16 April 2015 20:50:30 Rameshwar Prasad Sahu wrote:
> v2 changes:
> 	* Code cleanup
> 	* Changed way of setting DMA descriptors for big-endian
> 
> This patch fixes compilation sparse warnings like incorrect type in assignment
> (different base types), cast to restricted __le64, symbol
> '__UNIQUE_ID_author__COUNTER__' has multiple initializers etc and
> coccinelle warnings (No need to set .owner here. The core will do it.)
> 
> This patch is based on slave-dma / for-linus branch.
> (commit: 9f2fd0dfa594d857fbdaeda523ff7a46f16567f5 [26/28]
> 	dmaengine: Add support for APM X-Gene SoC DMA engine driver)
> 
> Reported-by: kbuild test robot <fengguang.wu@intel.com>
> Signed-off-by: Rameshwar Prasad Sahu <rsahu@apm.com>

Much better!

> -static void xgene_dma_set_src_buffer(void *ext8, size_t *len,
> +static void xgene_dma_set_src_buffer(__le64 *ext8, size_t *len,
>  				     dma_addr_t *paddr)
>  {
>  	size_t nbytes = (*len < XGENE_DMA_MAX_BYTE_CNT) ?
>  			*len : XGENE_DMA_MAX_BYTE_CNT;
> 
> -	XGENE_DMA_DESC_BUFADDR_SET(ext8, *paddr);
> -	XGENE_DMA_DESC_BUFLEN_SET(ext8, xgene_dma_encode_len(nbytes));
> +	*ext8 |= cpu_to_le64(*paddr);
> +	*ext8 |= cpu_to_le64((u64)xgene_dma_encode_len(nbytes) <<
> +			     XGENE_DMA_DESC_BUFLEN_POS);
>  	*len -= nbytes;
>  	*paddr += nbytes;
>  }

Just as a minor enhancement you could change xgene_dma_encode_len()
to already return a u64 type with the shift applied.

> -static void xgene_dma_invalidate_buffer(void *ext8)
> +static void xgene_dma_invalidate_buffer(__le64 *ext8)
>  {
> -	XGENE_DMA_DESC_BUFLEN_SET(ext8, XGENE_DMA_INVALID_LEN_CODE);
> +	*ext8 |= cpu_to_le64((u64)XGENE_DMA_INVALID_LEN_CODE <<
> +			     XGENE_DMA_DESC_BUFLEN_POS);
>  }

Same here, if you define XGENE_DMA_INVALID_LEN_CODE as

#define XGENE_DMA_INVALID_LEN_CODE	0x7800000000000000ul

it directly matches what one would find in the data sheet, and
also simplifies this function.

	Arnd

      reply	other threads:[~2015-04-16 15:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-16 15:20 [PATCH v2] dmaengine: xgene-dma: Fix sparse wannings and coccinelle warnings Rameshwar Prasad Sahu
2015-04-16 15:33 ` Arnd Bergmann [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=2380730.12OTUPVkl5@wuerfel \
    --to=arnd@arndb.de \
    --cc=dan.j.williams@intel.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=jcm@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@apm.com \
    --cc=rsahu@apm.com \
    --cc=vinod.koul@intel.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).