Patchwork bios: mtrr: make is_prefetchable() return a bool type

login
register
mail settings
Submitter Colin King
Date Dec. 7, 2012, 12:18 a.m.
Message ID <1354839534-7056-1-git-send-email-colin.king@canonical.com>
Download mbox | patch
Permalink /patch/204356/
State Accepted
Headers show

Comments

Colin King - Dec. 7, 2012, 12:18 a.m.
From: Colin Ian King <colin.king@canonical.com>

Make is_prefetchable() return a bool type.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/bios/mtrr/mtrr.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
Alex Hung - Dec. 13, 2012, 2:22 a.m.
On 12/07/2012 08:18 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Make is_prefetchable() return a bool type.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/bios/mtrr/mtrr.c | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/src/bios/mtrr/mtrr.c b/src/bios/mtrr/mtrr.c
> index 8bb4b0f..eb8fbbf 100644
> --- a/src/bios/mtrr/mtrr.c
> +++ b/src/bios/mtrr/mtrr.c
> @@ -193,9 +193,9 @@ restart:
>   	return type;
>   }
>
> -static int is_prefetchable(fwts_framework *fw, char *device, uint64_t address)
> +static bool is_prefetchable(fwts_framework *fw, char *device, uint64_t address)
>   {
> -	int pref = 0;
> +	bool pref = false;
>   	char line[4096];
>   	fwts_list *lspci_output;
>   	fwts_list_link *item;
> @@ -211,11 +211,11 @@ static int is_prefetchable(fwts_framework *fw, char *device, uint64_t address)
>   		char *str = strstr(fwts_text_list_text(item), "Memory at ");
>   		if (str && strtoull(str+10, NULL, 16) == address) {
>   			if (strstr(str, "non-prefetchable"))
> -				pref = 0;
> +				pref = false;
>   			else if (strstr(str, "(prefetchable"))
> -				pref = 1;
> +				pref = true;
>   			else if (strstr(str, ", prefetchable"))
> -				pref = 1;
> +				pref = true;
>   		}
>   	}
>   	fwts_list_free(lspci_output, free);
>
Acked-by: Alex Hung <alex.hung@canonical.com>
Ivan Hu - Dec. 13, 2012, 9:44 a.m.
On 12/07/2012 08:18 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Make is_prefetchable() return a bool type.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/bios/mtrr/mtrr.c | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/src/bios/mtrr/mtrr.c b/src/bios/mtrr/mtrr.c
> index 8bb4b0f..eb8fbbf 100644
> --- a/src/bios/mtrr/mtrr.c
> +++ b/src/bios/mtrr/mtrr.c
> @@ -193,9 +193,9 @@ restart:
>   	return type;
>   }
>
> -static int is_prefetchable(fwts_framework *fw, char *device, uint64_t address)
> +static bool is_prefetchable(fwts_framework *fw, char *device, uint64_t address)
>   {
> -	int pref = 0;
> +	bool pref = false;
>   	char line[4096];
>   	fwts_list *lspci_output;
>   	fwts_list_link *item;
> @@ -211,11 +211,11 @@ static int is_prefetchable(fwts_framework *fw, char *device, uint64_t address)
>   		char *str = strstr(fwts_text_list_text(item), "Memory at ");
>   		if (str && strtoull(str+10, NULL, 16) == address) {
>   			if (strstr(str, "non-prefetchable"))
> -				pref = 0;
> +				pref = false;
>   			else if (strstr(str, "(prefetchable"))
> -				pref = 1;
> +				pref = true;
>   			else if (strstr(str, ", prefetchable"))
> -				pref = 1;
> +				pref = true;
>   		}
>   	}
>   	fwts_list_free(lspci_output, free);
>
Acked-by: Ivan Hu <ivan.hu@canonical.com>

Patch

diff --git a/src/bios/mtrr/mtrr.c b/src/bios/mtrr/mtrr.c
index 8bb4b0f..eb8fbbf 100644
--- a/src/bios/mtrr/mtrr.c
+++ b/src/bios/mtrr/mtrr.c
@@ -193,9 +193,9 @@  restart:
 	return type;
 }
 
-static int is_prefetchable(fwts_framework *fw, char *device, uint64_t address)
+static bool is_prefetchable(fwts_framework *fw, char *device, uint64_t address)
 {
-	int pref = 0;
+	bool pref = false;
 	char line[4096];
 	fwts_list *lspci_output;
 	fwts_list_link *item;
@@ -211,11 +211,11 @@  static int is_prefetchable(fwts_framework *fw, char *device, uint64_t address)
 		char *str = strstr(fwts_text_list_text(item), "Memory at ");
 		if (str && strtoull(str+10, NULL, 16) == address) {
 			if (strstr(str, "non-prefetchable"))
-				pref = 0;
+				pref = false;
 			else if (strstr(str, "(prefetchable"))
-				pref = 1;
+				pref = true;
 			else if (strstr(str, ", prefetchable"))
-				pref = 1;
+				pref = true;
 		}
 	}
 	fwts_list_free(lspci_output, free);