sim/rptun: Trigger the callback only the sequnece number change
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
12b2b7c240
commit
1efc9fbac6
|
@ -224,16 +224,20 @@ void up_rptun_loop(void)
|
||||||
{
|
{
|
||||||
if (dev->shmem != NULL)
|
if (dev->shmem != NULL)
|
||||||
{
|
{
|
||||||
|
bool should_notify = false;
|
||||||
|
|
||||||
if (dev->master && dev->seq != dev->shmem->seqs)
|
if (dev->master && dev->seq != dev->shmem->seqs)
|
||||||
{
|
{
|
||||||
dev->seq = dev->shmem->seqs;
|
dev->seq = dev->shmem->seqs;
|
||||||
|
should_notify = true;
|
||||||
}
|
}
|
||||||
else if (!dev->master && dev->seq != dev->shmem->seqm)
|
else if (!dev->master && dev->seq != dev->shmem->seqm)
|
||||||
{
|
{
|
||||||
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);
|
dev->callback(dev->arg, RPTUN_NOTIFY_ALL);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue