From: Tom Rini Date: Mon, 16 Mar 2020 09:29:43 -0400 Subject: [PATCH v2] mkimage: fit_image: Make fit header and data align to 512 In-Reply-To: <87v9n4sj6d.fsf@kokedama.swc.toshiba.co.jp> References: <20200316063053.26189-1-kever.yang@rock-chips.com> <87imj4u5aq.fsf@kokedama.swc.toshiba.co.jp> <87v9n4sj6d.fsf@kokedama.swc.toshiba.co.jp> Message-ID: <20200316132943.GY12423@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Mon, Mar 16, 2020 at 07:11:54PM +0900, Punit Agrawal wrote: > Kever Yang writes: > > > On 2020/3/16 ??3:28, Punit Agrawal wrote: > >> Kever Yang writes: > > [...] > > >> Instead of adding another copy of this code (versions of it already > >> exist in imx8mimage.c, ifwitool.c, aisiamge.c), it would be better to > >> move the below snippet to imagetool.h. > >> > >> #define __ALIGN_MASK(x, mask) (((x) + (mask)) & ~(mask)) > >> #define ALIGN(x, a) __ALIGN_MASK((x), (typeof(x))(a) - 1) > >> > >> With this, you can drop the version in imx8mimage.c which seems to > >> introduce an unnecessary multiplication / division. > > > > > > The definition of ALIGN is already at include/linux/kernel.h, is it > > better to use that directly? > > If there are no restrictions to include that header, please use > it. It'll be better than making another copy. :) We can't use that header in tools/ user-space code, no. Using imagetool.h by the ARRAY_SIZE macro is a good spot. Thanks! -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: