The tact of Linux backports it to do this,
#if LINUX_VERSION_CODE < KERNEL_VERSION(5,0,0)
/* Declare stub or translation of functionB() to functonA(). */
void functionB(void)
{
functionA();
}
#endif
This can be more complex when the parameters to the routines take an infra-structure pointer that is not present in the newer kernels.
Backports is useful to take newer drivers to older kernel releases. It is less useful to take infra-structure (a new filesystem, etc.) to an older kernel.
The backport method replaces header files and has a few stub methods.
For example, firmware.h has code such as,
#if LINUX_VERSION_IS_LESS(4,18,0)
#define firmware_request_nowarn(fw, name, device) request_firmware(fw, name, device)
#endif
#if LINUX_VERSION_IS_LESS(4,17,0)
#define firmware_request_cache LINUX_BACKPORT(firmware_request_cache)
static inline int firmware_request_cache(struct device *device, const char *name)
{
return 0;
}
#endif
The mechanics let the primary driver remain untouched, so you can still use git to maintain consistency as it updates. If you are authoring a driver yourself, this might not matter.
See: Backports wiki