linux_kselftest-kunit-fixes-6.8-rc5
This KUnit update for Linux 6.8-rc5 consists of one important fix to unregister kunit_bus when KUnit module is unloaded. Not doing so causes an error when KUnit module tries to re-register the bus when it gets reloaded. -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEPZKym/RZuOCGeA/kCwJExA0NQxwFAmXMAnoACgkQCwJExA0N Qxy7UA//bP1Igj6osQfBjpR+RRyI3x069Z6zFRKmMglsyXnG2OTmTECGFTKbXPWf TX6UVc6iwcYTZzu2n/Xn7+smS4x3kUzYYUUhwtQzgm8Cape/XpQV3s32rYFO7XVs KH1QpB38wHibW+8YiBuluAfNTsjEYqlhVGIBPfmsG9jP+sm7y+yFiIu4Eo/JwCTa 0KM4s+OFMcvC13RegOvK/mvBqqhcM7U3lMWQhRjLEXi0OjO65S4prTpM0NMO56Ar d8KNX718BvDY9MyihwioFE4VEIMIBNeqbzx1nbCFu7cUSS0n+VWK+41CeJBuYitm ub/meRILtAHbV9+9SY1REqIIrsWSC7v/+fbG05YOnTIMfVV1Ye1XvBZoJLAmiAGz VR1JbDbuk9xfwKU48NIS8CqH7VJjM74Rl3GJh0Meyn833BYHIfVHkRlLjBbiNDG5 qac0XyH3vRHvp4Ud3PAmLa8e3QDo5HIHDkvBag4XOrzKdHpcBAGghrNWbGbipaKI 7BTyvWu5c5riVo1GN81JqT1jsZF8Dld/QaS0mcvFHy5ORfCrLi2RTpYPJIRzv++a gUjAllyH/pqwHhB/Jj9Khi8OSv8/3jMIpMS3QE/ADwFfNslGWW63kycKeDuE9Jps gCVu9DHmm18OtLiYM+nSNjyWN1pvRvCV7uo8Atucbw4bBDFwZY8= =bDqz -----END PGP SIGNATURE----- Merge tag 'linux_kselftest-kunit-fixes-6.8-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest Pull KUnit fix from Shuah Khan: "One important fix to unregister kunit_bus when KUnit module is unloaded. Not doing so causes an error when KUnit module tries to re-register the bus when it gets reloaded" * tag 'linux_kselftest-kunit-fixes-6.8-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: kunit: device: Unregister the kunit_bus on shutdown
This commit is contained in:
commit
91f842ffe6
@ -13,5 +13,7 @@
|
||||
|
||||
// For internal use only -- registers the kunit_bus.
|
||||
int kunit_bus_init(void);
|
||||
// For internal use only -- unregisters the kunit_bus.
|
||||
void kunit_bus_shutdown(void);
|
||||
|
||||
#endif //_KUNIT_DEVICE_IMPL_H
|
||||
|
@ -54,6 +54,20 @@ int kunit_bus_init(void)
|
||||
return error;
|
||||
}
|
||||
|
||||
/* Unregister the 'kunit_bus' in case the KUnit module is unloaded. */
|
||||
void kunit_bus_shutdown(void)
|
||||
{
|
||||
/* Make sure the bus exists before we unregister it. */
|
||||
if (IS_ERR_OR_NULL(kunit_bus_device))
|
||||
return;
|
||||
|
||||
bus_unregister(&kunit_bus_type);
|
||||
|
||||
root_device_unregister(kunit_bus_device);
|
||||
|
||||
kunit_bus_device = NULL;
|
||||
}
|
||||
|
||||
/* Release a 'fake' KUnit device. */
|
||||
static void kunit_device_release(struct device *d)
|
||||
{
|
||||
|
@ -928,6 +928,9 @@ static void __exit kunit_exit(void)
|
||||
#ifdef CONFIG_MODULES
|
||||
unregister_module_notifier(&kunit_mod_nb);
|
||||
#endif
|
||||
|
||||
kunit_bus_shutdown();
|
||||
|
||||
kunit_debugfs_cleanup();
|
||||
}
|
||||
module_exit(kunit_exit);
|
||||
|
Loading…
Reference in New Issue
Block a user