From bf9e3620ec65a3f63a17941031a0c9114e0f3797 Mon Sep 17 00:00:00 2001
From: Guillaume Endignoux <guillaumee@google.com>
Date: Thu, 5 Mar 2020 11:24:07 +0100
Subject: [PATCH] Sync with upstream Tock to remove the latest patch.

---
 patches/tock/01-persistent-storage.patch      |  2 +-
 .../tock/04-fix-dynamic-deferred-call.patch   | 46 -------------------
 third_party/tock                              |  2 +-
 3 files changed, 2 insertions(+), 48 deletions(-)
 delete mode 100644 patches/tock/04-fix-dynamic-deferred-call.patch

diff --git a/patches/tock/01-persistent-storage.patch b/patches/tock/01-persistent-storage.patch
index 5aaec06..ecfb0b0 100644
--- a/patches/tock/01-persistent-storage.patch
+++ b/patches/tock/01-persistent-storage.patch
@@ -295,7 +295,7 @@ index ece4a443..9a1afc84 100644
      }
 +
 +    pub fn in_writeable_flash_region(&self, ptr: usize, len: usize) -> bool {
-+        self.kernel.process_map_or(false, self.idx, |process| {
++        self.kernel.process_map_or(false, *self, |process| {
 +            let ptr = match ptr.checked_sub(process.flash_start() as usize) {
 +                None => return false,
 +                Some(ptr) => ptr,
diff --git a/patches/tock/04-fix-dynamic-deferred-call.patch b/patches/tock/04-fix-dynamic-deferred-call.patch
deleted file mode 100644
index 4e29004..0000000
--- a/patches/tock/04-fix-dynamic-deferred-call.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-diff --git a/kernel/src/common/dynamic_deferred_call.rs b/kernel/src/common/dynamic_deferred_call.rs
-index 53f5143d..ca349972 100644
---- a/kernel/src/common/dynamic_deferred_call.rs
-+++ b/kernel/src/common/dynamic_deferred_call.rs
-@@ -226,23 +226,25 @@ impl DynamicDeferredCall {
-     /// `call_global_instance_while`.
-     pub(self) fn call_while<F: Fn() -> bool>(&self, f: F) {
-         if self.call_pending.get() {
--            // Reset call_pending here, as it may be set again in the deferred calls
--            self.call_pending.set(false);
-+            for (i, client_state) in self.client_states.iter().enumerate() {
-+                if !f() {
-+                    break;
-+                }
-+                if client_state.scheduled.get() {
-+                    client_state.client.map(|client| {
-+                        client_state.scheduled.set(false);
-+                        client.call(DeferredCallHandle(i));
-+                    });
-+                }
-+            }
- 
--            self.client_states
--                .iter()
--                .enumerate()
--                .filter(|(_i, client_state)| client_state.scheduled.get())
--                .filter_map(|(i, client_state)| {
--                    client_state
--                        .client
--                        .map(|c| (i, &client_state.scheduled, *c))
--                })
--                .take_while(|_| f())
--                .for_each(|(i, call_reqd, client)| {
--                    call_reqd.set(false);
--                    client.call(DeferredCallHandle(i));
--                });
-+            // Recompute call_pending here, as some deferred calls may have been skipped due to the
-+            // `f` predicate becoming false.
-+            self.call_pending.set(
-+                self.client_states
-+                    .iter()
-+                    .any(|client_state| client_state.scheduled.get()),
-+            );
-         }
-     }
- }
diff --git a/third_party/tock b/third_party/tock
index 3a7d6b7..fbc863f 160000
--- a/third_party/tock
+++ b/third_party/tock
@@ -1 +1 @@
-Subproject commit 3a7d6b775d972798bfd731cba8365b58fab27175
+Subproject commit fbc863faf0c9615537ee52dcdccdfcb9204d2467
-- 
GitLab