[PATCH 13/23] scripts: imx: move macro definitions to common header file
sam at ravnborg.org
Fri Jan 29 10:04:38 PST 2016
On Fri, Jan 29, 2016 at 11:43:53AM +0100, Sascha Hauer wrote:
> ARRAY_SIZE and offsetof are used by both imx-usb-loader and imx-image.
> Move their definitions to the common header file.
> Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
> scripts/imx/imx-image.c | 2 --
> scripts/imx/imx-usb-loader.c | 5 -----
> scripts/imx/imx.h | 5 +++++
> 3 files changed, 5 insertions(+), 7 deletions(-)
> diff --git a/scripts/imx/imx.h b/scripts/imx/imx.h
> index e986545..1d23e11 100644
> --- a/scripts/imx/imx.h
> +++ b/scripts/imx/imx.h
> @@ -1,3 +1,8 @@
> +#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)))
This macro is already defined in include/linux/kernel.h,
so it would be better to use this version.
> +#ifndef offsetof
> +#define offsetof(TYPE, MEMBER) __builtin_offsetof(TYPE, MEMBER)
Likewise for this - use the version in include/linux/stddef.h
Only from manual inspection - I did not try to replace the
definitions to check for any incompatibilities.
More information about the barebox