unneeded #include <version.h> in many places ?
Hi,
I noticed some kernel .c files #include <version.h> which typically contains something like:
#define UTS_RELEASE "2.6.9-rc1"
#define LINUX_VERSION_CODE 132617
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
However, those files don't reference the macros.
The question is: are these includes completely unneeded, so I can remove them, or do they serve some special purpose?
Another one: there are drivers using constructs like:
#if LINUX_VERSION_CODE > 0x20115
...
#endif
I understand they can be somehow useful for authors supporting many kernel versions with a single set of files, however the gain isn't clear to me. Should such conditional code be a) removed, b) left in place, c) dealt with each case individually?
Signature · 1 line
Krzysztof Halasa
Quoted 1 line · Krzysztof Halasa
Hi,
Hi Krzysztof,
Quoted 11 lines
I noticed some kernel .c files #include <
version.h> which typically contains something like:#define
UTS_RELEASE"2.6.9-rc1"
#defineLINUX_VERSION_CODE132617
#defineKERNEL_VERSION(a,b,c)(((a) << 16) + ((b) << 8) + (c))However, those files don't reference the macros.
The question is: are these includes completely unneeded, so I can remove them, or do they serve some special purpose?
they don't serve any special purpose.
But please doublecheck that they are really not needed.
Quoted 10 lines
Another one: there are drivers using constructs like:
#if
LINUX_VERSION_CODE>0x20115
...
#endifI understand they can be somehow useful for authors supporting many kernel versions with a single set of files, however the gain isn't clear to me. Should such conditional code be a) removed, b) left in place, c) dealt with each case individually?
c)
Many driver authors share their code this way between different major kernel versions, which makes it easier for them to maintain their code.
#ifdef's for kernel 2.4 are often still actively maitained.
#ifdef's for kernel 2.2 are only very rarely actively maitained.
#ifdef's for kernel 2.0 (as in your example) are most likely completely obsolete.
Quoted 1 line
Krzysztof Halasa
cu
Adrian
Signature · 4 lines
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed