I have an out-of-tree kernel module for my device, which is configured through devicetree. The problem is that when the system boots the module does not get loaded by the kernel.
The only option to load it is to manually call modprobe mymodule, then kernel finds it (it is installed under /lib/modules/5.15.71+g95448dd0dc9b/extra/) and loads it correctly.
Here is a devicetree entry:
&fspi {
mydevice: mydevice@0 {
compatible = "mycompany,mydriver";
spi-max-frequency = <1000000>;
spi-rx-bus-width = <4>; /* 1 SPI Rx lines */
spi-tx-bus-width = <4>; /* 1 SPI Tx line */
reg = <0>;
#address-cells = <1>;
#size-cells = <1>;
status = "okay";
};
};
As well as part of my driver:
static const struct of_device_id mydriver_of_table[] = {
{ .compatible = "mycompany,mydriver" },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, mydriver_of_table);
static struct spi_mem_driver mydriver_driver = {
.spidrv = {
.driver = {
.name = "mydriver",
.of_match_table = mydriver_of_table
},
},
.probe = mydriver_probe,
.remove = mydriver_remove
};
module_spi_mem_driver(mydriver_driver);
In my opinion everything looks fine, especially given the fact that when I manually call modprobe the driver is loaded correctly. What can be wrong here? Does the fact that the module is out of tree impact the module loading process?