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

Commit c0674405 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "PM / EM: Fix debugfs entry creation"

parents 495e1d77 362ed223
Loading
Loading
Loading
Loading
+30 −0
Original line number Diff line number Diff line
@@ -55,6 +55,11 @@ static void em_debug_create_pd(struct em_perf_domain *pd, int cpu)
	char name[8];
	int i;

	if (!rootdir) {
		pr_err("Power domains created prior to em_debug_init\n");
		return;
	}

	snprintf(name, sizeof(name), "pd%d", cpu);

	/* Create the directory of the performance domain */
@@ -69,9 +74,34 @@ static void em_debug_create_pd(struct em_perf_domain *pd, int cpu)

static int __init em_debug_init(void)
{
	int cpu;
	struct em_perf_domain *pd;
	cpumask_t span;

	cpumask_copy(&span, cpu_possible_mask);

	/* Create /sys/kernel/debug/energy_model directory */
	rootdir = debugfs_create_dir("energy_model", NULL);

	for_each_cpu(cpu, &span) {
		char name[8];

		pd = em_cpu_get(cpu);
		if (!pd) {
			pr_info("Power domains not created yet\n");
			break;
		}

		snprintf(name, sizeof(name), "pd%d", cpu);
		if (debugfs_lookup(name, rootdir)) {
			pr_info("Power domains already created\n");
			break;
		}

		em_debug_create_pd(pd, cpu);
		cpumask_andnot(&span, &span, to_cpumask(pd->cpus));
	}

	return 0;
}
fs_initcall(em_debug_init);