Backward Compatibility
Happily, little has changed with regard to basic hardware access. There are just a few things that need to be kept in mind when writing backward-compatible drivers.
Hardware memory barriers didn’t exist in version 2.0 of the kernel. There was no need for such ordering instructions on the platforms then supported. Including sysdep.h in your driver will fix the problem by defining hardware barriers to be the same as software barriers.
Similarly, not all of the port-access functions (inb and friends) were supported on all architectures in older kernels. The string functions, in particular, tended to be absent. We don’t provide the missing functions in our sysdep.h facility: it won’t be an easy task to perform cleanly and most likely is not worth the effort, given the hardware dependency of those functions.
In Linux 2.0, ioremap and iounmap were called vremap and vfree, respectively. The parameters and the functionality were the same. Thus, a couple of definitions that map the functions to their older counterpart are often enough.
Unfortunately, while vremap worked just like ioremap for providing access to “high” memory (such as that on PCI cards), it did refuse to remap the ISA memory ranges. Back in those days, access to this memory was done via direct pointers, so there was no need to remap that address space. Thus, a more complete solution to implement ioremap for Linux 2.0 running on the x86 platform is as follows:
extern inline void *ioremap(unsigned ...