2011年7月1日 星期五

[Linux] callback function

Callback function
The program did "call" the function is initiative, but "callback" function is passive. For example, interrupt handler or event handler was called in some specific situations, they were "callback" functions.
The implementation for callback function is typically a function point in C.

The use of function point is like an abstraction layer. Every driver has to implement the same functions, just like r8169.c ethernet driver must implement the functions related to the pci_driver struct needed.


static struct pci_driver rtl8169_pci_driver = {
        .name           = MODULENAME,
        .id_table       = rtl8169_pci_tbl,
        .probe          = rtl8169_init_one,
        .remove         = __devexit_p(rtl8169_remove_one),
#ifdef CONFIG_PM
        .suspend        = rtl8169_suspend,
        .resume         = rtl8169_resume,
        .shutdown       = rtl_shutdown,
#endif
};

沒有留言:

張貼留言