当前位置:网站首页>printk学习之(三):你还在用printk吗?
printk学习之(三):你还在用printk吗?
2022-06-10 09:02:00 【Andy Pines】
1.printk的继任者pr_xxx系列函数
前面两节我们介绍了printk的基本原理和printk在驱动调试中的用法,现在我们看一下printk的继任者,pr_xxx系列函数
可以看到,如果没有定义pr_fmt(fmt),那么pr_fmt(fmt)就是fmt,这样的话pr_xxx系列函数仅仅是一个printk的简单封装
但是精髓在于可以自己定义pr_fmt(fmt),让我们封装成自己的打印函数,方便调试
... ...
#ifndef pr_fmt
#define pr_fmt(fmt) fmt
#endif
/*
* These can be used to print at the various log levels.
* All of these will print unconditionally, although note that pr_debug()
* and other debug macros are compiled out unless either DEBUG is defined
* or CONFIG_DYNAMIC_DEBUG is set.
*/
#define pr_emerg(fmt, ...) \
printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
#define pr_alert(fmt, ...) \
printk(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__)
#define pr_crit(fmt, ...) \
printk(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__)
#define pr_err(fmt, ...) \
printk(KERN_ERR pr_fmt(fmt), ##__边栏推荐
- uni-app_ Configure network request in wechat applet development project (third-party package @escook/request miniprogram)
- All the contents of the page in row units are segmented in rows
- Task04:集合运算
- USB type -a -b -c interface
- Summary of MATLAB error reporting
- texstudio 显示行号和不检查拼写设置
- Latex基本语法备注
- Linear Regression
- Qt sqlite操作笔记
- Mmsegment Series III (basic network architecture and pre training model)
猜你喜欢

Level 18 of leetcode Langya list - sum of two numbers (lookup table method)

Textstudio displays line numbers and does not check spelling settings

Rotate linked list

MFC窗口增加状态栏的方法

乐鑫对 Zephyr 的最新支持

LeetCode琅琊榜第十九层-有效的括号

微信小程序组件observers【监听器】中使用this报错undefined

wechat_ Configuration of wechat applet subcontracting

How knowledge atlas, graph data platform and graph technology help the rapid development of retail industry

对线HR_MySQL存储引擎,原来是这样啊
随机推荐
win11安装texlive 2021版本
Reference counting and smart pointer for VTK learning
RunLoop的实际使用
接触式IC卡 - STM32(Smart Card)
对线HR_MySQL逻辑架构?就这?
Huawei software test interview question | a Huawei successful employee's sharing [written examination question]
It only takes eight steps to package the applet to generate an app
Textstudio displays line numbers and does not check spelling settings
Actual use of runloop
The pipelineexecute pipeline execution process of VTK learning
vscode-markdown all in one-keyboard shortcut
The R language uses the CS function of epidisplay package to calculate the value and confidence interval of relative risk (RR), generate the grouping data of exposure factor based on the pyramid funct
All the contents of the page in row units are segmented in rows
Redis configuration optimization
wechat_ Configuration of wechat applet subcontracting
js獲取當前時間
MainActivity
从零到一,一站式解决Linux环境下的MySQL(下载篇)
SAAS服务能有哪些优势
Simple operation and debugging of GPIO in Qualcomm platform