Re: [PATCH 09/14] thermal/x86_pkg_temp_thermal: Support multi-die/package

From: Thomas Gleixner
Date: Fri Apr 05 2019 - 14:29:36 EST


On Tue, 26 Feb 2019, Len Brown wrote:
> static int __init pkg_temp_thermal_init(void)
> {
> int ret;
> + struct cpuinfo_x86 *c = &cpu_data(0);
>
> if (!x86_match_cpu(pkg_temp_thermal_ids))
> return -ENODEV;
>
> - max_packages = topology_max_packages();
> + max_packages = topology_max_packages() * c->x86_max_dies;

This is really a sloppy hack. Just because cpuinfo is accessible it's not a
good idea to fiddle with it in a driver. We went great length to abstract
that stuff. So please add a new helper function topology_max_dies() and
retrieve it from that.

Thanks,

tglx