Message ID | 20240711035428.16696-1-nbowler@draconx.ca (mailing list archive) |
---|---|
State | Accepted |
Commit | fd748e177194ebcbbaf98df75152a30e08230cc6 |
Headers | show |
Series | macintosh/therm_windtunnel: fix module unload. | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/github-powerpc_sparse | success | Successfully ran 4 jobs. |
snowpatch_ozlabs/github-powerpc_clang | success | Successfully ran 5 jobs. |
snowpatch_ozlabs/github-powerpc_kernel_qemu | success | Successfully ran 21 jobs. |
On Wed, 10 Jul 2024 23:54:17 -0400, Nick Bowler wrote: > 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. > > [...] Applied to powerpc/next. [1/1] macintosh/therm_windtunnel: fix module unload. https://git.kernel.org/powerpc/c/fd748e177194ebcbbaf98df75152a30e08230cc6 cheers
diff --git a/drivers/macintosh/therm_windtunnel.c b/drivers/macintosh/therm_windtunnel.c index 37cdc6931f6d..2576a53f247e 100644 --- a/drivers/macintosh/therm_windtunnel.c +++ b/drivers/macintosh/therm_windtunnel.c @@ -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);
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 <nbowler@draconx.ca> Fixes: c6e126de43e7 ("of: Keep track of populated platform devices") Cc: Pawel Moll <pawel.moll@arm.com> --- drivers/macintosh/therm_windtunnel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)