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

Commit 28732b62 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "drivers: qcom: lpm-stats: reset CPU stats from that CPU"

parents c0100c02 b0bf3abc
Loading
Loading
Loading
Loading
+16 −0
Original line number Original line Diff line number Diff line
@@ -21,6 +21,7 @@
#include <linux/debugfs.h>
#include <linux/debugfs.h>
#include <linux/sched.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/slab.h>
#include <linux/smp.h>
#include <linux/suspend.h>
#include <linux/suspend.h>
#include <soc/qcom/spm.h>
#include <soc/qcom/spm.h>
#include <soc/qcom/pm.h>
#include <soc/qcom/pm.h>
@@ -255,6 +256,15 @@ static ssize_t level_stats_file_write(struct file *file,
	return count;
	return count;
}
}


static void reset_cpu_stats(void *info)
{
	struct lpm_stats *stats = &(*this_cpu_ptr(&(cpu_stats)));
	int i;

	for (i = 0; i < stats->num_levels; i++)
		level_stats_reset(&stats->time_stats[i]);
}

static ssize_t lpm_stats_file_write(struct file *file,
static ssize_t lpm_stats_file_write(struct file *file,
	const char __user *buffer, size_t count, loff_t *off)
	const char __user *buffer, size_t count, loff_t *off)
{
{
@@ -276,6 +286,12 @@ static ssize_t lpm_stats_file_write(struct file *file,
		return -EINVAL;
		return -EINVAL;


	level_stats_reset_all(stats);
	level_stats_reset_all(stats);
	/*
	 * Wake up each CPU and reset the stats from that CPU,
	 * for that CPU, so we could have better timestamp for
	 * accounting.
	 */
	on_each_cpu(reset_cpu_stats, NULL, 1);


	return count;
	return count;
}
}