LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (http://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   problem with compiler warnings (http://www.linuxquestions.org/questions/linux-kernel-70/problem-with-compiler-warnings-730101/)

rheosiva 06-02-2009 05:19 AM

problem with compiler warnings
 
i am having two driver modules..
i have a "write_init" function inside first driver module.
i have given the following export option to export this function in kernel space..
EXPORT_SYMBOL_GPL(write_init);

Now i have used write_init function in second driver module. which is working properly. but while compiling the second driver module it showings compiler warnings below..

*** Warning: "write_init" undefined...

all the functionality is working though i need to overcome with this warnings any ideas.. i have given proper extern statements also...

harry edwards 06-03-2009 03:49 PM

Can you post your code? Or, a subset of it.

rheosiva 06-04-2009 04:37 AM

Hi Harry,

please see the code below...

i am having two modules say module A and module B..

In module A:
init_vvv_module()
{
// module initialization....
}
clean_vvv_module()
{
// module exit code....
}

int write_init(int option, int value)
{
//Some code invocation... i have done it here...
}

EXPORT_SYMBOL_GPL(write_init);
module_init(init_vvv_module);
module_exit(clean_vvv_module);
MODULE_AUTHOR("XXXXXXXXXXXXXXXXXXXXXXXXXXX");
MODULE_DESCRIPTION("YYYYYYYYYYYYYYYYYYYYYY.");
MODULE_LICENSE("GPL");


In Module B:
init_xxx_module()
{
here i am using that write_init(); guessing that while loading module kernel can find the function... because i have done EXPORT_SYMBOL_GPL(write_init);...
}

now the expected functionality is working fine...
Problem is while compiling Module B.. it shows warnings write_init undefined..
i have given the extern also.. but still showing the warnings..
This i need to rectify...
UR suggestion may helpfull to me..

harry edwards 06-04-2009 04:14 PM

I have never done a kernel module; but, from my experience I think the error you are getting means the function in not defined in a header file. For example:

Modulea.h

Code:

int write_init(int option, int value);
Module2.c

Code:

#include "Modulea.h"

nit_xxx_module()
{
here i am using that write_init(); guessing that while loading module kernel can find the function... because i have done EXPORT_SYMBOL_GPL(write_init);...
}


.....

I hope that helps in some way/

rheosiva 06-05-2009 06:24 AM

Sorry harry..
Eventhough i have included the file moduleA's .h file. Also that moduleA's.h has extern of the write_init function. it didnt work properly..
So i am trying to find some other way..

Thanks for Reply... :)


All times are GMT -5. The time now is 10:37 AM.