Re: [PATCH 01/14] staging: brcm80211: use wait queues instead of semaphores in wl_cfg80211.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08/12/2011 09:44 AM, Arend van Spriel wrote:
On 08/12/2011 04:07 PM, Rafał Miłecki wrote:
2011/8/12 Arend van Spriel<arend@xxxxxxxxxxxx>:
@@ -3537,27 +3544,39 @@ static s32 brcmf_event_handler(void *data)
                         (struct brcmf_cfg80211_priv *)data;
         struct sched_param param = {.sched_priority = MAX_RT_PRIO - 1 };
         struct brcmf_cfg80211_event_q *e;
+       DECLARE_WAITQUEUE(wait, current);

         sched_setscheduler(current, SCHED_FIFO,&param);
         allow_signal(SIGTERM);
-       while (likely(!down_interruptible(&cfg_priv->event_sync))) {
+       add_wait_queue(&cfg_priv->event_waitq,&wait);
+       while (1) {
+               prepare_to_wait(&cfg_priv->event_waitq,&wait,
+                               TASK_INTERRUPTIBLE);
+
+               schedule();
+
                 if (kthread_should_stop())
                         break;
+
                 e = brcmf_deq_event(cfg_priv);
                 if (unlikely(!e)) {
                         WL_ERR("event queue empty...\n");
-                       BUG();
+                       continue;
                 }
-               WL_INFO("event type (%d)\n", e->etype);
-               if (cfg_priv->el.handler[e->etype])
-                       cfg_priv->el.handler[e->etype](cfg_priv,
-                                                      cfg_to_ndev(cfg_priv),
-&e->emsg, e->edata);
-               else
-                       WL_INFO("Unknown Event (%d): ignoring\n", e->etype);

-               brcmf_put_event(e);
+               do {
+                       WL_INFO("event type (%d)\n", e->etype);
+                       if (cfg_priv->el.handler[e->etype])
+                               cfg_priv->el.handler[e->etype](cfg_priv,
+                                       cfg_to_ndev(cfg_priv),
+&e->emsg, e->edata);
+                       else
+                               WL_INFO("Unknown Event (%d): ignoring\n",
+                                       e->etype);
+                       brcmf_put_event(e);
+               } while ((e = brcmf_deq_event(cfg_priv)));
if (((((care_coding_style)))))
fix();

:-)


I assume you refer to the indents above. Not sure what exactly happened
there, but the patch email as I received it looks. Could it be a mail
reader issue?

Hi Rafał,

If you are refering to this line
>>> +               } while ((e = brcmf_deq_event(cfg_priv)));

The extra parentheses are added to fix a compiler warning:
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c: In function ‘brcmf_event_handler’: drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c:3576: warning: suggest parentheses around assignment used as truth value

Thanks
Franky


_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux