acpiinfo: update acpi version supported by kernel
diff mbox series

Message ID 20180815225554.20128-1-alex.hung@canonical.com
State Accepted
Headers show
Series
  • acpiinfo: update acpi version supported by kernel
Related show

Commit Message

Alex Hung Aug. 15, 2018, 10:55 p.m. UTC
ACPI version is formated as major.minor, and therefore float is used to
replace int.

In addition, two indents are also fixed.

Signed-off-by: Alex Hung <alex.hung@canonical.com>
---
 src/acpi/acpiinfo/acpiinfo.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

Comments

Colin King Aug. 15, 2018, 11:04 p.m. UTC | #1
On 15/08/18 23:55, Alex Hung wrote:
> ACPI version is formated as major.minor, and therefore float is used to
> replace int.
> 
> In addition, two indents are also fixed.
> 
> Signed-off-by: Alex Hung <alex.hung@canonical.com>
> ---
>  src/acpi/acpiinfo/acpiinfo.c | 24 ++++++++++++++----------
>  1 file changed, 14 insertions(+), 10 deletions(-)
> 
> diff --git a/src/acpi/acpiinfo/acpiinfo.c b/src/acpi/acpiinfo/acpiinfo.c
> index d3aa6b2a..b96f7b1c 100644
> --- a/src/acpi/acpiinfo/acpiinfo.c
> +++ b/src/acpi/acpiinfo/acpiinfo.c
> @@ -68,30 +68,34 @@ static int acpiinfo_test1(fwts_framework *fw)
>  
>  	if (((str = fwts_get("/sys/module/acpi/parameters/acpica_version")) == NULL) &&
>  	    ((str = fwts_get("/proc/acpi/info")) == NULL))
> -                fwts_log_info(fw,
> +			fwts_log_info(fw,
>  			"Cannot get ACPI version info from "
>  			"/sys/module/acpi/parameters/acpica_version or /proc/acpi/info");
> -        else {
> -		int version;
> +	else {
> +		float version;
>  		int yearmonth;
>  
>  		fwts_chop_newline(str);
>  
>  		sscanf(str, "%6d", &yearmonth);
>  
> -		if (yearmonth > 201505) {
> -			version = 6;
> +		if (yearmonth > 201609) {
> +			version = 6.2;
> +		} else if (yearmonth > 201509) {
> +			version = 6.1;
> +		} else if (yearmonth > 201404) {
> +			version = 6.0;
>  		} else if (yearmonth > 201110) {
> -			version = 5;
> +			version = 5.0;
>  		} else if (yearmonth > 200906) {
> -			version = 4;
> +			version = 4.0;
>  		} else if (yearmonth > 200505) {
> -			version = 3;
> +			version = 3.0;
>  		} else {
> -			version = 2;
> +			version = 2.0;
>  		}
>  
> -		fwts_log_info(fw, "Kernel ACPICA driver version: %s, supports ACPI %d.0", str, version);
> +		fwts_log_info(fw, "Kernel ACPICA driver version: %s, supports ACPI %2.1f", str, version);
>  		free(str);
>  	}
>  
> 

Hopefully it will always be major.minor, if not, we can represent the
version as strings in the future.

Acked-by: Colin Ian King <colin.king@canonical.com>
ivanhu Aug. 16, 2018, 9:22 a.m. UTC | #2
On 08/16/2018 06:55 AM, Alex Hung wrote:
> ACPI version is formated as major.minor, and therefore float is used to
> replace int.
>
> In addition, two indents are also fixed.
>
> Signed-off-by: Alex Hung <alex.hung@canonical.com>
> ---
>  src/acpi/acpiinfo/acpiinfo.c | 24 ++++++++++++++----------
>  1 file changed, 14 insertions(+), 10 deletions(-)
>
> diff --git a/src/acpi/acpiinfo/acpiinfo.c b/src/acpi/acpiinfo/acpiinfo.c
> index d3aa6b2a..b96f7b1c 100644
> --- a/src/acpi/acpiinfo/acpiinfo.c
> +++ b/src/acpi/acpiinfo/acpiinfo.c
> @@ -68,30 +68,34 @@ static int acpiinfo_test1(fwts_framework *fw)
>  
>  	if (((str = fwts_get("/sys/module/acpi/parameters/acpica_version")) == NULL) &&
>  	    ((str = fwts_get("/proc/acpi/info")) == NULL))
> -                fwts_log_info(fw,
> +			fwts_log_info(fw,
>  			"Cannot get ACPI version info from "
>  			"/sys/module/acpi/parameters/acpica_version or /proc/acpi/info");
> -        else {
> -		int version;
> +	else {
> +		float version;
>  		int yearmonth;
>  
>  		fwts_chop_newline(str);
>  
>  		sscanf(str, "%6d", &yearmonth);
>  
> -		if (yearmonth > 201505) {
> -			version = 6;
> +		if (yearmonth > 201609) {
> +			version = 6.2;
> +		} else if (yearmonth > 201509) {
> +			version = 6.1;
> +		} else if (yearmonth > 201404) {
> +			version = 6.0;
>  		} else if (yearmonth > 201110) {
> -			version = 5;
> +			version = 5.0;
>  		} else if (yearmonth > 200906) {
> -			version = 4;
> +			version = 4.0;
>  		} else if (yearmonth > 200505) {
> -			version = 3;
> +			version = 3.0;
>  		} else {
> -			version = 2;
> +			version = 2.0;
>  		}
>  
> -		fwts_log_info(fw, "Kernel ACPICA driver version: %s, supports ACPI %d.0", str, version);
> +		fwts_log_info(fw, "Kernel ACPICA driver version: %s, supports ACPI %2.1f", str, version);
>  		free(str);
>  	}
>  
Acked-by: Ivan Hu <ivan.hu@canonical.com>

Patch
diff mbox series

diff --git a/src/acpi/acpiinfo/acpiinfo.c b/src/acpi/acpiinfo/acpiinfo.c
index d3aa6b2a..b96f7b1c 100644
--- a/src/acpi/acpiinfo/acpiinfo.c
+++ b/src/acpi/acpiinfo/acpiinfo.c
@@ -68,30 +68,34 @@  static int acpiinfo_test1(fwts_framework *fw)
 
 	if (((str = fwts_get("/sys/module/acpi/parameters/acpica_version")) == NULL) &&
 	    ((str = fwts_get("/proc/acpi/info")) == NULL))
-                fwts_log_info(fw,
+			fwts_log_info(fw,
 			"Cannot get ACPI version info from "
 			"/sys/module/acpi/parameters/acpica_version or /proc/acpi/info");
-        else {
-		int version;
+	else {
+		float version;
 		int yearmonth;
 
 		fwts_chop_newline(str);
 
 		sscanf(str, "%6d", &yearmonth);
 
-		if (yearmonth > 201505) {
-			version = 6;
+		if (yearmonth > 201609) {
+			version = 6.2;
+		} else if (yearmonth > 201509) {
+			version = 6.1;
+		} else if (yearmonth > 201404) {
+			version = 6.0;
 		} else if (yearmonth > 201110) {
-			version = 5;
+			version = 5.0;
 		} else if (yearmonth > 200906) {
-			version = 4;
+			version = 4.0;
 		} else if (yearmonth > 200505) {
-			version = 3;
+			version = 3.0;
 		} else {
-			version = 2;
+			version = 2.0;
 		}
 
-		fwts_log_info(fw, "Kernel ACPICA driver version: %s, supports ACPI %d.0", str, version);
+		fwts_log_info(fw, "Kernel ACPICA driver version: %s, supports ACPI %2.1f", str, version);
 		free(str);
 	}