
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