From: Wolfgang Denk <wd@denx.de>
To: Kent Borg <kentborg@borg.org>
Cc: linuxppc-embedded@lists.linuxppc.org
Subject: Re: IO, ANSI vs GCC structs
Date: Fri, 25 Jul 2003 21:22:47 +0200 [thread overview]
Message-ID: <20030725192252.428EEC602D@atlas.denx.de> (raw)
In-Reply-To: Your message of "Fri, 25 Jul 2003 13:47:34 EDT." <20030725134734.J29161@borg.org>
In message <20030725134734.J29161@borg.org> you wrote:
>
> How important is it to the kernel coding style that hardware be
I cannot speak for the powers that be, but...
> accessed through a structure? Is it acceptable to do:
>
> #define MYHW (MY_MBAR+42)
>
> ...
>
> out_be32(MYHW, 0xco1df00d);
...I would not accept such code.
There is one fundamental difference: a field in a struct has a type,
i. e. the compiler "knows" how big it is (8, 16, 32, ... bits), if
special attributes apply (volatile), etc.
There is no such information with a #define like yours above.
OK, you can write
#define FOO ((volatile uint32_t *)(FOO_BASE+FOO_OFFSET))
but this isn't really readable, is it?
Just my $0.02
Best regards,
Wolfgang Denk
--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd@denx.de
They say a little knowledge is a dangerous thing, but it is not one
half so bad as a lot of ignorance. - Terry Pratchett, _Equal Rites_
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
next prev parent reply other threads:[~2003-07-25 19:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-07-25 15:30 IO, ANSI vs GCC structs Kent Borg
2003-07-25 15:51 ` Bret Indrelee
2003-07-25 16:19 ` Wolfgang Denk
2003-07-25 17:47 ` Kent Borg
2003-07-25 19:22 ` Wolfgang Denk [this message]
2003-07-25 21:45 ` Paul Mackerras
[not found] <5.1.0.14.2.20030725123123.03855f58@mail.ebshome.net>
2003-07-25 19:59 ` Bret Indrelee
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=20030725192252.428EEC602D@atlas.denx.de \
--to=wd@denx.de \
--cc=kentborg@borg.org \
--cc=linuxppc-embedded@lists.linuxppc.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).