I have two Linux kernel modules, one of which may provide some function to another. But use of that function is not essential, the second module may (and should) work even if the first module is not present.
If I just export the function from the first module and use it in second module, the second module depends on that symbol and can't be loaded without first module.
One of the solutions is to have user script that looks into /proc/kallsym for the function in the first module, and if it's present there, the script passes its address as a parameter to the second module, which then makes pointer out of it. But I don't like that solution for obvious reasons.
If there more correct and elegant solution that will allow second module go get address of some symbol in the first module, but avoid hard dependency ?