On 9/3/22 15:37, Eugene Shalygin wrote:
On Sun, 4 Sept 2022 at 00:00, Guenter Roeck <linux@xxxxxxxxxxxx> wrote:
What does the name of the struct platform_driver data structure
have to do with __init ?
That's what the modpost warning message suggests:
WARNING: modpost:
/home/eugene/develop/asus-ec-sensors/asus-ec-sensors.o(.data+0x60):
Section mismatch in reference from the variable
asus_ec_sensors_platform_driver to the function
.init.text:asus_ec_probe()
The variable asus_ec_sensors_platform_driver references
the function __init asus_ec_probe()
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console
A driver with a probe function can be unloaded and reloaded manually.
I don't see how you can do that if the functions are marked __init
and the driver is built into the kernel.
Besides that, I _really_ dislike side effect programming.
Guenter