Re: [PATCH 4/4] OHCI: implement new semantics for URB_ISO_ASAP

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

 



On Mon, 1 Oct 2012, Sergei Shtylyov wrote:

> > +		if (unlikely(tick_before(frame, next))) {
> > +
> > +			/* USB_ISO_ASAP: Round up to the first available slot */
> > +			if (urb->transfer_flags&  URB_ISO_ASAP)
> > +				frame += (next - frame + ed->interval - 1)&
> > +						-ed->interval;
> > +
> > +			/*
> > +			 * Not ASAP: Use the next slot in the stream.  If
> > +			 * the entire URB falls before the threshold, fail.
> > +			 */
> > +			else if (tick_before(frame + ed->interval *
> > +					(urb->number_of_packets - 1), next)) {
> 
>     Erm, both arms of *if* should have {}, according to CodingStyle...

No, you have misunderstood CodingStyle.  In fact, CodingStyle says the
first branch should _not_ have braces, because both branches of the
"if" statement are single statements.  The first branch updates "frame"
and the second branch is another "if" statement.  Doing it the other 
way (braces for both branches) would yield:

		if (urb->...) {
			frame += ...
		} else {
			if (tick_before ... ) {
				...
			}
		}

which looks even worse.

Now, admittedly this could be construed as a borderline case and I 
certainly wouldn't complain if anyone put braces on the first branch.  
But oddly enough, checkpatch _does_ complain about it!

Try changing the patch and running it through checkpatch; you'll see.

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