On Fri, 11 Nov 2011, Felipe Balbi wrote: > > The proper fix is probably to make ohci_dbg_sw an inline routine > > instead of a macro. > > hmmm, makes sense. Something like below ? I'm not sure about the usage > of size though... The idea of this macro is that it writes a formatted message either into a pre-supplied buffer or to the system log. So *next is the first free address in the buffer, and *size is the amount of free space remaining in the buffer -- the macro has to update both of them. If next is NULL then there is no buffer and the log is used instead. > -#define ohci_dbg_sw(ohci, next, size, format, arg...) \ > - do { \ > - if (next != NULL) { \ > - unsigned s_len; \ > - s_len = scnprintf (*next, *size, format, ## arg ); \ > - *size -= s_len; *next += s_len; \ > - } else \ > - ohci_dbg(ohci,format, ## arg ); \ > - } while (0); > - > +static void ohci_dbg_sw(struct ohci_hcd *ohci, char **next, > + unsigned *size, const char *fmt, ...) > +{ > + va_list args; > + > + va_start(args, fmt); > + do { > + if (next != NULL) { > + unsigned s_len; > + > + s_len = scnprintf(*next, *size, fmt, args); > + *size -= s_len; > + *next += s_len; > + } else { > + ohci_dbg(ohci, fmt, args); > + break; > + } > + } while(*size); > + va_end(args); > +} No do-while loop is needed. Take that out and it will be more or less okay, except... Does ohci_dbd() work correctly with a va_list instead of real arguments? I kind of doubt it. In fact, that may be the reason this was originally written as a macro. 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