diff mbox

[06/18] acpi: s3power: print format using inttypes

Message ID 1348427041-4913-7-git-send-email-colin.king@canonical.com
State Accepted
Headers show

Commit Message

Colin Ian King Sept. 23, 2012, 7:03 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/acpi/s3power/s3power.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Keng-Yu Lin Sept. 26, 2012, 10:01 a.m. UTC | #1
On Mon, Sep 24, 2012 at 3:03 AM, 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/s3power/s3power.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/src/acpi/s3power/s3power.c b/src/acpi/s3power/s3power.c
> index e5c4ba0..a57bcba 100644
> --- a/src/acpi/s3power/s3power.c
> +++ b/src/acpi/s3power/s3power.c
> @@ -28,6 +28,7 @@
>  #include <sys/stat.h>
>  #include <unistd.h>
>  #include <time.h>
> +#include <inttypes.h>
>
>  #define PM_SUSPEND "pm-suspend"
>
> @@ -122,7 +123,7 @@ static void s3power_difference(fwts_framework *fw,
>         float hourly_loss;
>
>         if (before != 0) {
> -               fwts_log_info(fw, "Change in capacity: %d %s\n", (int)diff, units);
> +               fwts_log_info(fw, "Change in capacity: %" PRId32 " %s\n", diff, units);
>                 hourly_loss = ((float)diff * 3600.0) / (float)s3power_sleep_delay;
>                 if (diff < 0) {
>                         fwts_log_error(fw, "Negative loss of power, are you sure the machine was not charging?");
> @@ -130,7 +131,7 @@ static void s3power_difference(fwts_framework *fw,
>                 fwts_log_info(fw, "Loss of %7.4f %s per hour.", hourly_loss, units);
>                 if ((diff > 0) && (battery_capacity > 0)) {
>                         float duration = (float)battery_capacity / hourly_loss;
> -                       fwts_log_info(fw, "The %d %s battery will provide %5.2f hours of suspend time.",
> +                       fwts_log_info(fw, "The %" PRIu32 " %s battery will provide %5.2f hours of suspend time.",
>                                 battery_capacity, units, duration);
>
>                         if (duration < 24.0) {
> --
> 1.7.10.4
>
Acked-by: Keng-Yu Lin <kengyu@canonical.com>
Ivan Hu Oct. 2, 2012, 2:25 a.m. UTC | #2
On 09/24/2012 03:03 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/acpi/s3power/s3power.c |    5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/src/acpi/s3power/s3power.c b/src/acpi/s3power/s3power.c
> index e5c4ba0..a57bcba 100644
> --- a/src/acpi/s3power/s3power.c
> +++ b/src/acpi/s3power/s3power.c
> @@ -28,6 +28,7 @@
>   #include <sys/stat.h>
>   #include <unistd.h>
>   #include <time.h>
> +#include <inttypes.h>
>
>   #define PM_SUSPEND "pm-suspend"
>
> @@ -122,7 +123,7 @@ static void s3power_difference(fwts_framework *fw,
>   	float hourly_loss;
>
>   	if (before != 0) {
> -		fwts_log_info(fw, "Change in capacity: %d %s\n", (int)diff, units);
> +		fwts_log_info(fw, "Change in capacity: %" PRId32 " %s\n", diff, units);
>   		hourly_loss = ((float)diff * 3600.0) / (float)s3power_sleep_delay;
>   		if (diff < 0) {
>   			fwts_log_error(fw, "Negative loss of power, are you sure the machine was not charging?");
> @@ -130,7 +131,7 @@ static void s3power_difference(fwts_framework *fw,
>   		fwts_log_info(fw, "Loss of %7.4f %s per hour.", hourly_loss, units);
>   		if ((diff > 0) && (battery_capacity > 0)) {
>   			float duration = (float)battery_capacity / hourly_loss;
> -			fwts_log_info(fw, "The %d %s battery will provide %5.2f hours of suspend time.",
> +			fwts_log_info(fw, "The %" PRIu32 " %s battery will provide %5.2f hours of suspend time.",
>   				battery_capacity, units, duration);
>
>   			if (duration < 24.0) {
>

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

Patch

diff --git a/src/acpi/s3power/s3power.c b/src/acpi/s3power/s3power.c
index e5c4ba0..a57bcba 100644
--- a/src/acpi/s3power/s3power.c
+++ b/src/acpi/s3power/s3power.c
@@ -28,6 +28,7 @@ 
 #include <sys/stat.h>
 #include <unistd.h>
 #include <time.h>
+#include <inttypes.h>
 
 #define PM_SUSPEND "pm-suspend"
 
@@ -122,7 +123,7 @@  static void s3power_difference(fwts_framework *fw,
 	float hourly_loss;
 
 	if (before != 0) {
-		fwts_log_info(fw, "Change in capacity: %d %s\n", (int)diff, units);
+		fwts_log_info(fw, "Change in capacity: %" PRId32 " %s\n", diff, units);
 		hourly_loss = ((float)diff * 3600.0) / (float)s3power_sleep_delay;
 		if (diff < 0) {
 			fwts_log_error(fw, "Negative loss of power, are you sure the machine was not charging?");
@@ -130,7 +131,7 @@  static void s3power_difference(fwts_framework *fw,
 		fwts_log_info(fw, "Loss of %7.4f %s per hour.", hourly_loss, units);
 		if ((diff > 0) && (battery_capacity > 0)) {
 			float duration = (float)battery_capacity / hourly_loss;
-			fwts_log_info(fw, "The %d %s battery will provide %5.2f hours of suspend time.",
+			fwts_log_info(fw, "The %" PRIu32 " %s battery will provide %5.2f hours of suspend time.",
 				battery_capacity, units, duration);
 
 			if (duration < 24.0) {