Patchwork utilities: kernelscan: add in ACPI configs and more printk message types

login
register
mail settings
Submitter Colin King
Date Nov. 5, 2012, 6:43 p.m.
Message ID <1352141022-15225-1-git-send-email-colin.king@canonical.com>
Download mbox | patch
Permalink /patch/197273/
State Accepted
Headers show

Comments

Colin King - Nov. 5, 2012, 6:43 p.m.
From: Colin Ian King <colin.king@canonical.com>

We also should set some typical ACPI config settings so we don't throw
aways code in the CPP stage.  Also add scanning for KERN_CRIT and
KERN_EMERG messages too.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/utilities/kernelscan.c  |    5 +++--
 src/utilities/kernelscan.sh |    9 ++++++++-
 2 files changed, 11 insertions(+), 3 deletions(-)
Keng-Yu Lin - Nov. 8, 2012, 3:03 a.m.
On Mon, Nov 5, 2012 at 7:43 PM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> We also should set some typical ACPI config settings so we don't throw
> aways code in the CPP stage.  Also add scanning for KERN_CRIT and
> KERN_EMERG messages too.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/utilities/kernelscan.c  |    5 +++--
>  src/utilities/kernelscan.sh |    9 ++++++++-
>  2 files changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/src/utilities/kernelscan.c b/src/utilities/kernelscan.c
> index 67d623b..c2d60d9 100644
> --- a/src/utilities/kernelscan.c
> +++ b/src/utilities/kernelscan.c
> @@ -798,11 +798,12 @@ static int parse_kernel_message(parser *p, token *t)
>                 if (printk &&
>                     (t->type == TOKEN_IDENTIFIER) &&
>                     (prev_token_type == TOKEN_PAREN_OPENED) &&
> -                   (strcmp(t->token, "KERN_ERR") == 0)) {
> +                   ((strcmp(t->token, "KERN_ERR") == 0) ||
> +                    (strcmp(t->token, "KERN_CRIT") == 0) ||
> +                    (strcmp(t->token, "KERN_EMERG") == 0))) {
>                         emit = true;
>                 }
>
> -
>                 if (t->type == TOKEN_LITERAL_STRING) {
>                         literal_strip_quotes(t);
>                         str = strdupcat(str, t->token);
> diff --git a/src/utilities/kernelscan.sh b/src/utilities/kernelscan.sh
> index ed402d9..a4296ac 100755
> --- a/src/utilities/kernelscan.sh
> +++ b/src/utilities/kernelscan.sh
> @@ -17,6 +17,13 @@
>  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
>  #
>
> +CONFIGS="-DCONFIG_ACPI_HOTPLUG_CPU -DCONFIG_ACPI_PROC_EVENT \
> +        -DCONFIG_ACPI_PROCFS_POWER -DCONFIG_ACPI_SLEEP \
> +        -DCONFIG_CPU_FREQ -DCONFIG_DMI -DCONFIG_HIBERNATION \
> +        -DCONFIG_HOTPLUG_CPU -DCONFIG_KEXEC -DCONFIG_NET \
> +        -DCONFIG_PM -DCONFIG_PM_SLEEP -DCONFIG_SMP \
> +        -DCONFIG_SUSPEND -DCONFIG_X86 -DCONFIG_X86_IO_APIC"
> +
>  KERNELSCAN=./kernelscan
>  TMP=/tmp/kernelscan_$$.txt
>
> @@ -34,7 +41,7 @@ fi
>
>  scan_source_file()
>  {
> -       $KERNELSCAN < $1 -E | gcc  -E - | $KERNELSCAN -P > $TMP
> +       $KERNELSCAN < $1 -E | gcc -E $CONFIGS - | $KERNELSCAN -P > $TMP
>         if [ $(stat -c%s $TMP) -gt 0 ]; then
>                 echo "Source: $1"
>                 cat $TMP
> --
> 1.7.10.4
>
Acked-by: Keng-Yu Lin <kengyu@canonical.com>
Alex Hung - Nov. 21, 2012, 3:13 a.m.
On 11/06/2012 02:43 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> We also should set some typical ACPI config settings so we don't throw
> aways code in the CPP stage.  Also add scanning for KERN_CRIT and
> KERN_EMERG messages too.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/utilities/kernelscan.c  |    5 +++--
>   src/utilities/kernelscan.sh |    9 ++++++++-
>   2 files changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/src/utilities/kernelscan.c b/src/utilities/kernelscan.c
> index 67d623b..c2d60d9 100644
> --- a/src/utilities/kernelscan.c
> +++ b/src/utilities/kernelscan.c
> @@ -798,11 +798,12 @@ static int parse_kernel_message(parser *p, token *t)
>   		if (printk &&
>   		    (t->type == TOKEN_IDENTIFIER) &&
>   		    (prev_token_type == TOKEN_PAREN_OPENED) &&
> -		    (strcmp(t->token, "KERN_ERR") == 0)) {
> +		    ((strcmp(t->token, "KERN_ERR") == 0) ||
> +		     (strcmp(t->token, "KERN_CRIT") == 0) ||
> +		     (strcmp(t->token, "KERN_EMERG") == 0))) {
>   			emit = true;
>   		}
>
> -
>   		if (t->type == TOKEN_LITERAL_STRING) {
>   			literal_strip_quotes(t);
>   			str = strdupcat(str, t->token);
> diff --git a/src/utilities/kernelscan.sh b/src/utilities/kernelscan.sh
> index ed402d9..a4296ac 100755
> --- a/src/utilities/kernelscan.sh
> +++ b/src/utilities/kernelscan.sh
> @@ -17,6 +17,13 @@
>   # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
>   #
>
> +CONFIGS="-DCONFIG_ACPI_HOTPLUG_CPU -DCONFIG_ACPI_PROC_EVENT \
> +	 -DCONFIG_ACPI_PROCFS_POWER -DCONFIG_ACPI_SLEEP \
> +	 -DCONFIG_CPU_FREQ -DCONFIG_DMI -DCONFIG_HIBERNATION \
> +	 -DCONFIG_HOTPLUG_CPU -DCONFIG_KEXEC -DCONFIG_NET \
> +	 -DCONFIG_PM -DCONFIG_PM_SLEEP -DCONFIG_SMP \
> +	 -DCONFIG_SUSPEND -DCONFIG_X86 -DCONFIG_X86_IO_APIC"
> +
>   KERNELSCAN=./kernelscan
>   TMP=/tmp/kernelscan_$$.txt
>
> @@ -34,7 +41,7 @@ fi
>
>   scan_source_file()
>   {
> -	$KERNELSCAN < $1 -E | gcc  -E - | $KERNELSCAN -P > $TMP
> +	$KERNELSCAN < $1 -E | gcc -E $CONFIGS - | $KERNELSCAN -P > $TMP
>   	if [ $(stat -c%s $TMP) -gt 0 ]; then
>   		echo "Source: $1"
>   		cat $TMP
>
Acked-by: Alex Hung <alex.hung@canonical.com>

Patch

diff --git a/src/utilities/kernelscan.c b/src/utilities/kernelscan.c
index 67d623b..c2d60d9 100644
--- a/src/utilities/kernelscan.c
+++ b/src/utilities/kernelscan.c
@@ -798,11 +798,12 @@  static int parse_kernel_message(parser *p, token *t)
 		if (printk &&
 		    (t->type == TOKEN_IDENTIFIER) &&
 		    (prev_token_type == TOKEN_PAREN_OPENED) &&
-		    (strcmp(t->token, "KERN_ERR") == 0)) {
+		    ((strcmp(t->token, "KERN_ERR") == 0) ||
+		     (strcmp(t->token, "KERN_CRIT") == 0) ||
+		     (strcmp(t->token, "KERN_EMERG") == 0))) {
 			emit = true;
 		}
 
-
 		if (t->type == TOKEN_LITERAL_STRING) {
 			literal_strip_quotes(t);
 			str = strdupcat(str, t->token);
diff --git a/src/utilities/kernelscan.sh b/src/utilities/kernelscan.sh
index ed402d9..a4296ac 100755
--- a/src/utilities/kernelscan.sh
+++ b/src/utilities/kernelscan.sh
@@ -17,6 +17,13 @@ 
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 
+CONFIGS="-DCONFIG_ACPI_HOTPLUG_CPU -DCONFIG_ACPI_PROC_EVENT \
+	 -DCONFIG_ACPI_PROCFS_POWER -DCONFIG_ACPI_SLEEP \
+	 -DCONFIG_CPU_FREQ -DCONFIG_DMI -DCONFIG_HIBERNATION \
+	 -DCONFIG_HOTPLUG_CPU -DCONFIG_KEXEC -DCONFIG_NET \
+	 -DCONFIG_PM -DCONFIG_PM_SLEEP -DCONFIG_SMP \
+	 -DCONFIG_SUSPEND -DCONFIG_X86 -DCONFIG_X86_IO_APIC"
+
 KERNELSCAN=./kernelscan
 TMP=/tmp/kernelscan_$$.txt
 
@@ -34,7 +41,7 @@  fi
 
 scan_source_file()
 {
-	$KERNELSCAN < $1 -E | gcc  -E - | $KERNELSCAN -P > $TMP
+	$KERNELSCAN < $1 -E | gcc -E $CONFIGS - | $KERNELSCAN -P > $TMP
 	if [ $(stat -c%s $TMP) -gt 0 ]; then
 		echo "Source: $1"
 		cat $TMP