[U-Boot] [PATCH v2 06/10] powerpc/ppc4xx: Use generic FPGA accessors on all gdsys 405ep/ex boards

Wolfgang Denk wd at denx.de
Wed May 8 17:37:33 CEST 2013


Dear Dirk,

In message <913a7e8badaaed06605fdf68faacedc8 at 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


More information about the U-Boot mailing list