Deprecated kernel functions
[Posted January 8, 2003 by corbet]
One small patch that slipped into 2.5.54 is the addition of a new
__deprecated function attribute. With a suitably modern compiler
(gcc 3.1 or newer), calls to a function marked as being deprecated
will generate compile-time warnings. The hope is that the warnings will
inspire people to remove calls to the deprecated functions, making it
easier to remove them altogether.
So far, this attribute has been used sparingly; the only functions which
have been marked are check_region() (which has long been obsoleted
by the race-free version of request_region() which returns a
success value), and the old module use count macros
(MOD_INC_USE_COUNT and MOD_DEC_USE_COUNT). Patches have
been put forward to mark other functions, but there has been resistance to
doing so, for a couple of reasons.
One reason, as expressed by Linus, is that
the functions that have deprecated so far already generate far too many
warnings. A quick grep turns up over 1000 check_region() calls
in the 2.5 kernel. Adding more warnings to the mix is not going to help
get things fixed, and may well just mask other warnings about real
problems.
The other objection that has been raised is that trying to clean up use of
deprecated functions at this stage distracts attention from the most
important task: stabilizing the 2.5 kernel for release. The current code
works, for the most part, even if it's using deprecated functions. It's
hard to imagine cleaning up 1000 check_region() calls without
breaking something, somewhere.
The end result is that, probably, not too many other kernel functions will
be marked as deprecated in this development cycle. Some functions that had
been expected to disappear (e.g. sleep_on()) will persist into
2.7 - they are still extensively used in some places. Cleaning up old
stuff is never easy; it is simpler to put code into the kernel than to take
it out.
(
Log in to post comments)