[5/7] acpi, apei, ghes: Attach NMI init/deinit functions while CONFIG_ACPI_APEI_NMI is enabled.

Message ID 1397056476-9183-6-git-send-email-tomasz.nowicki@linaro.org
State New
Headers show

Commit Message

Tomasz Nowicki April 9, 2014, 3:14 p.m.
Thanks to more generic way of init/deinit error notification, we can
register NMI related calls in runtime. It happens before walking through
GHES entries, so probe function will treat NMI as supported.

Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
---
 drivers/acpi/apei/ghes.c |   21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

Comments

Borislav Petkov May 13, 2014, 7:49 p.m. | #1
On Wed, Apr 09, 2014 at 05:14:33PM +0200, Tomasz Nowicki wrote:
> Thanks to more generic way of init/deinit error notification, we can
> register NMI related calls in runtime. It happens before walking through
> GHES entries, so probe function will treat NMI as supported.

And we do this special handling which could confuse people because... ?

> Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
> ---
>  drivers/acpi/apei/ghes.c |   21 ++++++++++++++++-----
>  1 file changed, 16 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
> index 7a0d66e..aaf8db3 100644
> --- a/drivers/acpi/apei/ghes.c
> +++ b/drivers/acpi/apei/ghes.c
> @@ -906,7 +906,6 @@ static void ghes_estatus_pool_shrink(unsigned long len)
>  {
>  	ghes_estatus_pool_size_request -= PAGE_ALIGN(len);
>  }
> -#endif
>  
>  static int ghes_notify_init_nmi(struct ghes *ghes)
>  {
> @@ -941,6 +940,20 @@ static void ghes_notify_remove_nmi(struct ghes *ghes)
>  	ghes_estatus_pool_shrink(len);
>  }
>  
> +static void ghes_init_nmi(void)
> +{
> +	init_irq_work(&ghes_proc_irq_work, ghes_proc_in_irq);
> +	ghes_notify_tab[ACPI_HEST_NOTIFY_NMI].init_call = ghes_notify_init_nmi;
> +	ghes_notify_tab[ACPI_HEST_NOTIFY_NMI].remove_call = ghes_notify_remove_nmi;
> +
> +}
> +#else
> +inline static void ghes_init_nmi(void)
> +{
> +
> +}
> +#endif

WARNING: storage class should be at the beginning of the declaration
#51: FILE: drivers/acpi/apei/ghes.c:951:
+inline static void ghes_init_nmi(void)

ERROR: inline keyword should sit between storage class and type
#51: FILE: drivers/acpi/apei/ghes.c:951:
+inline static void ghes_init_nmi(void)

i.e..

static inline void ...

> +
>  static int ghes_notify_init_polled(struct ghes *ghes)
>  {
>  	ghes->timer.function = ghes_poll_func;
> @@ -1018,9 +1031,7 @@ static struct ghes_notify_setup
>  		[ACPI_HEST_NOTIFY_SCI]      = {"SCI",
>  					       ghes_notify_init_sci,
>  					       ghes_notify_remove_sci},
> -		[ACPI_HEST_NOTIFY_NMI]      = {"NMI",
> -					       ghes_notify_init_nmi,
> -					       ghes_notify_remove_nmi},
> +		[ACPI_HEST_NOTIFY_NMI]      = {"NMI", NULL, NULL},
>  		[ACPI_HEST_NOTIFY_CMCI]     = {"CMCI", NULL, NULL},
>  		[ACPI_HEST_NOTIFY_MCE]      = {"MCE", NULL, NULL},
>  };
> @@ -1141,7 +1152,7 @@ static int __init ghes_init(void)
>  		return -EINVAL;
>  	}
>  
> -	init_irq_work(&ghes_proc_irq_work, ghes_proc_in_irq);
> +	ghes_init_nmi();
>  
>  	rc = ghes_ioremap_init();
>  	if (rc)
> -- 
> 1.7.9.5
> 
>

Patch

diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
index 7a0d66e..aaf8db3 100644
--- a/drivers/acpi/apei/ghes.c
+++ b/drivers/acpi/apei/ghes.c
@@ -906,7 +906,6 @@  static void ghes_estatus_pool_shrink(unsigned long len)
 {
 	ghes_estatus_pool_size_request -= PAGE_ALIGN(len);
 }
-#endif
 
 static int ghes_notify_init_nmi(struct ghes *ghes)
 {
@@ -941,6 +940,20 @@  static void ghes_notify_remove_nmi(struct ghes *ghes)
 	ghes_estatus_pool_shrink(len);
 }
 
+static void ghes_init_nmi(void)
+{
+	init_irq_work(&ghes_proc_irq_work, ghes_proc_in_irq);
+	ghes_notify_tab[ACPI_HEST_NOTIFY_NMI].init_call = ghes_notify_init_nmi;
+	ghes_notify_tab[ACPI_HEST_NOTIFY_NMI].remove_call = ghes_notify_remove_nmi;
+
+}
+#else
+inline static void ghes_init_nmi(void)
+{
+
+}
+#endif
+
 static int ghes_notify_init_polled(struct ghes *ghes)
 {
 	ghes->timer.function = ghes_poll_func;
@@ -1018,9 +1031,7 @@  static struct ghes_notify_setup
 		[ACPI_HEST_NOTIFY_SCI]      = {"SCI",
 					       ghes_notify_init_sci,
 					       ghes_notify_remove_sci},
-		[ACPI_HEST_NOTIFY_NMI]      = {"NMI",
-					       ghes_notify_init_nmi,
-					       ghes_notify_remove_nmi},
+		[ACPI_HEST_NOTIFY_NMI]      = {"NMI", NULL, NULL},
 		[ACPI_HEST_NOTIFY_CMCI]     = {"CMCI", NULL, NULL},
 		[ACPI_HEST_NOTIFY_MCE]      = {"MCE", NULL, NULL},
 };
@@ -1141,7 +1152,7 @@  static int __init ghes_init(void)
 		return -EINVAL;
 	}
 
-	init_irq_work(&ghes_proc_irq_work, ghes_proc_in_irq);
+	ghes_init_nmi();
 
 	rc = ghes_ioremap_init();
 	if (rc)