RE: __unsafe() usage

From: Nelson, Shannon
Date: Mon Jul 23 2007 - 19:40:28 EST


Rusty Russell [mailto:rusty@xxxxxxxxxxxxxxx]
>> 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@xxxxxxxxxxxxxxx>
>
>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@xxxxxxxxx>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/