[PATCH] Cleanup of version code checks, part I

Brian Gerst (bgerst@quark.vpplus.com)
Sun, 28 Nov 1999 12:13:01 -0500


My goal with this patch and another upcoming patch is to make the
checking of kernel version consistent throughout the kernel. For the
most part, these changes are cosmetic, although I have uncovered a few
bugs by doing this.

This patch takes all the version code checks that were made against a
constant (either decimal or hex) and changes them to using the
KERNEL_VERSION macro. This uncovered a nice "feature" in GCC that when
a macro with no args is undefined and used in a #if comparison, GCC
silently sets its value to zero. This means that some places
(udf_fs_sb.h for example) that were missing a #include <linux/version.h>
were possibly miscompiling.

On another note, the KERNEL_VERSION macro was introduced in 2.1.90. If
driver maintainers wish to actively support kernels older than this then
they should add to their code:
#ifndef KERNEL_VERSION
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
#endif

My next patch will cover the cases that use a redundant macro (ie,
LinuxVersionCode).

Please test this patch a bit before I send it to Linus.
http://quark.vpplus.com/~bgerst/linux/diff-2.3.30-pre3a.gz

-- 

Brian Gerst

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