From: rgroner@rtd.com (Rob Groner)
To: kernelnewbies@lists.kernelnewbies.org
Subject: single, comprehensive kernel data types document?
Date: Thu, 21 Apr 2016 08:51:04 -0400 [thread overview]
Message-ID: <1461243064.2108.2.camel@rtd-VirtualBox> (raw)
In-Reply-To: <20160421025117.GA29694@kroah.com>
On Thu, 2016-04-21 at 11:51 +0900, Greg KH wrote:
> 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
Thank you Greg.
I was thinking there was a type that would hold a memory address (like
an allocated DMA buffer address, or a PCI address) that would be the
correct size on a 32-bit or 64-bit system without me having to specify a
size. If I use __u64 to hold a memory address, won't that be the wrong
size on a 32-bit system?
Rob
next prev parent reply other threads:[~2016-04-21 12: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
2016-04-21 12:51 ` Rob Groner [this message]
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=1461243064.2108.2.camel@rtd-VirtualBox \
--to=rgroner@rtd.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 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.