How to write Linux driver module call/use another driver module?

后端 未结 2 1393
囚心锁ツ
囚心锁ツ 2021-02-04 05:38

I\'m developing a Linux driver loadable module and I have to use another device in my driver.(kind of driver stacked on another driver)

How do I call/use another driver

2条回答
  •  天涯浪人
    2021-02-04 06:10

    You forgot to mention that you should also study try_module_get/module_put/symbol_get/symbol_put/symbol_request, for ensuring loading of the other module, and the fact that it is not unloaded during usage. I don't recall the exact details though; I think that modprobe will ensure the other module is loaded, but I'm not sure if the runtime dependency for unloading will be added. I guess that those APIs might be needed for some other cases, but needs to know about them to check this.

    Btw, the free book Linux Device Drivers is available here, and it will answer this question and much more: http://lwn.net/Kernel/LDD3/

提交回复
热议问题