Quantcast
Channel: Active questions tagged linux-kernel - Stack Overflow
Viewing all articles
Browse latest Browse all 12322

Call function of kernal module from another kernal module

$
0
0

I am new in kernel driver development. So i just stuck in that, how can i call function of kernel module from another kernel module. This is my both .c files.

module1.c:

#include<linux/module.h>#include<linux/kernel.h>#include<linux/init.h>int multiplication(int a, int b){    int ans=0;    ans = a * b;    printk(KERN_INFO"Returns the Multiplication to Module2!: %d\n", ans);    return ans;}

module2.c:

#include<linux/module.h>#include<linux/kernel.h>#include<linux/init.h>void calling(){    int a=2,b=3;    int ans=0;    ans = multiplication(a,b) // function of module1.c.    printk(KERN_INFO"Multiplication recieved from Module1!: %d\n", ans);}

I want to call the multiplication function in module2.c from module1.c. How can i do that ? Thanks in advance.


Viewing all articles
Browse latest Browse all 12322

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>