转载 usb_alloc_coherent 和 usb_free_coherent
今天做移植的时候,随手记录一下,今天所遇到的问题解决方法。
在linux2.6.34和之前的代码中还可以使用usb_buffer_alloc 和 usb_buffer_free 这两个函数,在2.6.35和之后的内核中
usb_buffer_alloc 和 usb_buffer_free这两个函数已不在使用了,可以用usb_alloc_coherent 和 usb_free_coherent代替。把驱动里分配内存与释放内存释放函数修改就好了。
这是rename的patch:
USB: rename usb_buffer_alloc() and usb_buffer_free()
For more clearance what the functions actually do,
usb_buffer_alloc() is renamed to usb_alloc_coherent()
usb_buffer_free() is renamed to usb_free_coherent()
They should only be used in code which really needs DMA coherency.
[added compatibility macros so we can convert things easier - gregkh]
Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Pedro Ribeiro <pedrib@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
说是为了更好的从名字看出这个函数真实做的事情:DMA coherency
linux提供两种方式,来保证使用dma时,内存和硬件cache的一致性:
1.Coherent DMA mapping
When using this mapping, the kernel ensures that there will be no cache coherency problems between the memory and the hardware device; this means that every write operation performed by the CPU on a RAM location is immediately visible to the hardware device, and vice versa. This type of mapping is also called "synchronous" or "consistent."
2.Streaming DMA mapping
When using this mapping, the device driver must take care of cache coherency problems by using the proper synchronization helper functions. This type of mapping is also called "asynchronous" or "non-coherent."
如果采用第一种方式的话,就是由kernel来保证一致性,驱动程序是不用考虑的,这种方法的缺点是在某些体系结构上,效率很低;如果采用第二种方式的话,那么是有驱动程序来保证一致性的,所以当驱动要使用dma来进行数据传输时,必须首先检测内存和硬件cache的一致性,linux提供了这类方法。
转载 usb_alloc_coherent 和 usb_free_coherent的更多相关文章
- Crystal Clear Applied: The Seven Properties of Running an Agile Project (转载)
作者Alistair Cockburn, Crystal Clear的7个成功要素,写得挺好. 敏捷方法的关注点,大家可以参考,太激动所以转载了. 原文:http://www.informit.com ...
- RTP与RTCP协议介绍(转载)
RTSP发起/终结流媒体.RTP传输流媒体数据 .RTCP对RTP进行控制,同步.RTP中没有连接的概念,本身并不能为按序传输数据包提供可靠的保证,也不提供流量控制和拥塞控制,这些都由RTCP来负责完 ...
- 《Walking the callstack(转载)》
本文转载自:https://www.codeproject.com/articles/11132/walking-the-callstack Download demo project with so ...
- [转载]MVVM模式原理分析及实践
没有找到很好的MVVM模式介绍文章,简单找了一篇,分享一下.MVVM实现了UI\UE设计师(Expression Blend 4设计界面)和软件工程师的合理分工,在SilverLight.WPF.Wi ...
- [转载]:STM32为什么必须先配置时钟再配置GPIO
转载来源 :http://blog.csdn.net/fushiqianxun/article/details/7926442 [原创]:我来添两句,就是很多同学(包括我)之前搞低端单片机,到了stm ...
- [转载]从MyEclipse到IntelliJ IDEA-让你摆脱鼠标,全键盘操作
从MyEclipse转战到IntelliJ IDEA的经历 注转载址:http://blog.csdn.net/luoweifu/article/details/13985835 我一个朋友写了一篇“ ...
- TCP同步与异步,长连接与短连接【转载】
原文地址:TCP同步与异步,长连接与短连接作者:1984346023 [转载说明:http://zjj1211.blog.51cto.com/1812544/373896 这是今天看到的一篇讲到T ...
- 在CentOS 7/6.5/6.4 中安装Java JDK 8(转载)
转载在CentOS 7/6.5/6.4 中安装Java JDK 8 首先,在你的服务器上运行一下更新. yum update 然后,在您的系统上搜索,任何版本的已安装的JDK组件. rpm -qa | ...
- 用C#实现MD5的加密(转载)
方法一 首先,先简单介绍一下MD5 MD5的全称是message-digest algorithm 5(信息-摘要算法,在90年代初由mit laboratory for computer scien ...
随机推荐
- JS基础学习2
1.CMAScript 运算符 算数运算符 递增(++).递减(--) var i=15; console.log(i++); console.log(i); var i1=15; console.l ...
- 【Tomcat】Tomcat配置JVM参数步骤
这里向大家描述一下如何使用Tomcat配置JVM参数,Tomcat本身不能直接在计算机上运行,需要依赖于硬件基础之上的操作系统和一个java虚拟机.您可以选择自己的需要选择不同的操作系统和对应的JDK ...
- Java反射通过getter和setter方法实现类的拷贝
private User copyFieldValues(User userData, User user) { Field[] fields = user.getClass().getDeclare ...
- 使用Object.prototype.toString.call()方法精确判断对象的类型
在JavaScript里使用typeof判断数据类型,只能区分基本类型,即:number.string.undefined.boolean.object. 对于null.array.function. ...
- [LeetCode] Smallest Rotation with Highest Score 得到最高分的最小旋转
Given an array A, we may rotate it by a non-negative integer K so that the array becomes A[K], A[K+1 ...
- swust oj 981
统计利用二叉树存储的森林中树的棵数 1000(ms) 10000(kb) 2919 / 5436 普通树及其构成的森林均可转换成相应的二叉树,反之亦然.故而可以根据相应的转换方法去统计某一二叉树对应的 ...
- 一般处理程序(ashx)的使用
ASP.NET 中发送请求的页面代码如下: <head runat="server"> <title></title> <script s ...
- Java自学笔记
1.标识符:字母,数字,下划线,美元符组成,不可以已数字开头,并且严格区分大小写 2.变量 有三个元素描述变量,变量类型,变量名,变量值 如何命名变量:首字母为 字母:下划线:“$“符号,其余部分为 ...
- python菜鸟学习心得
禁忌:学习没精力,就是没精打采.没有热情. 禁忌:学习一半,然后,放在一边. 禁忌:不要东一榔头,西一棒锤. 禁忌:学习要用心. 激情是动力,专注是效率 每次学习都是绕着网络转了一圈.还是要一步一个脚 ...
- 杂_小技巧_将网页上的内容通过亚马逊邮箱传到kindle中
所需条件 1.kindle要联网 2.要有亚马逊邮箱 3.要有微信,电脑上或者手机上 操作步骤: 1.找到你想要传送到kindle上的文章网页 2.在微信中关注“亚马逊kindle服务号”并且按照里边 ...