staging: android-alarm: Support old drivers via preprocessor aliasing
authorJohn Stultz <john.stultz@linaro.org>
Thu, 9 Feb 2012 22:24:41 +0000 (14:24 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Feb 2012 18:08:01 +0000 (10:08 -0800)
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>
drivers/staging/android/Kconfig
drivers/staging/android/android_alarm.h

index 6bb4fa8..75ca225 100644 (file)
@@ -122,6 +122,15 @@ config ANDROID_INTF_ALARM_DEV
        help
          Exports the alarm interface to user-space.
 
+config ANDROID_ALARM_OLDDRV_COMPAT
+       bool "Android Alarm compatability with old drivers"
+       depends on ANDROID_INTF_ALARM
+       default n
+       help
+         Provides preprocessor alias to aid compatability with
+         older out-of-tree drivers that use the Android Alarm
+         in-kernel API. This will be removed eventually.
+
 endif # if ANDROID
 
 endmenu
index 9213581..6eecbde 100644 (file)
@@ -76,6 +76,20 @@ ktime_t alarm_get_elapsed_realtime(void);
 /* set rtc while preserving elapsed realtime */
 int android_alarm_set_rtc(const struct timespec ts);
 
+#ifdef CONFIG_ANDROID_ALARM_OLDDRV_COMPAT
+/*
+ * Some older drivers depend on the old API,
+ * so provide compatability macros for now.
+ */
+#define alarm android_alarm
+#define alarm_init(x, y, z) android_alarm_init(x, y, z)
+#define alarm_start_range(x, y, z) android_alarm_start_range(x, y, z)
+#define alarm_try_to_cancel(x) android_alarm_try_to_cancel(x)
+#define alarm_cancel(x) android_alarm_cancel(x)
+#define alarm_set_rtc(x) android_alarm_set_rtc(x)
+#endif
+
+
 #endif
 
 enum android_alarm_return_flags {