Thread (21 messages) 21 messages, 3 authors, 2013-06-25
STALE4757d

[PATCH v2 1/4] USB: HCD: support giveback of URB in tasklet context

From: stern@rowland.harvard.edu (Alan Stern)
Date: 2013-06-25 14:48:30

On Tue, 25 Jun 2013, Ming Lei wrote:
quoted
quoted
+
+     spin_lock(&bh->lock);
+     list_add_tail(&urb->urb_list, &bh->head);
+     if (bh->running)
+             sched = 0;
+     else
+             sched = 1;
+     spin_unlock(&bh->lock);
How about calling this variable "running" instead of "sched"?  Then you
could just say:

        running = bh->running;

with no "if" statement.
OK, even we can do this below without name change:

           sched = !bh->running;
quoted
quoted
+
+     if (!sched)
+             ;
+     else if (high_prio_bh)
+             tasklet_hi_schedule(&bh->bh);
+     else
+             tasklet_schedule(&bh->bh);
The advantage of "running" instead of "sched" is that it avoids a 
double negative:

	sched = !bh->running;
	...
	if (!sched) ...

as opposed to

	running = bh->running;
	...
	if (running) ...

Alan Stern
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help