Commit-ID: af5a29aee4d1e5b5fbfbaf45cb097f9c6257c7b8 Gitweb: http://git.kernel.org/tip/af5a29aee4d1e5b5fbfbaf45cb097f9c6257c7b8 Author: Mathias Krause <minipli@xxxxxxxxxxxxxx> AuthorDate: Thu, 23 Oct 2014 23:20:37 +0200 Committer: Matt Fleming <matt.fleming@xxxxxxxxx> CommitDate: Tue, 11 Nov 2014 22:22:27 +0000 efivarfs: Allow unloading when build as module There is no need to keep the module loaded when it serves no function in case the EFI runtime services are disabled. Return an error in this case so loading the module will fail. Also supply a module_exit function to allow unloading the module. Last, but not least, set the owner of the file_system_type struct. Cc: Jeremy Kerr <jk@xxxxxxxxxx> Cc: Matthew Garrett <matthew.garrett@xxxxxxxxxx> Signed-off-by: Mathias Krause <minipli@xxxxxxxxxxxxxx> Signed-off-by: Matt Fleming <matt.fleming@xxxxxxxxx> --- fs/efivarfs/super.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/fs/efivarfs/super.c b/fs/efivarfs/super.c index 0a48886..6dad117 100644 --- a/fs/efivarfs/super.c +++ b/fs/efivarfs/super.c @@ -236,6 +236,7 @@ static void efivarfs_kill_sb(struct super_block *sb) } static struct file_system_type efivarfs_type = { + .owner = THIS_MODULE, .name = "efivarfs", .mount = efivarfs_mount, .kill_sb = efivarfs_kill_sb, @@ -244,17 +245,23 @@ static struct file_system_type efivarfs_type = { static __init int efivarfs_init(void) { if (!efi_enabled(EFI_RUNTIME_SERVICES)) - return 0; + return -ENODEV; if (!efivars_kobject()) - return 0; + return -ENODEV; return register_filesystem(&efivarfs_type); } +static __exit void efivarfs_exit(void) +{ + unregister_filesystem(&efivarfs_type); +} + MODULE_AUTHOR("Matthew Garrett, Jeremy Kerr"); MODULE_DESCRIPTION("EFI Variable Filesystem"); MODULE_LICENSE("GPL"); MODULE_ALIAS_FS("efivarfs"); module_init(efivarfs_init); +module_exit(efivarfs_exit); -- To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html
![]() |