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

Commit 2f49afc2 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

cpufreq: intel_pstate: Drop struct cpu_defaults



The cpu_defaults structure is redundant, because it only contains
one member of type struct pstate_funcs which can be used directly
instead of struct cpu_defaults.

For this reason, drop struct cpu_defaults, use struct pstate_funcs
directly instead of it where applicable and rename all of the
variables of that type accordingly.

Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent de4a76cb
Loading
Loading
Loading
Loading
+67 −87
Original line number Diff line number Diff line
@@ -328,14 +328,6 @@ struct pstate_funcs {
			    unsigned int flags);
};

/**
 * struct cpu_defaults- Per CPU model default config data
 * @funcs:		Callback function data
 */
struct cpu_defaults {
	struct pstate_funcs funcs;
};

static struct pstate_funcs pstate_funcs __read_mostly;
static struct pstate_adjust_policy pid_params __read_mostly = {
	.sample_rate_ms = 10,
@@ -1809,8 +1801,7 @@ static void intel_pstate_update_util(struct update_util_data *data, u64 time,
	}
}

static struct cpu_defaults core_params = {
	.funcs = {
static struct pstate_funcs core_funcs = {
	.get_max = core_get_max_pstate,
	.get_max_physical = core_get_max_pstate_physical,
	.get_min = core_get_min_pstate,
@@ -1818,11 +1809,9 @@ static struct cpu_defaults core_params = {
	.get_scaling = core_get_scaling,
	.get_val = core_get_val,
	.update_util = intel_pstate_update_util_pid,
	},
};

static const struct cpu_defaults silvermont_params = {
	.funcs = {
static const struct pstate_funcs silvermont_funcs = {
	.get_max = atom_get_max_pstate,
	.get_max_physical = atom_get_max_pstate,
	.get_min = atom_get_min_pstate,
@@ -1831,11 +1820,9 @@ static const struct cpu_defaults silvermont_params = {
	.get_scaling = silvermont_get_scaling,
	.get_vid = atom_get_vid,
	.update_util = intel_pstate_update_util,
	},
};

static const struct cpu_defaults airmont_params = {
	.funcs = {
static const struct pstate_funcs airmont_funcs = {
	.get_max = atom_get_max_pstate,
	.get_max_physical = atom_get_max_pstate,
	.get_min = atom_get_min_pstate,
@@ -1844,11 +1831,9 @@ static const struct cpu_defaults airmont_params = {
	.get_scaling = airmont_get_scaling,
	.get_vid = atom_get_vid,
	.update_util = intel_pstate_update_util,
	},
};

static const struct cpu_defaults knl_params = {
	.funcs = {
static const struct pstate_funcs knl_funcs = {
	.get_max = core_get_max_pstate,
	.get_max_physical = core_get_max_pstate_physical,
	.get_min = core_get_min_pstate,
@@ -1856,11 +1841,9 @@ static const struct cpu_defaults knl_params = {
	.get_scaling = core_get_scaling,
	.get_val = core_get_val,
	.update_util = intel_pstate_update_util_pid,
	},
};

static const struct cpu_defaults bxt_params = {
	.funcs = {
static const struct pstate_funcs bxt_funcs = {
	.get_max = core_get_max_pstate,
	.get_max_physical = core_get_max_pstate_physical,
	.get_min = core_get_min_pstate,
@@ -1868,7 +1851,6 @@ static const struct cpu_defaults bxt_params = {
	.get_scaling = core_get_scaling,
	.get_val = core_get_val,
	.update_util = intel_pstate_update_util,
	},
};

#define ICPU(model, policy) \
@@ -1876,38 +1858,38 @@ static const struct cpu_defaults bxt_params = {
			(unsigned long)&policy }

static const struct x86_cpu_id intel_pstate_cpu_ids[] = {
	ICPU(INTEL_FAM6_SANDYBRIDGE, 		core_params),
	ICPU(INTEL_FAM6_SANDYBRIDGE_X,		core_params),
	ICPU(INTEL_FAM6_ATOM_SILVERMONT1,	silvermont_params),
	ICPU(INTEL_FAM6_IVYBRIDGE,		core_params),
	ICPU(INTEL_FAM6_HASWELL_CORE,		core_params),
	ICPU(INTEL_FAM6_BROADWELL_CORE,		core_params),
	ICPU(INTEL_FAM6_IVYBRIDGE_X,		core_params),
	ICPU(INTEL_FAM6_HASWELL_X,		core_params),
	ICPU(INTEL_FAM6_HASWELL_ULT,		core_params),
	ICPU(INTEL_FAM6_HASWELL_GT3E,		core_params),
	ICPU(INTEL_FAM6_BROADWELL_GT3E,		core_params),
	ICPU(INTEL_FAM6_ATOM_AIRMONT,		airmont_params),
	ICPU(INTEL_FAM6_SKYLAKE_MOBILE,		core_params),
	ICPU(INTEL_FAM6_BROADWELL_X,		core_params),
	ICPU(INTEL_FAM6_SKYLAKE_DESKTOP,	core_params),
	ICPU(INTEL_FAM6_BROADWELL_XEON_D,	core_params),
	ICPU(INTEL_FAM6_XEON_PHI_KNL,		knl_params),
	ICPU(INTEL_FAM6_XEON_PHI_KNM,		knl_params),
	ICPU(INTEL_FAM6_ATOM_GOLDMONT,		bxt_params),
	ICPU(INTEL_FAM6_SANDYBRIDGE, 		core_funcs),
	ICPU(INTEL_FAM6_SANDYBRIDGE_X,		core_funcs),
	ICPU(INTEL_FAM6_ATOM_SILVERMONT1,	silvermont_funcs),
	ICPU(INTEL_FAM6_IVYBRIDGE,		core_funcs),
	ICPU(INTEL_FAM6_HASWELL_CORE,		core_funcs),
	ICPU(INTEL_FAM6_BROADWELL_CORE,		core_funcs),
	ICPU(INTEL_FAM6_IVYBRIDGE_X,		core_funcs),
	ICPU(INTEL_FAM6_HASWELL_X,		core_funcs),
	ICPU(INTEL_FAM6_HASWELL_ULT,		core_funcs),
	ICPU(INTEL_FAM6_HASWELL_GT3E,		core_funcs),
	ICPU(INTEL_FAM6_BROADWELL_GT3E,		core_funcs),
	ICPU(INTEL_FAM6_ATOM_AIRMONT,		airmont_funcs),
	ICPU(INTEL_FAM6_SKYLAKE_MOBILE,		core_funcs),
	ICPU(INTEL_FAM6_BROADWELL_X,		core_funcs),
	ICPU(INTEL_FAM6_SKYLAKE_DESKTOP,	core_funcs),
	ICPU(INTEL_FAM6_BROADWELL_XEON_D,	core_funcs),
	ICPU(INTEL_FAM6_XEON_PHI_KNL,		knl_funcs),
	ICPU(INTEL_FAM6_XEON_PHI_KNM,		knl_funcs),
	ICPU(INTEL_FAM6_ATOM_GOLDMONT,		bxt_funcs),
	{}
};
MODULE_DEVICE_TABLE(x86cpu, intel_pstate_cpu_ids);

static const struct x86_cpu_id intel_pstate_cpu_oob_ids[] __initconst = {
	ICPU(INTEL_FAM6_BROADWELL_XEON_D, core_params),
	ICPU(INTEL_FAM6_BROADWELL_X, core_params),
	ICPU(INTEL_FAM6_SKYLAKE_X, core_params),
	ICPU(INTEL_FAM6_BROADWELL_XEON_D, core_funcs),
	ICPU(INTEL_FAM6_BROADWELL_X, core_funcs),
	ICPU(INTEL_FAM6_SKYLAKE_X, core_funcs),
	{}
};

static const struct x86_cpu_id intel_pstate_cpu_ee_disable_ids[] = {
	ICPU(INTEL_FAM6_KABYLAKE_DESKTOP, core_params),
	ICPU(INTEL_FAM6_KABYLAKE_DESKTOP, core_funcs),
	{}
};

@@ -2576,7 +2558,7 @@ static int __init intel_pstate_init(void)
		return -ENODEV;

	if (x86_match_cpu(hwp_support_ids)) {
		copy_cpu_funcs(&core_params.funcs);
		copy_cpu_funcs(&core_funcs);
		if (no_hwp) {
			pstate_funcs.update_util = intel_pstate_update_util;
		} else {
@@ -2587,14 +2569,12 @@ static int __init intel_pstate_init(void)
		}
	} else {
		const struct x86_cpu_id *id;
		struct cpu_defaults *cpu_def;

		id = x86_match_cpu(intel_pstate_cpu_ids);
		if (!id)
			return -ENODEV;

		cpu_def = (struct cpu_defaults *)id->driver_data;
		copy_cpu_funcs(&cpu_def->funcs);
		copy_cpu_funcs((struct pstate_funcs *)id->driver_data);
	}

	if (intel_pstate_msrs_not_valid())