public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mark Einon <mark.einon@gmail.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Jeffrey Ladouceur <jladouceur@gmail.com>
Cc: devel@driverdev.osuosl.org, gregkh@linuxfoundation.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] staging: et131x: Fix 64bit tx dma address handling
Date: Thu, 18 Oct 2012 11:17:52 +0100	[thread overview]
Message-ID: <20121018101741.GA4503@mark-lap> (raw)
In-Reply-To: <20121018105956.2f3ea239@pyramind.ukuu.org.uk>

On Thu, Oct 18, 2012 at 10:59:56AM +0100, Alan Cox wrote:
> > > +                                                         skb_headlen(skb),
> > > +                                                         DMA_TO_DEVICE);
> > > +                               desc[frag].addr_lo = dma_addr & 0xFFFFFFFF;
> > > +                               desc[frag].addr_hi = dma_addr >> 32;
> > 
> > Maybe use macros defined in kernel.h instead:
> > 
> > desc[frag].addr_lo = lower_32_bits(dma_addr);
> > desc[frag].addr_hi = upper_32_bits(dma_addr);
> > 
> > A few more instances below.
> 
> This is actually important because >> 32 of a 32bit value is undefined in
> C. The compiler is free to do what it likes with this. While the results
> are usually sane some architectures do generate the equivalent of
> 
> 		x >> (n % wordsize);
> 
> Alan

Thanks for the comments both. I'll send an updated patch this evening.

The intention is to eventually store this value as a dma_addr_t anyway,
but some more work needs to be done to copy the address correctly to the
desc ring.

Cheers,

Mark

  reply	other threads:[~2012-10-18 10:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-17 21:15 [PATCH 1/2] staging: et131x: Use skb_headlen() where appropriate Mark Einon
2012-10-17 21:15 ` [PATCH 2/2] staging: et131x: Fix 64bit tx dma address handling Mark Einon
2012-10-18  0:31   ` Jeffrey Ladouceur
2012-10-18  9:59     ` Alan Cox
2012-10-18 10:17       ` Mark Einon [this message]
2012-10-18 20:34   ` [PATCH 2/2 v2] " Mark Einon

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=20121018101741.GA4503@mark-lap \
    --to=mark.einon@gmail.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jladouceur@gmail.com \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox