From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ilya Yanok Date: Wed, 11 Feb 2009 22:40:42 +0300 Subject: [U-Boot] [PATCH 2/3] dnet: driver for Dave DNET ethernet controller In-Reply-To: <20090205213201.5A0EA8322908@gemini.denx.de> References: <1233589490-14293-1-git-send-email-yanok@emcraft.com> <1233589490-14293-3-git-send-email-yanok@emcraft.com> <20090202202116.CF0BC8322908@gemini.denx.de> <498A5F2F.1030603@emcraft.com> <20090205213201.5A0EA8322908@gemini.denx.de> Message-ID: <499329BA.5040807@emcraft.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Wolfgang, Wolfgang Denk wrote: >> nothing magical in offsets actually... we usually have offsets in specs >> not C structures... >> > > Just to name one reason (but a very important one): using a struct > allows for strict type checking by the compiler. If you use address + > offset you will not get any help from the compiler when you for > example read 8 bit from a register that must be accessed as a 32 bit > entity. > But this works only if we use "memory-style" IO access, if we use read/write accessor functions that info we be lost as all pointers we be silently converted into void*... And using "memory-style" IO access is strongly discouraged in the kernel... BTW, what is the general rule for U-Boot? I can see that most accesses are done "memory-style" but I can see accessor functions used here and there... Regards, Ilya.