summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2016-05-16 20:37:33 +0900
committerNIIBE Yutaka <gniibe@fsij.org>2016-05-16 20:37:33 +0900
commit3651aa64b48d46fa8572a94b23c291d81e9d84ea (patch)
treeaba2c498ff79fc5ba78b568511faf6b6361c24c7
parent98977937cba9a4964151ed195d4cc1cd9f7966dd (diff)
ll_dequeue for PX only when not ready
-rw-r--r--chopstx.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/chopstx.c b/chopstx.c
index 36eb0ea..8ff244a 100644
--- a/chopstx.c
+++ b/chopstx.c
@@ -1857,23 +1857,26 @@ chopstx_poll (uint32_t *usec_p, int n, ...)
for (i = 0; i < n; i++)
{
pd = va_arg (ap, struct chx_poll_head *);
+
+ chx_cpu_sched_lock ();
+ chx_spin_lock (&px[i].lock);
if (pd->type == CHOPSTX_POLL_INTR)
{
struct chx_intr *intr = (struct chx_intr *)pd;
- chx_cpu_sched_lock ();
- chx_spin_lock (&q_intr.lock);
if (intr->ready)
chx_clr_intr (intr->irq_num);
else
- chx_disable_intr (intr->irq_num);
- chx_spin_unlock (&q_intr.lock);
- chx_cpu_sched_unlock ();
+ {
+ ll_dequeue ((struct chx_pq *)&px[i]);
+ chx_disable_intr (intr->irq_num);
+ }
+ }
+ else
+ {
+ if (pd->ready == 0)
+ ll_dequeue ((struct chx_pq *)&px[i]);
}
-
- chx_cpu_sched_lock ();
- chx_spin_lock (&px[i].lock);
- ll_dequeue ((struct chx_pq *)&px[i]);
chx_spin_unlock (&px[i].lock);
chx_cpu_sched_unlock ();
}