<div dir="ltr"><div><div><div>Hello Michael,<br><br></div>The module_init call is defined as device_initcall, which is one of kernel inicalls.<br></div>All initcalls are put to initcall section and kernel calls all initcalls at boot time.<br>
<br>You can check this in your vmlinux:<br><br>ffffffff81765ed8 T __initcall_start<br>ffffffff81765ed8 T __setup_end<br>ffffffff81765ee0 t __initcall_trace_init_flags_sys_exitearly<br>ffffffff81765ee8 t __initcall_trace_init_flags_sys_enterearly<br>
ffffffff81765ef0 t __initcall_init_hw_perf_eventsearly<br>ffffffff81765ef8 t __initcall_register_trigger_all_cpu_backtraceearly<br>ffffffff81765f00 t __initcall_spawn_ksoftirqdearly<br>ffffffff81765f08 t __initcall_init_workqueuesearly<br>
ffffffff81765f10 t __initcall_check_cpu_stall_initearly<br>ffffffff81765f18 t __initcall_migration_initearly<br>...<br><br></div>kernel calls do_initcalls in do_basic_setup<br><div><br>783 static void __init do_basic_setup(void)                                                                                         <br>
784 {                                                                                                                               <br>785         cpuset_init_smp();                                                                                                      <br>
786         usermodehelper_init();                                                                                                  <br>787         shmem_init();                                                                                                           <br>
788         driver_init();                                                                                                          <br>789         init_irq_proc();                                                                                                        <br>
790         do_ctors();                                                                                                             <br>791         usermodehelper_enable();                                                                                                <br>
<span style="color:rgb(255,0,0)"><b>792         do_initcalls();   </b></span>                                                                                                      <br>793         random_int_secret_init();                                                                                               <br>
794 }<br><br></div><div>Regards,<br>MH<br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jan 9, 2014 at 10:25 AM, m silverstri <span dir="ltr">&lt;<a href="mailto:michael.j.silverstri@gmail.com" target="_blank">michael.j.silverstri@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
In a kernel driver code, I see it has &#39;module_init(jpeg_init)&#39; and<br>
&#39;module_exit(jpeg_exit)&#39;.  I would like how know how will<br>
jpeg_init(void) gets call during kernel bring up.<br>
<br>
As an example:<br>
static int __init jpeg_init(void)<br>
{<br>
printk(KERN_CRIT &quot;Initialize JPEG driver\n&quot;);<br>
<br>
platform_driver_register(&amp;jpeg_driver);<br>
<br>
return 0;<br>
}<br>
<br>
static void __exit jpeg_exit(void)<br>
{<br>
platform_driver_unregister(&amp;jpeg_driver);<br>
}<br>
<br>
module_init(jpeg_init);<br>
module_exit(jpeg_exit);<br>
<br>
Thank you.<br>
<br>
_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
</blockquote></div><br></div>