lkml.org 
[lkml]   [2022]   [Aug]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectQuestion: dev_err_probe() vs Printk Index
Hi,

When a driver is using dev_err(), part of it is inlined and it:
- takes advantage of dev_fmt() [1]
- implements Printk Index [2]

Printk Index works with some __builtin_constant_p() magic in it.
In case of a use in a probe, 99.99% of the time the log level and the
format will be constant and the logic for Printk Index will be put in place.


In case dev_err_probe(), the format will be an argument passed to the
function and will not be constant, so nothing will be generated in the
'printk'_index section.


In case dev_err_probe(), a potential dev_fmt() defined in the drivers'
file can't be taken into consideration.
(trusting my grep, we never use in files that define dev_fmt() in the .c
file. I've not checked if it is true via #include "<something.h>")


Even if I've read [3], I don't fully understand the real need of this
Printk Index mechanism (at least for my own needs :))


My questions are:
- is my analysis right?
- is the lack of these 2 functionalities (dev_fmt and Printk Index)
expected, when dev_err_probe() is used?
- if not, is it a issue?
- should it be at least documented?


(not sure who to put in copy of this mail)

CJ

[1]:
https://elixir.bootlin.com/linux/v5.19/source/include/linux/dev_printk.h#L143
[2]:
https://elixir.bootlin.com/linux/v5.19/source/include/linux/dev_printk.h#L107
[3]: Documentation/core-api/printk-index.rst

\
 
 \ /
  Last update: 2022-08-06 10:53    [W:0.033 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site