Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c5bb9191 authored by Ramakrishnan Ganesh's avatar Ramakrishnan Ganesh
Browse files

rpmh_master_stat: Fix accumulated sleep duration



Copy the content of accumulated duration to a temp variable
that can be modified for printing the adjusted sleep duration.

Change-Id: I2aab69d169980c8f2646d2a6b3cf2e270c789ec3
Signed-off-by: default avatarRamakrishnan Ganesh <ramakris@codeaurora.org>
parent 34e1614a
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -103,6 +103,7 @@ static ssize_t msm_rpmh_master_stats_print_data(char *prvbuf, ssize_t length,
				struct msm_rpmh_master_stats *record,
				const char *name)
{
	uint64_t temp_accumulated_duration = record->accumulated_duration;
	/*
	 * If a master is in sleep when reading the sleep stats from SMEM
	 * adjust the accumulated sleep duration to show actual sleep time.
@@ -110,7 +111,7 @@ static ssize_t msm_rpmh_master_stats_print_data(char *prvbuf, ssize_t length,
	 * the purpose of computing battery utilization.
	 */
	if (record->last_entered > record->last_exited)
		record->accumulated_duration +=
		temp_accumulated_duration +=
				(arch_counter_get_cntvct()
				- record->last_entered);

@@ -121,7 +122,7 @@ static ssize_t msm_rpmh_master_stats_print_data(char *prvbuf, ssize_t length,
			"\tSleep Accumulated Duration:0x%llx\n\n",
			name, record->version_id, record->counts,
			record->last_entered, record->last_exited,
			record->accumulated_duration);
			temp_accumulated_duration);
}

static ssize_t msm_rpmh_master_stats_show(struct kobject *kobj,