Android-x86
Fork
Donation

  • R/O
  • HTTP
  • SSH
  • HTTPS

system-bt: Commit

system/bt


Commit MetaInfo

Revision9249baa69be947a1015015f14b573a20b423e56e (tree)
Time2019-10-15 17:35:09
AuthorAlistair Strachan <astrachan@goog...>
CommiterChih-Wei Huang

Log Message

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

Change Summary

Incremental Difference

--- a/osi/src/alarm.c
+++ b/osi/src/alarm.c
@@ -96,12 +96,6 @@ struct alarm_t {
9696 int64_t TIMER_INTERVAL_FOR_WAKELOCK_IN_MS = 3000;
9797 static const clockid_t CLOCK_ID = CLOCK_BOOTTIME;
9898
99-#if defined(KERNEL_MISSING_CLOCK_BOOTTIME_ALARM) && (KERNEL_MISSING_CLOCK_BOOTTIME_ALARM == TRUE)
100-static const clockid_t CLOCK_ID_ALARM = CLOCK_BOOTTIME;
101-#else
102-static const clockid_t CLOCK_ID_ALARM = CLOCK_BOOTTIME_ALARM;
103-#endif
104-
10599 // This mutex ensures that the |alarm_set|, |alarm_cancel|, and alarm callback
106100 // functions execute serially and not concurrently. As a result, this mutex
107101 // also protects the |alarms| list.
@@ -342,8 +336,11 @@ static bool lazy_initialize(void) {
342336 goto error;
343337 timer_initialized = true;
344338
345- if (!timer_create_internal(CLOCK_ID_ALARM, &wakeup_timer))
346- goto error;
339+ if (!timer_create_internal(CLOCK_BOOTTIME_ALARM, &wakeup_timer)) {
340+ if (!timer_create_internal(CLOCK_BOOTTIME, &wakeup_timer)) {
341+ goto error;
342+ }
343+ }
347344 wakeup_timer_initialized = true;
348345
349346 alarm_expired = semaphore_new(0);
Show on old repository browser