Commit 57c5b2ec authored by Daniel Lezcano's avatar Daniel Lezcano Committed by Zhang Rui
Browse files

thermal/drivers/core: Use governor table to initialize



Now that the governor table is in place and the macro allows to browse the
table, declare the governor so the entry is added in the governor table
in the init section.

The [un]register_thermal_governors function does no longer need to use the
exported [un]register thermal governor's specific function which in turn
call the [un]register_thermal_governor. The governors are fully
self-encapsulated.

The cyclic dependency is no longer needed, remove it.

Reviewed-by: default avatarAmit Kucheria <amit.kucheria@linaro.org>
Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: default avatarZhang Rui <rui.zhang@intel.com>
parent 980af75e
Loading
Loading
Loading
Loading
+1 −11
Original line number Diff line number Diff line
@@ -117,14 +117,4 @@ static struct thermal_governor thermal_gov_fair_share = {
	.name		= "fair_share",
	.throttle	= fair_share_throttle,
};

int thermal_gov_fair_share_register(void)
{
	return thermal_register_governor(&thermal_gov_fair_share);
}

void thermal_gov_fair_share_unregister(void)
{
	thermal_unregister_governor(&thermal_gov_fair_share);
}
THERMAL_GOVERNOR_DECLARE(thermal_gov_fair_share);
+1 −10
Original line number Diff line number Diff line
@@ -116,13 +116,4 @@ static struct thermal_governor thermal_gov_bang_bang = {
	.name		= "bang_bang",
	.throttle	= bang_bang_control,
};

int thermal_gov_bang_bang_register(void)
{
	return thermal_register_governor(&thermal_gov_bang_bang);
}

void thermal_gov_bang_bang_unregister(void)
{
	thermal_unregister_governor(&thermal_gov_bang_bang);
}
THERMAL_GOVERNOR_DECLARE(thermal_gov_bang_bang);
+1 −10
Original line number Diff line number Diff line
@@ -651,13 +651,4 @@ static struct thermal_governor thermal_gov_power_allocator = {
	.unbind_from_tz	= power_allocator_unbind,
	.throttle	= power_allocator_throttle,
};

int thermal_gov_power_allocator_register(void)
{
	return thermal_register_governor(&thermal_gov_power_allocator);
}

void thermal_gov_power_allocator_unregister(void)
{
	thermal_unregister_governor(&thermal_gov_power_allocator);
}
THERMAL_GOVERNOR_DECLARE(thermal_gov_power_allocator);
+1 −10
Original line number Diff line number Diff line
@@ -206,13 +206,4 @@ static struct thermal_governor thermal_gov_step_wise = {
	.name		= "step_wise",
	.throttle	= step_wise_throttle,
};

int thermal_gov_step_wise_register(void)
{
	return thermal_register_governor(&thermal_gov_step_wise);
}

void thermal_gov_step_wise_unregister(void)
{
	thermal_unregister_governor(&thermal_gov_step_wise);
}
THERMAL_GOVERNOR_DECLARE(thermal_gov_step_wise);
+29 −23
Original line number Diff line number Diff line
@@ -243,36 +243,42 @@ int thermal_build_list_of_policies(char *buf)
	return count;
}

static int __init thermal_register_governors(void)
static void __init thermal_unregister_governors(void)
{
	int result;
	struct thermal_governor **governor;

	result = thermal_gov_step_wise_register();
	if (result)
		return result;
	for_each_governor_table(governor)
		thermal_unregister_governor(*governor);
}

	result = thermal_gov_fair_share_register();
	if (result)
		return result;
static int __init thermal_register_governors(void)
{
	int ret = 0;
	struct thermal_governor **governor;

	result = thermal_gov_bang_bang_register();
	if (result)
		return result;
	for_each_governor_table(governor) {
		ret = thermal_register_governor(*governor);
		if (ret) {
			pr_err("Failed to register governor: '%s'",
			       (*governor)->name);
			break;
		}

	result = thermal_gov_user_space_register();
	if (result)
		return result;
		pr_info("Registered thermal governor '%s'",
			(*governor)->name);
	}

	return thermal_gov_power_allocator_register();
	if (ret) {
		struct thermal_governor **gov;

		for_each_governor_table(gov) {
			if (gov == governor)
				break;
			thermal_unregister_governor(*gov);
		}
	}

static void __init thermal_unregister_governors(void)
{
	thermal_gov_step_wise_unregister();
	thermal_gov_fair_share_unregister();
	thermal_gov_bang_bang_unregister();
	thermal_gov_user_space_unregister();
	thermal_gov_power_allocator_unregister();
	return ret;
}

/*
Loading