Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: android-alarm: Support old drivers via preprocessor aliasing

Older out of tree drivers that were desgined to the Android Alarm
in-kernel API may not build due to the namespace collision fixed in
an earlier patch. Per Arve's suggestion, this patch provides
preprocessor macros that allow older drivers to build.

CC: Arve Hjønnevåg <arve@android.com>
CC: Android Kernel Team <kernel-team@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

John Stultz and committed by
Greg Kroah-Hartman
2157f896 7f9b98a3

+23
+9
drivers/staging/android/Kconfig
··· 122 122 help 123 123 Exports the alarm interface to user-space. 124 124 125 + config ANDROID_ALARM_OLDDRV_COMPAT 126 + bool "Android Alarm compatability with old drivers" 127 + depends on ANDROID_INTF_ALARM 128 + default n 129 + help 130 + Provides preprocessor alias to aid compatability with 131 + older out-of-tree drivers that use the Android Alarm 132 + in-kernel API. This will be removed eventually. 133 + 125 134 endif # if ANDROID 126 135 127 136 endmenu
+14
drivers/staging/android/android_alarm.h
··· 76 76 /* set rtc while preserving elapsed realtime */ 77 77 int android_alarm_set_rtc(const struct timespec ts); 78 78 79 + #ifdef CONFIG_ANDROID_ALARM_OLDDRV_COMPAT 80 + /* 81 + * Some older drivers depend on the old API, 82 + * so provide compatability macros for now. 83 + */ 84 + #define alarm android_alarm 85 + #define alarm_init(x, y, z) android_alarm_init(x, y, z) 86 + #define alarm_start_range(x, y, z) android_alarm_start_range(x, y, z) 87 + #define alarm_try_to_cancel(x) android_alarm_try_to_cancel(x) 88 + #define alarm_cancel(x) android_alarm_cancel(x) 89 + #define alarm_set_rtc(x) android_alarm_set_rtc(x) 90 + #endif 91 + 92 + 79 93 #endif 80 94 81 95 enum android_alarm_return_flags {