Messages in this thread | | | Date | Mon, 19 Apr 2021 11:53:37 +0200 | From | Greg Kroah-Hartman <> | Subject | Re: [PATCH v5] printk: Userspace format enumeration support |
| |
On Mon, Apr 19, 2021 at 11:16:43AM +0200, Petr Mladek wrote: > On Mon 2021-04-19 09:27:43, Rasmus Villemoes wrote: > > On 16/04/2021 15.56, Chris Down wrote: > > > Hey Petr, Rasmus, > > > > >> This is great point! There are many other subsystem specific wrappers, > > >> e,g, ata_dev_printk(), netdev_printk(), snd_printk(), dprintk(). > > >> We should make it easy to index them as well. > > > > > > These would be nice to have, but we should agree about how we store > > > things internally. > > > > > > For example, in printk we typically store the level inline as part of > > > the format string at compile time. However, for `dev_printk`, it's > > > passed entirely separately from the format string after preprocessing is > > > already concluded (or at least, not in a way we can easily parse it the > > > same way we do for printk()): > > > > > > void dev_printk(const char *level, const struct device *dev, const > > > char *fmt, ...) > > > > Hm, yeah, for "naked" dev_printk() calls there's no easy way to grab the > > level, for dev_err and friends it's somewhat easier as you could just > > hook into the definition of the dev_err macro. I'm not saying you need > > to handle everything at once, but doing dev_err and netdev_err would get > > you a very long way > > It is true that there are many messages printed using > dev_printk(). For example, these rough numbers: > > $> git grep pr_err | wc -l > 19885 > $> git grep dev_err | wc -l > 58153
You need "-w" :)
And I bet most of those pr_err() should be turned into dev_err(), if they live in drivers/.
Hm, 12734 of the pr_err() calls do live in drivers/, so most of those should be dev_err(). Might be something good to throw at interns...
thanks,
greg k-h
| |