Re: [PATCH] dev_printk macro

Randy.Dunlap (rddunlap@osdl.org)
Sun, 22 Dec 2002 16:46:00 -0800 (PST)


Hi LKML,

I'm glad to see this patch available, as Greg was.
Now I have some questions about it.

a. Is it only for drivers? If so, why?
Filesystems and other subsystems that are not drivers could use
something like this also.

b. Is it only for drivers that have a device?
What does a driver use for dev_printk() if it doesn't have a <dev>?
However, these do cover the large majority of cases, so that's good.

c. Maybe I'm too cautious (I don't like panics or oopsen :), but I would
have checked <dev> for NULL in those macros.

d. and I know that <sev> is severity, but spelling it as severity
or level would have been better. :)

IOW, this is a good start, no doubt. However, it appears to be limited
in scope to drivers. That's still a good start, but there's more to do.

-- 
~Randy

PS: Yes, I know Greg's 2 favorite words: Patches accepted. Maybe early next year. ;)

On Sun, 22 Dec 2002, Linux Kernel Mailing List wrote:

| ChangeSet 1.865.28.18, 2002/12/21 23:54:35-08:00, jkenisto@us.ibm.com | | [PATCH] dev_printk macro | | # include/linux/device.h 1.69 -> 1.70 | | diff -Nru a/include/linux/device.h b/include/linux/device.h | --- a/include/linux/device.h Sun Dec 22 13:04:59 2002 | +++ b/include/linux/device.h Sun Dec 22 13:04:59 2002 | @@ -396,22 +396,21 @@ | extern void firmware_unregister(struct subsystem *); | | /* debugging and troubleshooting/diagnostic helpers. */ | +#define dev_printk(sev, dev, format, arg...) \ | + printk(sev "%s %s: " format , (dev).driver->name , (dev).bus_id , ## arg) | + | #ifdef DEBUG | #define dev_dbg(dev, format, arg...) \ | - printk (KERN_DEBUG "%s %s: " format , \ | - (dev).driver->name , (dev).bus_id , ## arg) | + dev_printk(KERN_DEBUG , (dev) , format , ## arg) | #else | #define dev_dbg(dev, format, arg...) do {} while (0) | #endif | | #define dev_err(dev, format, arg...) \ | - printk (KERN_ERR "%s %s: " format , \ | - (dev).driver->name , (dev).bus_id , ## arg) | + dev_printk(KERN_ERR , (dev) , format , ## arg) | #define dev_info(dev, format, arg...) \ | - printk (KERN_INFO "%s %s: " format , \ | - (dev).driver->name , (dev).bus_id , ## arg) | + dev_printk(KERN_INFO , (dev) , format , ## arg) | #define dev_warn(dev, format, arg...) \ | - printk (KERN_WARNING "%s %s: " format , \ | - (dev).driver->name , (dev).bus_id , ## arg) | + dev_printk(KERN_WARNING , (dev) , format , ## arg) | | #endif /* _DEVICE_H_ */

- 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/