From: dwmw2@infradead.org (David Woodhouse)
To: linux-arm-kernel@lists.infradead.org
Subject: Use of data types in new portings
Date: Fri, 22 Jan 2010 09:19:23 +1300 [thread overview]
Message-ID: <1264105163.23727.790.camel@macbook.infradead.org> (raw)
In-Reply-To: <2703439e1001170502x5faa39fbm57cbedf7403b41c9@mail.gmail.com>
On Sun, 2010-01-17 at 22:02 +0900, Khushhua Mogambo wrote:
> I starting to port Linux kernel to my companies new ARM based
> SoC and development board.
>
> Some of the regs is 16bits wide and some is 32bits width. I ask if
> my using u16 and u32 in place of 'unsigned short' and 'unsigned int'
> in the whole porting would be acceptable or not?
>
> In different wording, using only u16 and u32 always is considered good
> quality or bad?
Personally, I always prefer to avoid the the 'u16' and 'u32' nonsense
types in favour of the proper C types 'uint16_t' and 'uint32_t'.
There is a small amount of justification for the __u16 and __u32
variants, in headers which are exposed to userspace.... but only if you
believe that you really _have_ to avoid exposing the proper C types to
the users because everything will break if you include <stdint.h> for
them. Which is not really true.
If you have types which are explicitly sized and _must_ be 16-bit or
32-bit, then by all means use a sized type (u16 or preferably uint16_t).
Otherwise, stick with normal types.
--
dwmw2
prev parent reply other threads:[~2010-01-21 20:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-17 13:02 Use of data types in new portings Khushhua Mogambo
2010-01-21 20:19 ` David Woodhouse [this message]
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=1264105163.23727.790.camel@macbook.infradead.org \
--to=dwmw2@infradead.org \
--cc=linux-arm-kernel@lists.infradead.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).