From 1efc9fbac6c24a1ef130f5ece8a957bcf4c37bf0 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Wed, 14 Jul 2021 01:50:22 +0800 Subject: [PATCH] sim/rptun: Trigger the callback only the sequnece number change Signed-off-by: Xiang Xiao --- arch/sim/src/sim/up_rptun.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/sim/src/sim/up_rptun.c b/arch/sim/src/sim/up_rptun.c index b4a3e5d8543..ef8f50d7a7b 100644 --- a/arch/sim/src/sim/up_rptun.c +++ b/arch/sim/src/sim/up_rptun.c @@ -224,16 +224,20 @@ void up_rptun_loop(void) { if (dev->shmem != NULL) { + bool should_notify = false; + if (dev->master && dev->seq != dev->shmem->seqs) { dev->seq = dev->shmem->seqs; + should_notify = true; } else if (!dev->master && dev->seq != dev->shmem->seqm) { dev->seq = dev->shmem->seqm; + should_notify = true; } - if (dev->callback != NULL) + if (should_notify && dev->callback != NULL) { dev->callback(dev->arg, RPTUN_NOTIFY_ALL); }