API between modules
Greg KH
greg at kroah.com
Thu May 18 06:33:56 EDT 2023
On Thu, May 18, 2023 at 08:16:18AM +0100, Lucas Tanure wrote:
> Hi,
>
> I have two kernel modules that need to talk over an API, and right
> now, they are statically linked together, but I am looking for a
> better way to separate them and share an API between them.
>
> A few years ago, I did the HDA component:
> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/sound/pci/hda/hda_component.h
>
> Using the component API:
> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/include/linux/component.h
>
> Are there other ways for a module to wait for another module to load
> and use its API?
> Is there a default way to do that?
Yes, just call a function in that other module and it will be loaded
properly before your module can call it. That's how all in-kernel apis
work.
thanks,
greg k-h
More information about the Kernelnewbies
mailing list