Linux kernel 结构模块如何在内核中工作
我已经编写了一个中断驱动程序linux 3.8版供学习。我正在使用一些gpio API,例如Linux kernel 结构模块如何在内核中工作,linux-kernel,linux-device-driver,Linux Kernel,Linux Device Driver,我已经编写了一个中断驱动程序linux 3.8版供学习。我正在使用一些gpio API,例如 gpio_request(gpioButton, "mypreciousss"); // Set up the gpioButton 当我在这个gpio_请求中看到它正在使用 if (!try_module_get(chip->owner)) 这里chip->owner是一个struct module类型变量 gpio\u请求是我的init函数中的第一个函数,我没有创建struct
gpio_request(gpioButton, "mypreciousss"); // Set up the gpioButton
当我在这个gpio_请求中看到它正在使用
if (!try_module_get(chip->owner))
这里chip->owner是一个struct module类型变量
gpio\u请求是我的init函数中的第一个函数,我没有创建struct模块。
那么,try\u module\u get如何使用它呢?在这里,我将粘贴函数
gpio\u request()
(linux 3.8)中的代码片段
这里,他们使用与传递的GPIO相对应的描述符,该描述符结构用于进一步更新。问题不是用英语写的,请找人翻译。猜猜你在问什么,我可以假设你没有在你的帖子中得到第二个例子。这基本上是引用计数。当请求GPIO线路时,禁止删除控制器驱动程序。您是盲人还是哑巴?
desc = &gpio_desc[gpio];
chip = desc->chip;
if (chip == NULL)
goto done;
if (!try_module_get(chip->owner))
goto done;