How does module_init(jpeg_init) get called
Miles MH Chen
orca.chen at gmail.com
Thu Jan 9 11:15:59 EST 2014
Hello Michael,
The module_init call is defined as device_initcall, which is one of kernel
inicalls.
All initcalls are put to initcall section and kernel calls all initcalls at
boot time.
You can check this in your vmlinux:
ffffffff81765ed8 T __initcall_start
ffffffff81765ed8 T __setup_end
ffffffff81765ee0 t __initcall_trace_init_flags_sys_exitearly
ffffffff81765ee8 t __initcall_trace_init_flags_sys_enterearly
ffffffff81765ef0 t __initcall_init_hw_perf_eventsearly
ffffffff81765ef8 t __initcall_register_trigger_all_cpu_backtraceearly
ffffffff81765f00 t __initcall_spawn_ksoftirqdearly
ffffffff81765f08 t __initcall_init_workqueuesearly
ffffffff81765f10 t __initcall_check_cpu_stall_initearly
ffffffff81765f18 t __initcall_migration_initearly
...
kernel calls do_initcalls in do_basic_setup
783 static void __init
do_basic_setup(void)
784
{
785
cpuset_init_smp();
786
usermodehelper_init();
787
shmem_init();
788
driver_init();
789
init_irq_proc();
790
do_ctors();
791
usermodehelper_enable();
*792 do_initcalls(); *
793
random_int_secret_init();
794 }
Regards,
MH
On Thu, Jan 9, 2014 at 10:25 AM, m silverstri <
michael.j.silverstri at gmail.com> wrote:
> Hi,
>
> In a kernel driver code, I see it has 'module_init(jpeg_init)' and
> 'module_exit(jpeg_exit)'. I would like how know how will
> jpeg_init(void) gets call during kernel bring up.
>
> As an example:
> static int __init jpeg_init(void)
> {
> printk(KERN_CRIT "Initialize JPEG driver\n");
>
> platform_driver_register(&jpeg_driver);
>
> return 0;
> }
>
> static void __exit jpeg_exit(void)
> {
> platform_driver_unregister(&jpeg_driver);
> }
>
> module_init(jpeg_init);
> module_exit(jpeg_exit);
>
> Thank you.
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140110/979e03ab/attachment.html
More information about the Kernelnewbies
mailing list