I have developped a kernel module to manage a nf4 tag as a char device.
I have developped this module outside of the kernel and tested it compiled as a loadable kernel module (i.e. .ko) during the development phase.
Once the driver has been functional and stable enough I have inserted it into linux kernel source (v4.9.30) using patches so it's built as part of the kernel.
Here I'm in the situation where the module is loaded probed at boot by kernel as it's builtin and it appears into the device tree.
Now, I would like to try some improvements on the driver and I don't want to implement those changes directly into the kernel.
So I would like to keep the driver's code integrated into linux kernel but not having it inserted at boot.
To do this I have just changed the driver's status field with status = "disable";
into the device-tree and indeed the module is not inserted anymore at boot.
However I can't insert the loadable module which as been modified. I'm having a ENODEV
at insertion which is due to the platform_device not beeing found into the probe function.
What I don't understand is why the platform device is not beeing found when the device-tree hasn't been changed except for status field value.
EDIT: Add precisions about the situation
After some more exploring I have to precise that I'm not even entering the callback nf4_probe
.
After checking platform_driver_probe
implementation (see here) into v4.9.30 kernel source it seems that the error comes from here:
if (code == 0 && list_empty(&drv->driver.p->klist_devices.k_list))
retval = -ENODEV;
By checking the device-tree from the command line I can see that the device is defined as the directory /proc/device-tree/nf4tag
exists and is filled with values corresponding to those into the device-tree.
EDIT: Add precisions about the aim of the question after @sawdust's answer
I was apparently misunderstanding that status=disable
meant that the device wasn't present at all on the hardware configuration. Though it was just describing weither the driver should be probed or not.
To make my objective clearer I precise that I do have the driver coded as proper module and compiled as a loadable module for the kernel I'm using.
However I don't want to recompile the kernel to test every change I do. So my aim is to recompile only the .ko until my modifications are made and then, once everything has been done, add those modifications to the builtin moduleusing a patch.
With this way of working I can just rebuild the .ko and insert it on my target platform instead of recompiling a kernel for each modification.
So to resume my question should have been:
How to replace a builtin module with a loadable one without recompiling kernel to disable the builtin module?
Maybe there isn't a solution for this aim except disabling builtin module compiling onto kernel.