diff mbox

[1/2] efi_runtime: add checking the efi enviroment

Message ID 1348820791-4450-1-git-send-email-ivan.hu@canonical.com
State Rejected
Headers show

Commit Message

Ivan Hu Sept. 28, 2012, 8:26 a.m. UTC
This driver should be worked on efi enviroment, so efi_runtime_init will check efi_enable to register the driver.

Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
---
 efi_runtime/efi_runtime.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Keng-Yu Lin Sept. 28, 2012, 9:02 a.m. UTC | #1
On Fri, Sep 28, 2012 at 4:26 PM, Ivan Hu <ivan.hu@canonical.com> wrote:
> This driver should be worked on efi enviroment, so efi_runtime_init will check efi_enable to register the driver.
>
> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
> ---
>  efi_runtime/efi_runtime.c |    7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/efi_runtime/efi_runtime.c b/efi_runtime/efi_runtime.c
> index 7d99fbc..227a910 100644
> --- a/efi_runtime/efi_runtime.c
> +++ b/efi_runtime/efi_runtime.c
> @@ -304,6 +304,9 @@ static int __init efi_runtime_init(void)
>
>         printk(KERN_INFO "EFI_RUNTIME Driver v%s\n", EFI_FWTS_EFI_VERSION);
>
> +       if (!efi_enabled)
> +               return 0;
> +

Here should return an errno instead of 0.
"return -ENODEV;" could be a proper one.

>         ret = misc_register(&efi_runtime_dev);
>         if (ret) {
>                 printk(KERN_ERR "efi_runtime: can't misc_register on minor=%d\n",
> @@ -317,7 +320,9 @@ static int __init efi_runtime_init(void)
>  static void __exit efi_runtime_exit(void)
>  {
>         printk(KERN_INFO "EFI_RUNTIME Driver Exit.\n");
> -       misc_deregister(&efi_runtime_dev);
> +       if (efi_enabled)
> +               misc_deregister(&efi_runtime_dev);
> +

Once efi_runtime_init() returns an error, this won't be called.

>  }
>
>  module_init(efi_runtime_init);
> --
> 1.7.9.5
>
>
> --
> fwts-devel mailing list
> fwts-devel@lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/fwts-devel
diff mbox

Patch

diff --git a/efi_runtime/efi_runtime.c b/efi_runtime/efi_runtime.c
index 7d99fbc..227a910 100644
--- a/efi_runtime/efi_runtime.c
+++ b/efi_runtime/efi_runtime.c
@@ -304,6 +304,9 @@  static int __init efi_runtime_init(void)
 
 	printk(KERN_INFO "EFI_RUNTIME Driver v%s\n", EFI_FWTS_EFI_VERSION);
 
+	if (!efi_enabled)
+		return 0;
+
 	ret = misc_register(&efi_runtime_dev);
 	if (ret) {
 		printk(KERN_ERR "efi_runtime: can't misc_register on minor=%d\n",
@@ -317,7 +320,9 @@  static int __init efi_runtime_init(void)
 static void __exit efi_runtime_exit(void)
 {
 	printk(KERN_INFO "EFI_RUNTIME Driver Exit.\n");
-	misc_deregister(&efi_runtime_dev);
+	if (efi_enabled)
+		misc_deregister(&efi_runtime_dev);
+
 }
 
 module_init(efi_runtime_init);