Messages in this thread | | | Date | Fri, 11 Jan 2002 14:23:37 +0200 | From | Vladimir Kondratiev <> | Subject | Re: __FUNCTION__ - patch for USB |
| |
Greg KH wrote:
>You still are changing a few dbg() macros that you don't have to change. > Guilty. Goal was to force some common style. There are mix of function call styles like f() and f (). I suppose f() (without space between function name and parenthes) is better, but it is of course religious issue and have no 'proper' solution.
> >Also, info(), warn() and err() should not have __FUNCTION__ added to >them. Have you tried running the usb code with this patch? The USB >group gets enough grief about all of the kernel log messages that we >spit out. We do not need to see the function name for every message we >write (the user does not need it.) > Questionable. There are lots of calls that used to have __FUNCTION__, ex. 1-st chunks from patch are:
--- linux-2.4.18-pre2.orig/drivers/usb/CDCEther.c Fri Dec 21 19:41:55 2001 +++ linux-2.4.18-pre2.patched/drivers/usb/CDCEther.c Thu Jan 10 10:28:21 2002 - warn( __FUNCTION__ " failed submint rx_urb %d", res); + warn("failed submint rx_urb %d", res); - err( "write_bulk_callback: device not running" ); + err( "device not running" );
It is hard to be both flexible and easy. I suppose always have function name in the log is a good idea. Maybe, I would even add line number. Anyway, original macros used to add __FILE__ prefix. All these stuff goes to syslog, and user usually do not see it at all. If one wants to browse /var/log/messages, he is supposed to understand a little what he going to see, and function names may help. In places where great flexibility is required, I'd propose to keep using printk().
> >I think I'll wait for the debug level messages cleanup in the 2.5 USB >code to make this kind of change (as talked about in a previous >message.) > >thanks, > >greg k-h > What about macros for simple one line messages for generic usage? Any thoughts? I propose the following messages format:
<module>:<file>:<line>:<function> - <message_text>
Corresponded macro would be, for example:
#ifdef MODULE #define err(format, arg...) printk(KERN_ERR "%s:%s:%d:%s - " format "\n" ,THIS_MODULE->name ,__FILE__, __LINE__, __FUNCTION__, ## arg) #else #define err(format, arg...) printk(KERN_ERR "%s:%d:%s - " format "\n" , __FILE__, __LINE__, __FUNCTION__, ## arg) #endif
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |