public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.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 16:43:25 -0400	[thread overview]
Message-ID: <20160425204325.GA29322@bill-the-cat> (raw)
In-Reply-To: <571E80B9.6030409@denx.de>

On Mon, Apr 25, 2016 at 10:40:25PM +0200, Marek Vasut wrote:
> On 04/25/2016 10:32 PM, Joe Hershberger wrote:
> > On Mon, Apr 25, 2016 at 3:17 PM, Beniamino Galvani <b.galvani@gmail.com> wrote:
> >> 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.
> > 
> > That's the part that surprises me. I thought arithmetic assignments
> > from larger to smaller types would warn.
> > 
> > Anyway, if it's warning clean,
> 
> I am still not a big fan of picking the right type just to silence all
> possible warnings. I am worried this will bite us in the future.

When that future comes we'll have lots of things to fixup and convert to
a better solution.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160425/cf445418/attachment.sig>

  reply	other threads:[~2016-04-25 20:43 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
2016-04-25 20:32       ` Joe Hershberger
2016-04-25 20:40         ` Marek Vasut
2016-04-25 20:43           ` Tom Rini [this message]
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=20160425204325.GA29322@bill-the-cat \
    --to=trini@konsulko.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