Other Portability Issues
In addition to data typing, there are a few other software issues to keep in mind when writing a driver if you want it to be portable across Linux platforms.
A general rule is to be suspicious of explicit constant values. Usually the code has been parameterized using preprocessor macros. This section lists the most important portability problems. Whenever you encounter other values that have been parameterized, you’ll be able to find hints in the header files and in the device drivers distributed with the official kernel.
Time Intervals
When dealing with time intervals, don’t assume that there are 100
jiffies per second. Although this is currently true for Linux-x86,
not every Linux platform runs at 100 Hz (as of 2.4 you find values
ranging from 20 to 1200, although 20 is only used in the IA-64
simulator). The assumption can be false even for the x86 if you play
with the HZ value (as some people do), and nobody
knows what will happen in future kernels. Whenever you calculate time
intervals using jiffies, scale your times using HZ
(the number of timer interrupts per second). For example, to check
against a timeout of half a second, compare the elapsed time against
HZ/2. More generally, the number of jiffies
corresponding to msec milliseconds is always
msec*HZ/1000. This detail had to be fixed in many
network drivers when porting them to the Alpha; some of them didn’t
work on that platform because they assumed HZ to be 100.
Page Size
When playing ...