当前位置:网站首页>Two common methods and steps of character device registration
Two common methods and steps of character device registration
2022-07-03 00:28:00 【Do you want to buy vegetables!】

static int __init RK_irq_init(void)
{
/* 1、 Build device number */
if (RK_irq.major) {
RK_irq.devid = MKDEV(RK_irq.major, 0);
register_chrdev_region(RK_irq.devid, RK_IRQ_CNT, RK_IRQ_NAME);
} else {
alloc_chrdev_region(&RK_irq.devid, 0, RK_IRQ_CNT, RK_IRQ_NAME);
RK_irq.major = MAJOR(RK_irq.devid);
RK_irq.minor = MINOR(RK_irq.devid);
}
/* 2、 Register character device */
cdev_init(&RK_irq.cdev, &RK_irq_fops);
cdev_add(&RK_irq.cdev, RK_irq.devid, RK_IRQ_CNT);
/* 3、 Create a class */
RK_irq.class = class_create(THIS_MODULE, RK_IRQ_NAME);
if (IS_ERR(RK_irq.class)) {
return PTR_ERR(RK_irq.class);
}
/* 4、 Create device */
RK_irq.device = device_create(RK_irq.class, NULL, RK_irq.devid, NULL, RK_IRQ_NAME);
if (IS_ERR(RK_irq.device)) {
return PTR_ERR(RK_irq.device);
}
/* 5、 Start button */
atomic_set(&RK_irq.keyvalue, INVAKEY);
atomic_set(&RK_irq.releasekey, 0);
keyio_init();
return 0;
}
边栏推荐
- 字符设备注册常用的两种方法和步骤
- Bypass AV with golang
- [reading notes] phased summary of writing reading notes
- 【雅思阅读】王希伟阅读P1(阅读判断题)
- 免费自媒体必备工具分享
- What are the recommended thesis translation software?
- University of Toronto:Anthony Coache | 深度强化学习的条件可诱导动态风险度量
- How QT exports data to PDF files (qpdfwriter User Guide)
- Form form instantiation
- How to write the design scheme of the thesis?
猜你喜欢

哪些软件可以整篇翻译英文论文?

Install docker and use docker to install MySQL

带角度的检测框 | 校准的深度特征用于目标检测(附实现源码)

监控容器运行时工具Falco

写论文可以去哪些网站搜索参考文献?

130 pages of PPT from the brick boss introduces the new features of Apache spark 3.2 & 3.3 in depth
![[shutter] Introduction to the official example of shutter Gallery (learning example | email application | retail application | wealth management application | travel application | news application | a](/img/f2/f3b8899aa774dd32006c5928d370f1.gif)
[shutter] Introduction to the official example of shutter Gallery (learning example | email application | retail application | wealth management application | travel application | news application | a
![[shutter] open the third-party shutter project](/img/1a/e35d0180612d7e79b55e7818193740.jpg)
[shutter] open the third-party shutter project

Automated defect analysis in electron microscopic images-论文阅读笔记

请问大家在什么网站上能查到英文文献?
随机推荐
Mutual exclusion and synchronization of threads
带角度的检测框 | 校准的深度特征用于目标检测(附实现源码)
setInterval定时器在ie不生效原因之一:回调的是箭头函数
详解用OpenCV的轮廓检测函数findContours()得到的轮廓拓扑结构(hiararchy)矩阵的意义、以及怎样用轮廓拓扑结构矩阵绘制轮廓拓扑结构图
Multi process programming (III): message queue
Which websites can I search for references when writing a thesis?
[shutter] image component (image component introduction | image constructor | image.network constructor | image.asset constructor)
Bloom filter
SQL query statement parameters are written successfully
Solution to the problem of abnormal display of PDF exported Chinese documents of confluence
LeedCode1480. Dynamic sum of one-dimensional array
秒杀系统设计
Talk with the interviewer about the pit of MySQL sorting (including: duplicate data problem in order by limit page)
NC50965 Largest Rectangle in a Histogram
Architecture: database architecture design
Nc50528 sliding window
关于Unity屏幕相关Screen的练习题目,Unity内部环绕某点做运动
About the practice topic of screen related to unity screen, unity moves around a certain point inside
Pytorch 20 realizes corrosion expansion based on pytorch
TypeError: Cannot read properties of undefined (reading ***)