2014-03-24 78 views
0

我開發了一個用於我的custom_hardware的工作驅動程序,它依賴於設備樹。因爲我的驅動程序可能會發展,所以我不希望我的驅動程序成爲內核的一部分(當我說'成爲內核的一部分'時,我的意思是,在內核創建期間與內核一起編譯)在設備樹探測之前加載內核模塊

這裏是我DTS的一瞥:

custom_hardware: [email protected] { 
    compatible = "mfg,custom"; 
    reg = <0x41006000 0x1000>; 
    #interrupt-cells = <0x1>; 
    interrupt-controller; 
}; 

existing_hardware: [email protected] { 
    compatible = "mfg,existing"; 
    reg = <0x41004000 0x1000>; 
    interrupt-parent = <&custom_hardware>; 
    interrupts = <0>; 
}; 

existing_hardware的司機已經與內核編譯(該existing_hardware的司機已經被編譯到內核創建過程中的內核)。

我想這樣做是爲了我的custom_hardware的司機到RAMFS並讓內核裝載custom_hardware「追加之前的existing_hardware的司機的司機。

這很重要,因爲existing_hardware的司機請求從custom_hardwareirq_domain一個virq的驅動程序。爲了獲得irq_domain,必須首先加載custom_hardware的驅動程序。

請注意,existing_hardware的驅動程序在探測內核啓動序列的早期階段似乎發生的設備樹期間被加載。

+0

您似乎高估了要求。 *「我不希望我的驅動程序成爲內核的一部分。」* *「在設備樹探測器之前加載內核模塊」。*似乎唯一突出的要求是* custom_hardware *驅動程序需要先安裝* existing_hardware *驅動程序,可以在現有框架內完成。看到這個** [Q&A](http://stackoverflow.com/questions/15541290/what-is-the-difference-between-module-init-and-subsys-initcall-while-initializin/15542788#15542788)** – sawdust

回答

0

這不是要做的。模塊/驅動程序的加載順序無關緊要。在獲取existing_hardware中的IRQ失敗時,您需要做的是返回-EPROBE_DEFER。然後它會在稍後再次被探測,希望在custom_hardware被探測後。

此外,您還可以應用補丁,這將確保request_irq()失敗,因爲域名不存在但在那種情況下返回-EPROBE_DEFER https://lkml.org/lkml/2014/2/13/114