@@ -954,9 +954,15 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
#define swap(a, b) \
do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0)
-/* This counts to 12. Any more, it will return 13th argument. */
-#define __COUNT_ARGS(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _n, X...) _n
-#define COUNT_ARGS(X...) __COUNT_ARGS(, ##X, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
+/* This counts to 32. Any more, it will return the 33rd argument. */
+#define __COUNT_ARGS( \
+ _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
+ _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, \
+ _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _n, X...) _n
+#define COUNT_ARGS(X...) __COUNT_ARGS(, ##X, \
+ 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, \
+ 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, \
+ 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
#define __CONCAT(a, b) a ## b
#define CONCATENATE(a, b) __CONCAT(a, b)
This is useful to define sysfs bit-fields, such as this one in a forthcoming change: SYSFS_RW_REG(smode1, smode1, SYSFS_DECNUM_FIELD(rc), SYSFS_DECNUM_FIELD(lc), SYSFS_DECNUM_FIELD(t1248), SYSFS_DECNUM_FIELD(slck), SYSFS_SYMBOL_FIELD(cmod, vesa, ntsc, pal), SYSFS_DECNUM_FIELD(ex), SYSFS_DECNUM_FIELD(prst), SYSFS_DECNUM_FIELD(sint), SYSFS_DECNUM_FIELD(xpck), SYSFS_DECNUM_FIELD(pck2), SYSFS_DECNUM_FIELD(spml), SYSFS_SYMBOL_FIELD(gcont, rgbyc, ycrcb), SYSFS_DECNUM_FIELD(phs), SYSFS_DECNUM_FIELD(pvs), SYSFS_DECNUM_FIELD(pehs), SYSFS_DECNUM_FIELD(pevs), SYSFS_DECNUM_FIELD(clksel), SYSFS_DECNUM_FIELD(nvck), SYSFS_DECNUM_FIELD(slck2), SYSFS_DECNUM_FIELD(vcksel), SYSFS_DECNUM_FIELD(vhp)); Signed-off-by: Fredrik Noring <noring@nocrew.org> --- include/linux/kernel.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)