kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: greg@kroah.com (Greg KH)
To: kernelnewbies@lists.kernelnewbies.org
Subject: single, comprehensive kernel data types document?
Date: Thu, 21 Apr 2016 11:51:17 +0900	[thread overview]
Message-ID: <20160421025117.GA29694@kroah.com> (raw)
In-Reply-To: <1461184627.2053.6.camel@rtd-VirtualBox>

On Wed, Apr 20, 2016 at 04:37:07PM -0400, Rob Groner wrote:
> Sorry if this isn't related, it seemed like it was...
> 
> I recently discovered one of our drivers isn't written correctly for
> 64-bit.  It uses a uint32_t to hold an address. Whoops.
> 
> In previous drivers when I've needed to hold an address, I've used an
> "unsigned long", as (so far as I could tell) that would give me the
> correct number of bytes whether on 32 or 64-bit systems.
> 
> Now that I have to fix this driver, I'd rather do whatever the
> "standard" method is for storing an address value.
> 
> Looking at code in the kernel and linux/types.h, I see "phys_addr_t and
> dma_addr_t.  Is that what I want to use?  What if it's a virtual
> address?  void *?

You want to use '__u64' and cast properly within the kernel to a
pointer.

hope this helps,

greg k-h

  reply	other threads:[~2016-04-21  2:51 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-15 12:04 single, comprehensive kernel data types document? Robert P. J. Day
2016-04-15 12:27 ` Greg KH
2016-04-15 12:37   ` John Chludzinski
2016-04-15 13:08     ` Silvan Jegen
2016-04-15 13:09     ` Daniel.
2016-04-15 13:55       ` Greg KH
2016-04-15 16:28         ` Daniel.
2016-04-15 13:53     ` Greg KH
2016-04-15 15:59   ` Nicholas Mc Guire
2016-04-15 16:18     ` Greg KH
2016-04-15 17:07       ` Valdis.Kletnieks at vt.edu
2016-04-15 20:15         ` Greg KH
2016-04-20 20:37           ` Rob Groner
2016-04-21  2:51             ` Greg KH [this message]
2016-04-21 12:51               ` Rob Groner
2016-04-21 19:34                 ` Josh Cartwright
2016-04-22  2:37                 ` Greg KH
2016-04-22  3:02                   ` Valdis.Kletnieks at vt.edu
2016-04-22  3:13                     ` Greg KH

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=20160421025117.GA29694@kroah.com \
    --to=greg@kroah.com \
    --cc=kernelnewbies@lists.kernelnewbies.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;
as well as URLs for NNTP newsgroup(s).