Question: dev_err_probe() vs Printk Index

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread 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



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux