RE: __unsafe() usage

Nelson, Shannon
2007-07-23T23:40:27Z

Rusty Russell [mailto:rusty@rustcorp.com.au]
>> If this is true, and since the MOD_INC_USE_COUNT compat code is long
>> gone, shouldn't we be able to completely remove __unsafe() and the
>> struct member "unsafe"?
>
>Yes, indeed, something like this:
>==
>Remove "unsafe" from module struct
>
>Adrian Bunk points out that "unsafe" was used to mark modules
>touched by
>the deprecated MOD_INC_USE_COUNT interface, which has long gone. It's
>time to remove the member from the module structure, as well.
>
>If you want a module which can't unload, don't register an exit
>function.
>
>Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
>
>diff -r d7af727512fd drivers/dma/ioatdma.c
>--- a/drivers/dma/ioatdma.c Tue Jul 24 08:30:05 2007 +1000
>+++ b/drivers/dma/ioatdma.c Tue Jul 24 09:11:11 2007 +1000
>@@ -811,18 +811,17 @@ MODULE_AUTHOR("Intel Corporation");
>
> static int __init ioat_init_module(void)
> {
>- /* it's currently unsafe to unload this module */
>- /* if forced, worst case is that rmmod hangs */
>- __unsafe(THIS_MODULE);
>-
> return pci_register_driver(&ioat_pci_driver);
> }
>
> module_init(ioat_init_module);
>
>+/* it's currently unsafe to unload this module */
>+#if 0
> static void __exit ioat_exit_module(void)
> {
> pci_unregister_driver(&ioat_pci_driver);
> }
>
> module_exit(ioat_exit_module);
>+#endif

Acked-by: Shannon Nelson <shannon.nelson@intel.com>