]> Git Repo - linux.git/commitdiff
macintosh/therm_windtunnel: fix module unload.
authorNick Bowler <[email protected]>
Thu, 11 Jul 2024 03:54:17 +0000 (23:54 -0400)
committerMichael Ellerman <[email protected]>
Thu, 11 Jul 2024 07:32:31 +0000 (17:32 +1000)
The of_device_unregister call in therm_windtunnel's module_exit procedure
does not fully reverse the effects of of_platform_device_create in the
module_init prodedure.  Once you unload this module, it is impossible
to load it ever again since only the first of_platform_device_create
call on the fan node succeeds.

This driver predates first git commit, and it turns out back then
of_platform_device_create worked differently than it does today.
So this is actually an old regression.

The appropriate function to undo of_platform_device_create now appears
to be of_platform_device_destroy, and switching to use this makes it
possible to unload and load the module as expected.

Signed-off-by: Nick Bowler <[email protected]>
Fixes: c6e126de43e7 ("of: Keep track of populated platform devices")
Signed-off-by: Michael Ellerman <[email protected]>
Link: https://msgid.link/[email protected]
drivers/macintosh/therm_windtunnel.c

index 37cdc6931f6d02cc435be824304a94c68ddde50d..2576a53f247eaa549b4bd212c27bc8a8f9ce1470 100644 (file)
@@ -549,7 +549,7 @@ g4fan_exit( void )
        platform_driver_unregister( &therm_of_driver );
 
        if( x.of_dev )
-               of_device_unregister( x.of_dev );
+               of_platform_device_destroy(&x.of_dev->dev, NULL);
 }
 
 module_init(g4fan_init);
This page took 0.051686 seconds and 4 git commands to generate.