# Re: \[PATCH 07/12\] HID: wiimote: Add output queue for wiimote driver

- From: David Herrmann \<hidden\>
- Date: 2011-06-29 12:53:50 
- List: linux-input
- Page: https://ratatoskr.run/linux-input/2011/06/8917104
- Thread: https://ratatoskr.run/linux-input/2011/06/8917072/t.md

```text
On Tue, Jun 28, 2011 at 6:51 AM, Dmitry Torokhov
[ref] wrote:
>
>
> avid Herrmann [ref] wrote:
>
>>The raw hid output function that is supported by bluetooth low-level
>>hid driver does not provide an output queue and also may sleep. The
>>wiimote driver, though, may need to send data in atomic context so
>>this patch adds a buffered output queue for the wiimote driver.
>>
>>We use the shared workqueue to send our buffer to the hid device.
>>There is always only one active worker which reschedules itself until
>>the wiimote queue is empty. This prevents the worker from occupying
>>the shared workqueue for too long.
>
> With CWQ this is not a concern anymore, you should be able to flush your buffer at once.

Thanks, I wasn't sure about this. I've now changed:
-       if (wdata->head != wdata->tail) {
+       while (wdata->head != wdata->tail) {
and removed the if(...) schedule_work(...);

> --
> Dmitry

Regards
David
```
