linux 内核中的 b/w __raw_readl/__raw_writel 和 readl/writel 有什么区别?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9818657/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What's the difference b/w __raw_readl/__raw_writel and readl/writel in linux kernel?
提问by Yifan Zhang
What's the difference b/w __raw_readl/__raw_writel
and readl/writel
in linux kernel? It is said readl/writel
is safer than __raw_readl/__raw_writel
, then why do we still use __raw_readl/__raw_writel
?
b/w__raw_readl/__raw_writel
和readl/writel
linux 内核有什么区别?都说readl/writel
比安全__raw_readl/__raw_writel
,那为什么还要用__raw_readl/__raw_writel
呢?
Under what circumstances should we use this: __raw_readl/__raw_writel
or readl/writel
?
在什么情况下我们应该使用 this:__raw_readl/__raw_writel
或readl/writel
?
采纳答案by blueshift
It seemsto be the case that
这似乎到的情况是,
- raw denotes native byte ordering, non-raw means little-endian
- the __ prefix alternatives don't include memory barriers
- raw 表示本机字节顺序,非原始表示小端
- __ 前缀替代方案不包括内存屏障
See this LKML discussionand also the comments in linux/arch/arm/include/asm/io.h