Skip to content

Commit fd748e1

Browse files
draconxmpe
authored andcommitted
macintosh/therm_windtunnel: fix module unload.
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: c6e126d ("of: Keep track of populated platform devices") Signed-off-by: Michael Ellerman <[email protected]> Link: https://msgid.link/[email protected]
1 parent db25a96 commit fd748e1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/macintosh/therm_windtunnel.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ g4fan_exit( void )
549549
platform_driver_unregister( &therm_of_driver );
550550

551551
if( x.of_dev )
552-
of_device_unregister( x.of_dev );
552+
of_platform_device_destroy(&x.of_dev->dev, NULL);
553553
}
554554

555555
module_init(g4fan_init);

0 commit comments

Comments
 (0)