This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to Change the order of probe() in Linux?

Hi All,

I have Linux kernel 2.6.37 Running on TI's DM365 platform. Devices are getting registered and initialized via probe() call. I added a device & it is getting registered and probed by the kernel properly.

Now due to some dependencies, I want to change the order of calling this probe() by kernel.

i.e I want to call my probe() function at the end of all other pre existing probe() calls.

Appreciate any help on this.

  • Hi,

    Are you aware how and from where probe is called ? you cannot defer the probe call directly for that you need to defer the module_init() call by replacing it to late_initcall() so that your probe gets deferred, alternatively if your probe is looking for some resource and which is not present at probe time you can use probe deferral mechanism by returning -EPROBE_DEFER.

    Regards,

    --Prabhakar Lad

    http://www.linkedin.com/in/prabhakarlad

  • Hi Prabhakar lad,

    Thanks for the reply.

    I will try out this.

  • Hi Prabhakar Lad,

    I tried late_initcall()  instead of module_init(). My kernel boot up, but forgets to load my module which contains late_initcall() !!. I kept some printk in the function, which are not getting printed in this case. But if I do normat module_init() this prints are visble and module loads properly.

    Since I have dependency between module-A and module-B. I need to load module-A before module-B. So I thought to load Module-A much before module-B using early_initcall(). But, my kernel stops  at

    un Compressing Linux....................... .

    So, problem still exists .. I don like to build my driver as modules and load later. I wnt it as inbuilt only.

    Any hints?

  • Hi,

    I tried late_initcall()  instead of module_init(). My kernel boot up, but forgets to load my module which contains late_initcall() !!. I kept some printk in the function, which are not getting printed in this case. But if I do normat module_init() this prints are visble and module loads properly.

    That should not have happened, may be you are missing something please recheck.

    your module A must be module_init() and module B must be late_initcall().

    Since I have dependency between module-A and module-B. I need to load module-A before module-B. So I thought to load Module-A much before module-B using early_initcall(). But, my kernel stops  at

    un Compressing Linux....................... .

    Thats obvious early_initcall() is too early because of which it crashed and hung.

    Alternatively if both the modules are in same directory you can do it using Makefile,

    put compilation of  module A at the top and then the module B, but its environment dependent

    but worth give a try.

    Regards,

    --Prabhakar Lad