Re: How does module_init(jpeg_init) get called

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx> 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@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux