LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Olof Johansson <olof@lixom.net>
To: Zhang Wei <wei.zhang@freescale.com>
Cc: dan.j.williams@intel.com, sfr@canb.auug.org.au,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Fix fsldma.c warning messages when it's compiled under PPC64.
Date: Tue, 11 Mar 2008 09:22:47 -0500	[thread overview]
Message-ID: <20080311142247.GA18915@lixom.net> (raw)
In-Reply-To: <1205146045-17342-1-git-send-email-wei.zhang@freescale.com>

On Mon, Mar 10, 2008 at 06:47:25PM +0800, Zhang Wei wrote:
> There are warning messages reported by Stephen Rothwell with
> ARCH=powerpc allmodconfig build:
> 
> drivers/dma/fsldma.c: In function 'fsl_dma_prep_memcpy':
> drivers/dma/fsldma.c:439: warning: comparison of distinct pointer types
> lacks a cast
> drivers/dma/fsldma.c: In function 'fsl_chan_xfer_ld_queue':
> drivers/dma/fsldma.c:584: warning: format '%016llx' expects type 'long long
> unsigned int', but argument 4 has type 'dma_addr_t'
> drivers/dma/fsldma.c: In function 'fsl_dma_chan_do_interrupt':
> drivers/dma/fsldma.c:668: warning: format '%x' expects type 'unsigned int',
> but argument 5 has type 'dma_addr_t'
> drivers/dma/fsldma.c:684: warning: format '%016llx' expects type 'long long
> unsigned int', but argument 4 has type 'dma_addr_t'
> drivers/dma/fsldma.c:684: warning: format '%016llx' expects type 'long long
> unsigned int', but argument 5 has type 'dma_addr_t'
> drivers/dma/fsldma.c:701: warning: format '%02x' expects type 'unsigned
> int', but argument 4 has type 'dma_addr_t'
> drivers/dma/fsldma.c: In function 'fsl_dma_self_test':
> drivers/dma/fsldma.c:840: warning: format '%d' expects type 'int', but
> argument 5 has type 'size_t'
> drivers/dma/fsldma.c: In function 'of_fsl_dma_probe':
> drivers/dma/fsldma.c:1010: warning: format '%08x' expects type 'unsigned
> int', but argument 5 has type 'resource_size_t'
> 
> This patch fixed the above warning messages.
> 
> Signed-off-by: Zhang Wei <wei.zhang@freescale.com>
> ---
>  drivers/dma/fsldma.c |   29 ++++++++++++++++-------------
>  1 files changed, 16 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c
> index cc9a681..5dfedf3 100644
> --- a/drivers/dma/fsldma.c
> +++ b/drivers/dma/fsldma.c
> @@ -57,12 +57,12 @@ static void dma_init(struct fsl_dma_chan *fsl_chan)
>  
>  }
>  
> -static void set_sr(struct fsl_dma_chan *fsl_chan, dma_addr_t val)
> +static void set_sr(struct fsl_dma_chan *fsl_chan, u32 val)

Why? dma_addr_t is the right type to use here.

>  {
>  	DMA_OUT(fsl_chan, &fsl_chan->reg_base->sr, val, 32);
>  }
>  
> -static dma_addr_t get_sr(struct fsl_dma_chan *fsl_chan)
> +static u32 get_sr(struct fsl_dma_chan *fsl_chan)
>  {
>  	return DMA_IN(fsl_chan, &fsl_chan->reg_base->sr, 32);
>  }
> @@ -436,7 +436,7 @@ static struct dma_async_tx_descriptor *fsl_dma_prep_memcpy(
>  		dev_dbg(fsl_chan->dev, "new link desc alloc %p\n", new);
>  #endif
>  
> -		copy = min(len, FSL_DMA_BCR_MAX_CNT);
> +		copy = min(len, (size_t)FSL_DMA_BCR_MAX_CNT);
>  
>  		set_desc_cnt(fsl_chan, &new->hw, copy);
>  		set_desc_src(fsl_chan, &new->hw, dma_src);
> @@ -581,8 +581,8 @@ static void fsl_chan_xfer_ld_queue(struct fsl_dma_chan *fsl_chan)
>  	if (ld_node != &fsl_chan->ld_queue) {
>  		/* Get the ld start address from ld_queue */
>  		next_dest_addr = to_fsl_desc(ld_node)->async_tx.phys;
> -		dev_dbg(fsl_chan->dev, "xfer LDs staring from 0x%016llx\n",
> -				(u64)next_dest_addr);
> +		dev_dbg(fsl_chan->dev, "xfer LDs staring from %p\n",
> +				(void *)next_dest_addr);

If anything you should cast to unsigned long and print as %lx.
next_dest_addr is not a pointer, it's a bus/dma address.

Same for all the other changes in this file (dma_addr_t -> u32 doesn't
seem right, same for the %llx -> %p changes).


-Olof

  parent reply	other threads:[~2008-03-11 14:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-10 10:47 Zhang Wei
2008-03-10 19:09 ` Dan Williams
2008-03-11 14:22 ` Olof Johansson [this message]
2008-03-12  2:10   ` [PATCH] Fix fsldma.c warning messages when it's compiled underPPC64 Zhang Wei
2008-03-12 16:29     ` Dan Williams
2008-03-13  6:52       ` Zhang Wei
2008-03-18 18:23         ` Scott Wood
2008-03-19  1:52           ` Zhang Wei

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=20080311142247.GA18915@lixom.net \
    --to=olof@lixom.net \
    --cc=dan.j.williams@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sfr@canb.auug.org.au \
    --cc=wei.zhang@freescale.com \
    --subject='Re: [PATCH] Fix fsldma.c warning messages when it'\''s compiled under PPC64.' \
    /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

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).