All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Moritz Fischer <mdf@kernel.org>
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	keescook@chromium.org, davem@davemloft.net,
	moritz.fischer@ettus.com, f.fainelli@gmail.com,
	alex.williams@ni.com
Subject: Re: [PATCH] net: nixge: Address compiler warnings when building for i386
Date: Tue, 25 Sep 2018 02:00:35 +0200	[thread overview]
Message-ID: <20180925000035.GA24003@lunn.ch> (raw)
In-Reply-To: <20180924212712.1790-1-mdf@kernel.org>

On Mon, Sep 24, 2018 at 02:27:12PM -0700, Moritz Fischer wrote:
> Address compiler warnings reported by kbuild autobuilders
> when building for i386 as a result of dma_addr_t size on
> different architectures.
> 
> warning: cast to pointer from integer of different size
> 	[-Wint-to-pointer-cast]
> 
> Signed-off-by: Moritz Fischer <mdf@kernel.org>
> ---
>  drivers/net/ethernet/ni/nixge.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/ethernet/ni/nixge.c b/drivers/net/ethernet/ni/nixge.c
> index 74cf52e3fb09..0611f2335b4a 100644
> --- a/drivers/net/ethernet/ni/nixge.c
> +++ b/drivers/net/ethernet/ni/nixge.c
> @@ -127,8 +127,8 @@ struct nixge_hw_dma_bd {
>  #ifdef CONFIG_PHYS_ADDR_T_64BIT
>  #define nixge_hw_dma_bd_set_addr(bd, field, addr) \
>  	do { \
> -		(bd)->field##_lo = lower_32_bits(((u64)addr)); \
> -		(bd)->field##_hi = upper_32_bits(((u64)addr)); \
> +		(bd)->field##_lo = lower_32_bits((addr)); \
> +		(bd)->field##_hi = upper_32_bits((addr)); \
>  	} while (0)

Hi Maritz

Maybe turn this into an function. It is small enough it will get
inlined.  You then gain type checking. Make addr a void *.

>  #else
>  #define nixge_hw_dma_bd_set_addr(bd, field, addr) \
> @@ -251,7 +251,7 @@ static void nixge_hw_dma_bd_release(struct net_device *ndev)
>  				 NIXGE_MAX_JUMBO_FRAME_SIZE,
>  				 DMA_FROM_DEVICE);
>  
> -		skb = (struct sk_buff *)
> +		skb = (struct sk_buff *)(uintptr_t)
>  			nixge_hw_dma_bd_get_addr(&priv->rx_bd_v[i],
>  						 sw_id_offset);

How about making nixge_hw_dma_bd_get_addr return a void *. You can
assign that to anything without needing a cast.

       Andrew

      reply	other threads:[~2018-09-25  0:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-24 21:27 [PATCH] net: nixge: Address compiler warnings when building for i386 Moritz Fischer
2018-09-25  0:00 ` Andrew Lunn [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=20180925000035.GA24003@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=alex.williams@ni.com \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mdf@kernel.org \
    --cc=moritz.fischer@ettus.com \
    --cc=netdev@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.