From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wolfgang Denk Date: Wed, 08 May 2013 17:37:33 +0200 Subject: [U-Boot] [PATCH v2 06/10] powerpc/ppc4xx: Use generic FPGA accessors on all gdsys 405ep/ex boards In-Reply-To: <913a7e8badaaed06605fdf68faacedc8@gdsys.cc> References: <1367847325-21463-1-git-send-email-dirk.eibach@gdsys.cc> <1367847325-21463-7-git-send-email-dirk.eibach@gdsys.cc> <20130506141000.81015380E1C@gemini.denx.de> <20130506152259.E8260380E6C@gemini.denx.de> <449c45a6a9978c55e84d3fe7efe6f0ac@gdsys.cc> <20130506192356.7929A380E1C@gemini.denx.de> <20130507113609.7D3F038119A@gemini.denx.de> <20130507191803.7F57C380E1B@gemini.denx.de> <58ff5023adcbf08481bc2707b0a70f50@gdsys.cc> <20130508101333.6DDB438119E@gemini.denx.de> <913a7e8badaaed06605fdf68faacedc8@gdsys.cc> Message-ID: <20130508153733.E3BE63811AD@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 Dirk, In message <913a7e8badaaed06605fdf68faacedc8@gdsys.cc> you wrote: > > thanks for investing so much time into this. It is really appreciated. Well, just rejecting a patch without being able to give recommendations _how_ to improve it is not exactly nice. Sometimes it happens (like due to lack of time and/or better knowledge), but I try to avoid that. > > NULL == (struct ihs_fpga *)0 > > You are right. This is *exactly* what I meant when I wrote: "We have > FPGAs that are memory mapped and others that are not. They must be > accessed by the same drivers. So the alternative would be to create FPGA > instances at address NULL and getting the register offesets by casting > pointers to u16. Not very nice either." on monday. You don't get what I mean. There is no guarantee by the C standard that the "value" of NULL actually resolves to 0; it could be something else. So assuming it does is not only ugly, but non-conforming to the C standard, and thus error prone. > > What do you think? > > Very nice. > I think this looks supringsingly similar to my original implementation > in the patch series. There we have: Yes, except that now we still have 1) the full type checking when we access struct elements in the standard I/O accessors and 2) no need for casts when using offsets, and 3) no need to assume that NULL == 0. > Sorry, I'm a little confused here. Is your approach an improvement > anyway? Yes, definitely. At least I'm convinced of that. 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 The main thing is the play itself. I swear that greed for money has nothing to do with it, although heaven knows I am sorely in need of money. - Feodor Dostoyevsky