Re: [linux-usb-devel] [PATCH 7/9] USB usbfs: destroy submitted urbs only on the disconnected interface

From: Oliver Neukum
Date: Thu Apr 15 2004 - 04:10:31 EST


Am Donnerstag, 15. April 2004 10:47 schrieb Duncan Sands:
> > > Hi Oliver, I thought you meant that CONFIG_EMBEDDED made WARN_ON go
> > > away (or something like that). If you just mean that it is easy to
> > > redefine WARN_ON by hand, then all I can say is: it is also easy to
> > > redefine warn by hand! Anyway, I made you the following patch:
> >
> > Yes, but I don't trust gcc to optimise away the 'if' if you redefine
> > warn().
>
> The "if" cannot be optimized away for the case in point, because it
> does something (clears the bit) if it passes the test. If I used WARN_ON
> then it would have to be WARN_ON(1) in the else branch of the if.

True. You should use BUG_ON().
If this ever happens the device tree is screwed. There's no use going on.

> > But there is another point. The embedded people deserve a single switch
> > to remove assertion checks. The purpose of macros like WARN_ON() is
> > easy and _central_ choice of debugging output vs. kernel size.
>
> This is not an argument against using USB's warn, it is an argument for
> building warn on top of a centralized macro like WARN_ON or a friend.

It is an argument against USB making its own constructs. There's nothing
terribly specific about USB that would justify it. If the usual debug statements
are inadequate, improve them.

Regards
Oliver

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