diff mbox series

[V2] acpi/method/battery: replace hardcoded array length by FWTS_ARRAY_SIZE

Message ID 20200505214445.69288-1-alex.hung@canonical.com
State Accepted
Headers show
Series [V2] acpi/method/battery: replace hardcoded array length by FWTS_ARRAY_SIZE | expand

Commit Message

Alex Hung May 5, 2020, 9:44 p.m. UTC
There are no functional changes.

Signed-off-by: Alex Hung <alex.hung@canonical.com>
---
 src/acpi/devices/battery/battery.c | 6 +++---
 src/acpi/method/method.c           | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

Comments

Colin Ian King May 5, 2020, 9:56 p.m. UTC | #1
On 05/05/2020 22:44, Alex Hung wrote:
> There are no functional changes.
> 
> Signed-off-by: Alex Hung <alex.hung@canonical.com>
> ---
>  src/acpi/devices/battery/battery.c | 6 +++---
>  src/acpi/method/method.c           | 6 +++---
>  2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/src/acpi/devices/battery/battery.c b/src/acpi/devices/battery/battery.c
> index 630c07f1..74565169 100644
> --- a/src/acpi/devices/battery/battery.c
> +++ b/src/acpi/devices/battery/battery.c
> @@ -545,7 +545,7 @@ static int method_test_BTP(fwts_framework *fw)
>  	ACPI_STATUS status;
>  	uint8_t i;
>  
> -	for (i = 0; i < sizeof(values) / sizeof(int); i++) {
> +	for (i = 0; i < FWTS_ARRAY_SIZE(values); i++) {
>  		ACPI_OBJECT arg[1];
>  		arg[0].Type = ACPI_TYPE_INTEGER;
>  		arg[0].Integer.Value = values[i];
> @@ -626,7 +626,7 @@ static int method_test_BTM(fwts_framework *fw)
>  	ACPI_STATUS status;
>  	uint8_t i;
>  
> -	for (i = 0; i < sizeof(values) / sizeof(int); i++) {
> +	for (i = 0; i < FWTS_ARRAY_SIZE(values); i++) {
>  		ACPI_OBJECT arg[1];
>  		arg[0].Type = ACPI_TYPE_INTEGER;
>  		arg[0].Integer.Value = values[i];
> @@ -686,7 +686,7 @@ static int method_test_BMC(fwts_framework *fw)
>  	ACPI_STATUS status;
>  	uint8_t i;
>  
> -	for (i = 0; i < sizeof(values) / sizeof(int); i++) {
> +	for (i = 0; i < FWTS_ARRAY_SIZE(values); i++) {
>  		ACPI_OBJECT arg[1];
>  		arg[0].Type = ACPI_TYPE_INTEGER;
>  		arg[0].Integer.Value = values[i];
> diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c
> index cd4d15c7..68973847 100644
> --- a/src/acpi/method/method.c
> +++ b/src/acpi/method/method.c
> @@ -4354,7 +4354,7 @@ static int method_test_BTP(fwts_framework *fw)
>  	static const int values[] = { 0, 1, 100, 200, 0x7fffffff };
>  	int i;
>  
> -	for (i = 0; i < 5; i++) {
> +	for (i = 0; i < FWTS_ARRAY_SIZE(values); i++) {
>  		ACPI_OBJECT arg[1];
>  		arg[0].Type = ACPI_TYPE_INTEGER;
>  		arg[0].Integer.Value = values[i];
> @@ -4394,7 +4394,7 @@ static int method_test_BTM(fwts_framework *fw)
>  	static const int values[] = { 0, 1, 100, 200, 0x7fffffff };
>  	int i;
>  
> -	for (i = 0 ; i < 5; i++) {
> +	for (i = 0; i < FWTS_ARRAY_SIZE(values); i++) {
>  		ACPI_OBJECT arg[1];
>  		arg[0].Type = ACPI_TYPE_INTEGER;
>  		arg[0].Integer.Value = values[i];
> @@ -4440,7 +4440,7 @@ static int method_test_BMC(fwts_framework *fw)
>  	static const int values[] = { 0, 1, 2, 4 };
>  	int i;
>  
> -	for (i = 0; i < 4; i++) {
> +	for (i = 0; i < FWTS_ARRAY_SIZE(values); i++) {
>  		ACPI_OBJECT arg[1];
>  		arg[0].Type = ACPI_TYPE_INTEGER;
>  		arg[0].Integer.Value = values[i];
> 

Acked-by: Colin Ian King <colin.king@canonical.com>
Ivan Hu May 8, 2020, 7:54 a.m. UTC | #2
On 5/6/20 5:44 AM, Alex Hung wrote:
> There are no functional changes.
> 
> Signed-off-by: Alex Hung <alex.hung@canonical.com>
> ---
>  src/acpi/devices/battery/battery.c | 6 +++---
>  src/acpi/method/method.c           | 6 +++---
>  2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/src/acpi/devices/battery/battery.c b/src/acpi/devices/battery/battery.c
> index 630c07f1..74565169 100644
> --- a/src/acpi/devices/battery/battery.c
> +++ b/src/acpi/devices/battery/battery.c
> @@ -545,7 +545,7 @@ static int method_test_BTP(fwts_framework *fw)
>  	ACPI_STATUS status;
>  	uint8_t i;
>  
> -	for (i = 0; i < sizeof(values) / sizeof(int); i++) {
> +	for (i = 0; i < FWTS_ARRAY_SIZE(values); i++) {
>  		ACPI_OBJECT arg[1];
>  		arg[0].Type = ACPI_TYPE_INTEGER;
>  		arg[0].Integer.Value = values[i];
> @@ -626,7 +626,7 @@ static int method_test_BTM(fwts_framework *fw)
>  	ACPI_STATUS status;
>  	uint8_t i;
>  
> -	for (i = 0; i < sizeof(values) / sizeof(int); i++) {
> +	for (i = 0; i < FWTS_ARRAY_SIZE(values); i++) {
>  		ACPI_OBJECT arg[1];
>  		arg[0].Type = ACPI_TYPE_INTEGER;
>  		arg[0].Integer.Value = values[i];
> @@ -686,7 +686,7 @@ static int method_test_BMC(fwts_framework *fw)
>  	ACPI_STATUS status;
>  	uint8_t i;
>  
> -	for (i = 0; i < sizeof(values) / sizeof(int); i++) {
> +	for (i = 0; i < FWTS_ARRAY_SIZE(values); i++) {
>  		ACPI_OBJECT arg[1];
>  		arg[0].Type = ACPI_TYPE_INTEGER;
>  		arg[0].Integer.Value = values[i];
> diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c
> index cd4d15c7..68973847 100644
> --- a/src/acpi/method/method.c
> +++ b/src/acpi/method/method.c
> @@ -4354,7 +4354,7 @@ static int method_test_BTP(fwts_framework *fw)
>  	static const int values[] = { 0, 1, 100, 200, 0x7fffffff };
>  	int i;
>  
> -	for (i = 0; i < 5; i++) {
> +	for (i = 0; i < FWTS_ARRAY_SIZE(values); i++) {
>  		ACPI_OBJECT arg[1];
>  		arg[0].Type = ACPI_TYPE_INTEGER;
>  		arg[0].Integer.Value = values[i];
> @@ -4394,7 +4394,7 @@ static int method_test_BTM(fwts_framework *fw)
>  	static const int values[] = { 0, 1, 100, 200, 0x7fffffff };
>  	int i;
>  
> -	for (i = 0 ; i < 5; i++) {
> +	for (i = 0; i < FWTS_ARRAY_SIZE(values); i++) {
>  		ACPI_OBJECT arg[1];
>  		arg[0].Type = ACPI_TYPE_INTEGER;
>  		arg[0].Integer.Value = values[i];
> @@ -4440,7 +4440,7 @@ static int method_test_BMC(fwts_framework *fw)
>  	static const int values[] = { 0, 1, 2, 4 };
>  	int i;
>  
> -	for (i = 0; i < 4; i++) {
> +	for (i = 0; i < FWTS_ARRAY_SIZE(values); i++) {
>  		ACPI_OBJECT arg[1];
>  		arg[0].Type = ACPI_TYPE_INTEGER;
>  		arg[0].Integer.Value = values[i];
> 

Acked-by: Ivan Hu <ivan.hu@canonical.com>
diff mbox series

Patch

diff --git a/src/acpi/devices/battery/battery.c b/src/acpi/devices/battery/battery.c
index 630c07f1..74565169 100644
--- a/src/acpi/devices/battery/battery.c
+++ b/src/acpi/devices/battery/battery.c
@@ -545,7 +545,7 @@  static int method_test_BTP(fwts_framework *fw)
 	ACPI_STATUS status;
 	uint8_t i;
 
-	for (i = 0; i < sizeof(values) / sizeof(int); i++) {
+	for (i = 0; i < FWTS_ARRAY_SIZE(values); i++) {
 		ACPI_OBJECT arg[1];
 		arg[0].Type = ACPI_TYPE_INTEGER;
 		arg[0].Integer.Value = values[i];
@@ -626,7 +626,7 @@  static int method_test_BTM(fwts_framework *fw)
 	ACPI_STATUS status;
 	uint8_t i;
 
-	for (i = 0; i < sizeof(values) / sizeof(int); i++) {
+	for (i = 0; i < FWTS_ARRAY_SIZE(values); i++) {
 		ACPI_OBJECT arg[1];
 		arg[0].Type = ACPI_TYPE_INTEGER;
 		arg[0].Integer.Value = values[i];
@@ -686,7 +686,7 @@  static int method_test_BMC(fwts_framework *fw)
 	ACPI_STATUS status;
 	uint8_t i;
 
-	for (i = 0; i < sizeof(values) / sizeof(int); i++) {
+	for (i = 0; i < FWTS_ARRAY_SIZE(values); i++) {
 		ACPI_OBJECT arg[1];
 		arg[0].Type = ACPI_TYPE_INTEGER;
 		arg[0].Integer.Value = values[i];
diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c
index cd4d15c7..68973847 100644
--- a/src/acpi/method/method.c
+++ b/src/acpi/method/method.c
@@ -4354,7 +4354,7 @@  static int method_test_BTP(fwts_framework *fw)
 	static const int values[] = { 0, 1, 100, 200, 0x7fffffff };
 	int i;
 
-	for (i = 0; i < 5; i++) {
+	for (i = 0; i < FWTS_ARRAY_SIZE(values); i++) {
 		ACPI_OBJECT arg[1];
 		arg[0].Type = ACPI_TYPE_INTEGER;
 		arg[0].Integer.Value = values[i];
@@ -4394,7 +4394,7 @@  static int method_test_BTM(fwts_framework *fw)
 	static const int values[] = { 0, 1, 100, 200, 0x7fffffff };
 	int i;
 
-	for (i = 0 ; i < 5; i++) {
+	for (i = 0; i < FWTS_ARRAY_SIZE(values); i++) {
 		ACPI_OBJECT arg[1];
 		arg[0].Type = ACPI_TYPE_INTEGER;
 		arg[0].Integer.Value = values[i];
@@ -4440,7 +4440,7 @@  static int method_test_BMC(fwts_framework *fw)
 	static const int values[] = { 0, 1, 2, 4 };
 	int i;
 
-	for (i = 0; i < 4; i++) {
+	for (i = 0; i < FWTS_ARRAY_SIZE(values); i++) {
 		ACPI_OBJECT arg[1];
 		arg[0].Type = ACPI_TYPE_INTEGER;
 		arg[0].Integer.Value = values[i];