system/bt
リビジョン | bc918ae656454413b277b4e3302feabbcfea93ee (tree) |
---|---|
日時 | 2019-10-15 17:37:43 |
作者 | Alistair Strachan <astrachan@goog...> |
コミッター | Chih-Wei Huang |
Fall back to CLOCK_BOOTTIME if CLOCK_BOOTTIME_ALARM fails
If the cuttlefish device does not have an rtc device (such as the crosvm
VMM) the bt osi layer can promote crashes due to it not being able to
create a CLOCK_BOOTTIME_ALARM timer. Bring back a fallback but enable it
at runtime instead of compile time.
Bug: 126955943
Test: run with cuttlefish
Change-Id: I3ab0282b3e8fde776aa7b37d5772c8f62cf957bf
@@ -115,12 +115,6 @@ struct alarm_t { | ||
115 | 115 | int64_t TIMER_INTERVAL_FOR_WAKELOCK_IN_MS = 3000; |
116 | 116 | static const clockid_t CLOCK_ID = CLOCK_BOOTTIME; |
117 | 117 | |
118 | -#if (KERNEL_MISSING_CLOCK_BOOTTIME_ALARM == TRUE) | |
119 | -static const clockid_t CLOCK_ID_ALARM = CLOCK_BOOTTIME; | |
120 | -#else | |
121 | -static const clockid_t CLOCK_ID_ALARM = CLOCK_BOOTTIME_ALARM; | |
122 | -#endif | |
123 | - | |
124 | 118 | // This mutex ensures that the |alarm_set|, |alarm_cancel|, and alarm callback |
125 | 119 | // functions execute serially and not concurrently. As a result, this mutex |
126 | 120 | // also protects the |alarms| list. |
@@ -327,7 +321,11 @@ static bool lazy_initialize(void) { | ||
327 | 321 | if (!timer_create_internal(CLOCK_ID, &timer)) goto error; |
328 | 322 | timer_initialized = true; |
329 | 323 | |
330 | - if (!timer_create_internal(CLOCK_ID_ALARM, &wakeup_timer)) goto error; | |
324 | + if (!timer_create_internal(CLOCK_BOOTTIME_ALARM, &wakeup_timer)) { | |
325 | + if (!timer_create_internal(CLOCK_BOOTTIME, &wakeup_timer)) { | |
326 | + goto error; | |
327 | + } | |
328 | + } | |
331 | 329 | wakeup_timer_initialized = true; |
332 | 330 | |
333 | 331 | alarm_expired = semaphore_new(0); |