Re: [PATCH v7 1/7] drivers:media:radio: wl128x: fmdrv common header file

From: Francis Galiegue
Date: Sat Dec 18 2010 - 05:20:28 EST


manjunatha_halli <at> ti.com> writes:

[...]
> +
> +#define NO_OF_ENTRIES_IN_ARRAY(array) (sizeof(array) / sizeof(array[0]))
> +

Hello,

There is already ARRAY_SIZE() defined in <linux/kernel.h>. And while we're at
it, git grep '#define ARRAY_SIZE' tells that there are 4 definitions in arch:

arch/powerpc/boot/types.h:#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
arch/um/include/shared/user.h:#define ARRAY_SIZE(x) (sizeof(x) /
sizeof((x)[0]))
arch/x86/boot/boot.h:#define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))
arch/x86/boot/compressed/relocs.c:#define ARRAY_SIZE(x) (sizeof(x) /
sizeof((x)[0]))
include/linux/kernel.h:#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])
+ __must_be_array(arr))

Does the __must_be_array() cause trouble with arch/? If not, shouldn't these
definitions be merged?


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/