From: Wolfgang Denk Date: Thu, 05 Feb 2009 22:32:01 +0100 Subject: [U-Boot] [PATCH 2/3] dnet: driver for Dave DNET ethernet controller In-Reply-To: <498A5F2F.1030603@emcraft.com> 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> Message-ID: <20090205213201.5A0EA8322908@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Ilya Yanok, In message <498A5F2F.1030603@emcraft.com> you wrote: > > > Please do not operate on base register plus magic offset - implement a > > proper C structure instead to describe the controller hardware. > > I've done as you requested but I'm really in doubt why do you like it? > In the kernel offsets are preferred over C structures... And there is With "in the kernel" you probaly mean "in the ARM architecture code of the kernel". Compare for example PowerPC... > 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. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Q: How many DEC repairman does it take to fix a flat ? A: Five; four to hold the car up and one to swap tires.