public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Beniamino Galvani <b.galvani@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v5 2/4] net: designware: fix descriptor layout and warnings on 64-bit archs
Date: Mon, 25 Apr 2016 22:17:29 +0200	[thread overview]
Message-ID: <20160425201729.GA9337@gmail.com> (raw)
In-Reply-To: <CANr=Z=ZHOQM1ChRAeeTiSJ0E+43DPghh1qO0HTn7tpe4Lh-DDg@mail.gmail.com>

On Mon, Apr 25, 2016 at 01:01:10PM -0500, Joe Hershberger wrote:
> > -               desc_p->dmamac_addr = &txbuffs[idx * CONFIG_ETH_BUFSIZE];
> > -               desc_p->dmamac_next = &desc_table_p[idx + 1];
> > +               desc_p->dmamac_addr = (ulong)&txbuffs[idx * CONFIG_ETH_BUFSIZE];
> > +               desc_p->dmamac_next = (ulong)&desc_table_p[idx + 1];
> 
> Why are you not casting to the type of the struct member (u32)? Won't
> this emit warnings on 64-bit?

Hi,

casting to u32 would cause a warning on arm64 ("warning: cast from
pointer to integer of different size [-Wpointer-to-int-cast]") because
the pointer is 64bit.

The (ulong) cast is needed to convert the pointer to an arithmetic
type of same width, which then can be assigned to the struct
member. The assignment operator implicitly converts between different
arithmetic types without the need for explicit casts.

Beniamino

  reply	other threads:[~2016-04-25 20:17 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-24  6:49 [U-Boot] [PATCH v5 0/4] Amlogic Meson GXBaby and ODROID-C2 support Beniamino Galvani
2016-04-24  6:49 ` [U-Boot] [PATCH v5 1/4] arm: implement generic PSCI reset call for armv8 Beniamino Galvani
2016-04-24  6:50 ` [U-Boot] [PATCH v5 2/4] net: designware: fix descriptor layout and warnings on 64-bit archs Beniamino Galvani
2016-04-25 18:01   ` Joe Hershberger
2016-04-25 20:17     ` Beniamino Galvani [this message]
2016-04-25 20:32       ` Joe Hershberger
2016-04-25 20:40         ` Marek Vasut
2016-04-25 20:43           ` Tom Rini
2016-04-24  6:50 ` [U-Boot] [PATCH v5 3/4] arm: add initial support for Amlogic Meson and ODROID-C2 Beniamino Galvani
2016-04-25 20:53   ` Tom Rini
2016-04-27 10:58     ` Beniamino Galvani
2016-05-01 18:56   ` Simon Glass
2016-05-01 18:58     ` Tom Rini
2016-05-08  6:35     ` Beniamino Galvani
2016-04-24  6:50 ` [U-Boot] [PATCH v5 4/4] arm: meson: implement calls to secure monitor Beniamino Galvani

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=20160425201729.GA9337@gmail.com \
    --to=b.galvani@gmail.com \
    --cc=u-boot@lists.denx.de \
    /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