[U-Boot] [PATCH V4 01/11] imximage: mx53 needs transfer length a multiple of 512

Troy Kisky troy.kisky at boundarydevices.com
Wed Nov 28 22:05:29 CET 2012


On 11/28/2012 1:25 PM, Wolfgang Denk wrote:
> Dear Troy Kisky,
>
> In message <50B65583.1070309 at boundarydevices.com> you wrote:
>> Oddly enough, I originally called it ROUND_UP. But then I saw these lines
>> in include/common.h
> And why didn't you find (and use) ROUND() in include/common.h ?
>
> Best regards,
>
> Wolfgang Denk
>
I did also find ROUND, so I checked to see what Linux did. Linux does not
have ROUND, but it does have ALIGN.

But I personally prefer ROUND, or even better ROUND_UP. I just wanted
to use the most common form. u-boot seems to use ROUND in config files
and ALIGN in .c files

But the reason I didn't include common.h is because of the target specific
files that it also includes. Would you mind if I moved

_________________________
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))

#define ROUND(a,b)              (((a) + (b) - 1) & ~((b) - 1))
#define DIV_ROUND(n,d)          (((n) + ((d)/2)) / (d))
#define DIV_ROUND_UP(n,d)       (((n) + (d) - 1) / (d))
#define roundup(x, y)           ((((x) + ((y) - 1)) / (y)) * (y))

#define ALIGN(x,a)              __ALIGN_MASK((x),(typeof(x))(a)-1)
#define __ALIGN_MASK(x,mask)    (((x)+(mask))&~(mask))
-------------------------------------

from common.h to a new file common_macro.h

and included common_macro.h instead?


Perhaps you have a better alternative?


Thanks
Troy




More information about the U-Boot mailing list