Patchwork [1/2] acpi: dmar: make func args const

login
register
mail settings
Submitter Colin King
Date March 2, 2012, 9:30 a.m.
Message ID <1330680658-12937-2-git-send-email-colin.king@canonical.com>
Download mbox | patch
Permalink /patch/144165/
State Accepted
Headers show

Comments

Colin King - March 2, 2012, 9:30 a.m.
From: Colin Ian King <colin.king@canonical.com>

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/acpi/dmar/dmar.c |   25 +++++++++++++++----------
 1 files changed, 15 insertions(+), 10 deletions(-)
Keng-Yu Lin - March 5, 2012, 8 a.m.
On Fri, Mar 2, 2012 at 5:30 PM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/acpi/dmar/dmar.c |   25 +++++++++++++++----------
>  1 files changed, 15 insertions(+), 10 deletions(-)
>
> diff --git a/src/acpi/dmar/dmar.c b/src/acpi/dmar/dmar.c
> index 6ad9b9a..baab3df 100644
> --- a/src/acpi/dmar/dmar.c
> +++ b/src/acpi/dmar/dmar.c
> @@ -99,9 +99,9 @@ struct acpi_pci_path {
>  * = 0, normal pci device
>  * = 1, pci bridge, sec_bus gets set
>  */
> -static int read_pci_device_secondary_bus_number(uint8_t seg,
> -       uint8_t bus, uint8_t dev,
> -       uint8_t fn, uint8_t *sec_bus)
> +static int read_pci_device_secondary_bus_number(const uint8_t seg,
> +       const uint8_t bus, const uint8_t dev,
> +       const uint8_t fn, uint8_t *sec_bus)
>  {
>        FILE *file;
>        char path[PATH_MAX];
> @@ -128,7 +128,7 @@ static int read_pci_device_secondary_bus_number(uint8_t seg,
>  }
>
>  static int acpi_parse_one_dev_scope(fwts_framework *fw,
> -       struct acpi_dev_scope *scope, int seg)
> +       struct acpi_dev_scope *scope, const int seg)
>  {
>        struct acpi_pci_path *path;
>        int count;
> @@ -148,7 +148,8 @@ static int acpi_parse_one_dev_scope(fwts_framework *fw,
>        }
>
>        if (scope->dev_type > ACPI_DEV_P2PBRIDGE) {
> -               fwts_log_info(fw, "Unknown device scope type, the test case should be fixed.");
> +               fwts_log_info(fw, "Unknown device scope type, "
> +                       "the test case should be fixed.");
>                return FWTS_ERROR;
>        }
>
> @@ -180,12 +181,13 @@ static int acpi_parse_one_dev_scope(fwts_framework *fw,
>        }
>        return FWTS_OK;
>  error:
> -       fwts_failed(fw, LOG_LEVEL_MEDIUM, "DevScopeDevNotFound", "Device scope device not found.");
> +       fwts_failed(fw, LOG_LEVEL_MEDIUM, "DevScopeDevNotFound",
> +               "Device scope device not found.");
>        return FWTS_ERROR;
>  }
>
>  static int acpi_parse_dev_scope(fwts_framework *fw,
> -       void *start, void *end, int seg)
> +       void *start, void *end, const int seg)
>  {
>        struct acpi_dev_scope *scope;
>        int ret;
> @@ -253,7 +255,8 @@ static int dmar_acpi_table_check(fwts_framework *fw)
>                return FWTS_ERROR;
>        }
>        if (table == NULL) {
> -               fwts_skipped(fw, "No DMAR table. This is not necessarily a failure as most systems do not have this table.");
> +               fwts_skipped(fw, "No DMAR table. This is not necessarily a "
> +                       "failure as most systems do not have this table.");
>                return FWTS_SKIP;
>        }
>
> @@ -266,7 +269,8 @@ static int dmar_acpi_table_check(fwts_framework *fw)
>        }
>
>        header = (struct acpi_dmar_entry_header *)(table_ptr+DMAR_HEADER_SIZE);
> -       while ((unsigned long)header < (unsigned long)(table_ptr + table->length)) {
> +       while ((unsigned long)header <
> +              (unsigned long)(table_ptr + table->length)) {
>                if ((header->type == ACPI_DMAR_DRHD) &&
>                    (acpi_parse_one_drhd(fw, header) != FWTS_OK)) {
>                        failed++;
> @@ -304,7 +308,8 @@ static int dmar_test1(fwts_framework *fw)
>                        fwts_log_error(fw, "Cannot read kernel log.");
>                        return FWTS_ERROR;
>                }
> -               if (fwts_klog_scan(fw, klog, acpiinfo_check, NULL, NULL, &errors)) {
> +               if (fwts_klog_scan(fw, klog, acpiinfo_check,
> +                       NULL, NULL, &errors)) {
>                        fwts_log_error(fw, "Failed to scan kernel log.");
>                        return FWTS_ERROR;
>                }
> --
> 1.7.9
>
Acked-by: Keng-Yu Lin <kengyu@canonical.com>
Alex Hung - March 7, 2012, 1:18 p.m.
On 12-03-02 05:30 PM, Colin King wrote:
> From: Colin Ian King<colin.king@canonical.com>
>
> Signed-off-by: Colin Ian King<colin.king@canonical.com>
> ---
>   src/acpi/dmar/dmar.c |   25 +++++++++++++++----------
>   1 files changed, 15 insertions(+), 10 deletions(-)
>
> diff --git a/src/acpi/dmar/dmar.c b/src/acpi/dmar/dmar.c
> index 6ad9b9a..baab3df 100644
> --- a/src/acpi/dmar/dmar.c
> +++ b/src/acpi/dmar/dmar.c
> @@ -99,9 +99,9 @@ struct acpi_pci_path {
>    * = 0, normal pci device
>    * = 1, pci bridge, sec_bus gets set
>    */
> -static int read_pci_device_secondary_bus_number(uint8_t seg,
> -	uint8_t bus, uint8_t dev,
> -	uint8_t fn, uint8_t *sec_bus)
> +static int read_pci_device_secondary_bus_number(const uint8_t seg,
> +	const uint8_t bus, const uint8_t dev,
> +	const uint8_t fn, uint8_t *sec_bus)
>   {
>   	FILE *file;
>   	char path[PATH_MAX];
> @@ -128,7 +128,7 @@ static int read_pci_device_secondary_bus_number(uint8_t seg,
>   }
>
>   static int acpi_parse_one_dev_scope(fwts_framework *fw,
> -	struct acpi_dev_scope *scope, int seg)
> +	struct acpi_dev_scope *scope, const int seg)
>   {
>   	struct acpi_pci_path *path;
>   	int count;
> @@ -148,7 +148,8 @@ static int acpi_parse_one_dev_scope(fwts_framework *fw,
>   	}
>
>   	if (scope->dev_type>  ACPI_DEV_P2PBRIDGE) {
> -		fwts_log_info(fw, "Unknown device scope type, the test case should be fixed.");
> +		fwts_log_info(fw, "Unknown device scope type, "
> +			"the test case should be fixed.");
>   		return FWTS_ERROR;
>   	}
>
> @@ -180,12 +181,13 @@ static int acpi_parse_one_dev_scope(fwts_framework *fw,
>   	}
>   	return FWTS_OK;
>   error:
> -	fwts_failed(fw, LOG_LEVEL_MEDIUM, "DevScopeDevNotFound", "Device scope device not found.");
> +	fwts_failed(fw, LOG_LEVEL_MEDIUM, "DevScopeDevNotFound",
> +		"Device scope device not found.");
>   	return FWTS_ERROR;
>   }
>
>   static int acpi_parse_dev_scope(fwts_framework *fw,
> -	void *start, void *end, int seg)
> +	void *start, void *end, const int seg)
>   {
>   	struct acpi_dev_scope *scope;
>   	int ret;
> @@ -253,7 +255,8 @@ static int dmar_acpi_table_check(fwts_framework *fw)
>   		return FWTS_ERROR;
>   	}
>   	if (table == NULL) {
> -		fwts_skipped(fw, "No DMAR table. This is not necessarily a failure as most systems do not have this table.");
> +		fwts_skipped(fw, "No DMAR table. This is not necessarily a "
> +			"failure as most systems do not have this table.");
>   		return FWTS_SKIP;
>   	}
>
> @@ -266,7 +269,8 @@ static int dmar_acpi_table_check(fwts_framework *fw)
>   	}
>
>   	header = (struct acpi_dmar_entry_header *)(table_ptr+DMAR_HEADER_SIZE);
> -	while ((unsigned long)header<  (unsigned long)(table_ptr + table->length)) {
> +	while ((unsigned long)header<
> +	       (unsigned long)(table_ptr + table->length)) {
>   		if ((header->type == ACPI_DMAR_DRHD)&&
>   		(acpi_parse_one_drhd(fw, header) != FWTS_OK)) {
>   			failed++;
> @@ -304,7 +308,8 @@ static int dmar_test1(fwts_framework *fw)
>                   	fwts_log_error(fw, "Cannot read kernel log.");
>                   	return FWTS_ERROR;
>           	}
> -		if (fwts_klog_scan(fw, klog, acpiinfo_check, NULL, NULL,&errors)) {
> +		if (fwts_klog_scan(fw, klog, acpiinfo_check,
> +			NULL, NULL,&errors)) {
>                   	fwts_log_error(fw, "Failed to scan kernel log.");
>                   	return FWTS_ERROR;
>   		}
Acked-by: Alex Hung <alex.hung@canonical.com>

Patch

diff --git a/src/acpi/dmar/dmar.c b/src/acpi/dmar/dmar.c
index 6ad9b9a..baab3df 100644
--- a/src/acpi/dmar/dmar.c
+++ b/src/acpi/dmar/dmar.c
@@ -99,9 +99,9 @@  struct acpi_pci_path {
  * = 0, normal pci device
  * = 1, pci bridge, sec_bus gets set
  */
-static int read_pci_device_secondary_bus_number(uint8_t seg,
-	uint8_t bus, uint8_t dev,
-	uint8_t fn, uint8_t *sec_bus)
+static int read_pci_device_secondary_bus_number(const uint8_t seg,
+	const uint8_t bus, const uint8_t dev,
+	const uint8_t fn, uint8_t *sec_bus)
 {
 	FILE *file;
 	char path[PATH_MAX];
@@ -128,7 +128,7 @@  static int read_pci_device_secondary_bus_number(uint8_t seg,
 }
 
 static int acpi_parse_one_dev_scope(fwts_framework *fw,
-	struct acpi_dev_scope *scope, int seg)
+	struct acpi_dev_scope *scope, const int seg)
 {
 	struct acpi_pci_path *path;
 	int count;
@@ -148,7 +148,8 @@  static int acpi_parse_one_dev_scope(fwts_framework *fw,
 	}
 
 	if (scope->dev_type > ACPI_DEV_P2PBRIDGE) {
-		fwts_log_info(fw, "Unknown device scope type, the test case should be fixed.");
+		fwts_log_info(fw, "Unknown device scope type, "
+			"the test case should be fixed.");
 		return FWTS_ERROR;
 	}
 
@@ -180,12 +181,13 @@  static int acpi_parse_one_dev_scope(fwts_framework *fw,
 	}
 	return FWTS_OK;
 error:
-	fwts_failed(fw, LOG_LEVEL_MEDIUM, "DevScopeDevNotFound", "Device scope device not found.");
+	fwts_failed(fw, LOG_LEVEL_MEDIUM, "DevScopeDevNotFound",
+		"Device scope device not found.");
 	return FWTS_ERROR;
 }
 
 static int acpi_parse_dev_scope(fwts_framework *fw,
-	void *start, void *end, int seg)
+	void *start, void *end, const int seg)
 {
 	struct acpi_dev_scope *scope;
 	int ret;
@@ -253,7 +255,8 @@  static int dmar_acpi_table_check(fwts_framework *fw)
 		return FWTS_ERROR;
 	}
 	if (table == NULL) {
-		fwts_skipped(fw, "No DMAR table. This is not necessarily a failure as most systems do not have this table.");
+		fwts_skipped(fw, "No DMAR table. This is not necessarily a "
+			"failure as most systems do not have this table.");
 		return FWTS_SKIP;
 	}
 
@@ -266,7 +269,8 @@  static int dmar_acpi_table_check(fwts_framework *fw)
 	}
 
 	header = (struct acpi_dmar_entry_header *)(table_ptr+DMAR_HEADER_SIZE);
-	while ((unsigned long)header < (unsigned long)(table_ptr + table->length)) {
+	while ((unsigned long)header <
+	       (unsigned long)(table_ptr + table->length)) {
 		if ((header->type == ACPI_DMAR_DRHD) &&
 		    (acpi_parse_one_drhd(fw, header) != FWTS_OK)) {
 			failed++;
@@ -304,7 +308,8 @@  static int dmar_test1(fwts_framework *fw)
                 	fwts_log_error(fw, "Cannot read kernel log.");
                 	return FWTS_ERROR;
         	}
-		if (fwts_klog_scan(fw, klog, acpiinfo_check, NULL, NULL, &errors)) {
+		if (fwts_klog_scan(fw, klog, acpiinfo_check,
+			NULL, NULL, &errors)) {
                 	fwts_log_error(fw, "Failed to scan kernel log.");
                 	return FWTS_ERROR;
 		}