
On 11/28/2012 2:27 AM, Wolfgang Denk wrote:
Dear Troy Kisky,
In message 1354066303-29762-2-git-send-email-troy.kisky@boundarydevices.com you wrote:
The mx53 ROM will truncate the length at a multiple of 512. Transferring too much is not a problem, so round up.
What about other SoCs using the same code?
+#define ALIGN(a, b) (((a) + (b) - 1) & ~((b) - 1))
NAK. This macro is mis-named; it has nothing to do with alignment - you write yourself: "round up".
And you don't have to re-invent the wheel. Please use the existing macros for this purpose.
Best regards,
Wolfgang Denk
Oddly enough, I originally called it ROUND_UP. But then I saw these lines in include/common.h
#define ALIGN(x,a) __ALIGN_MASK((x),(typeof(x))(a)-1) #define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask))
So, I deleted my definition of ROUND_UP and used ALIGN. But imximage.c did not automatically include common.h. Instead of trying to include common.h and all the files it pulled in, I added the ALIGN definition.
Troy