Backward Compatibility
The Linux kernel is a moving target—many things change over time as new features are developed. The interface that we have described in this chapter is that provided by the 2.4 kernel; if your code needs to work on older releases, you will need to take various steps to make that happen.
This is the first of many “backward compatibility” sections in this book. At the end of each chapter we’ll cover the things that have changed since version 2.0 of the kernel, and what needs to be done to make your code portable.
For starters, the KERNEL_VERSION macro was
introduced in kernel 2.1.90. The sysdep.h header
file contains a replacement for kernels that need it.
Changes in Resource Management
The new resource management scheme brings in a few portability
problems if you want to write a driver that can run with kernel
versions older than 2.4. This section discusses the portability
problems you’ll encounter and how the sysdep.h
header tries to hide them.
The most apparent change brought about by the new resource management
code is the addition of request_mem_region and
related functions. Their role is limited to accessing the I/O memory
database, without performing specific operations on any hardware. What
you can do with earlier kernels, thus, is to simply not call the
functions. The sysdep.h header easily
accomplishes that by defining the functions as macros that return
0 for kernels earlier than 2.4.
Another difference between 2.4 and earlier kernel ...