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

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

 



On Tue, 25 Jun 2013, Ming Lei wrote:

> >> +
> >> +     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;
> 
> >
> >> +
> >> +     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

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux