On Fri, Jan 29, 2016 at 07:04:38PM +0100, Sam Ravnborg wrote: > 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@xxxxxxxxxxxxxx> > > --- > > 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)[0])) > This macro is already defined in include/linux/kernel.h, > so it would be better to use this version. It's defined in the barebox version of this file, but not in /usr/include/linux/kernel.h which would be used for compiling programs for the host. Adding a -I$(srctree)/include to the host compiler options is also something we don't want. What other options do we have to avoid duplicating these over and over again? Maybe adding a scripts/include directory which contains such useful defines? I just found tools/include in the Linux Kernel which already has a collection of such defines. Maybe this is a good starting point. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox