speedtch usbatm.c,1.28,1.29

Roman Kagan rkagan at mail.ru
Tue May 3 10:05:29 EDT 2005


On Tue, May 03, 2005 at 11:02:27AM +0100, Duncan Sands wrote:
> Modified Files:
> 	usbatm.c 
> Log Message:
> Don't use BUG_ON in_interrupt() - it will cause the whole machine to halt.

Ups, I didn't know that...  But that wasn't my invention ;) :

usbatm.h:47:
#ifdef DEBUG
#define UDSL_ASSERT(x)	BUG_ON(!(x))
#else
#define UDSL_ASSERT(x)	do { if (!(x)) warn("failed assertion '" #x "' at line %d", __LINE__); } while(0)
#endif

Anyway, I've put BUG_ON() there instead of UDSL_ASSERT() (and I've left
the latter in place, but commented out as a FIXME reminder) because
UDSL_ASSERT() didn't work with % operator, apparently because it was
confused with a format specifier in printk.  

> We could put in
> all kinds of recovery code, but since it's never going to happen, that
> seems kind of pointless.

Right, so how about making UDSL_ASSERT() a more traditional assertion,
which is preprocessed completely away when DEBUG is off, and generates
an err() when DEBUG is on?

Cheers,
  Roman.



More information about the Usbatm mailing list