Subject: linux-next: manual merge of the thermal tree with the pm tree

From: Stephen Rothwell <[email-masked]>
Date: Thu, 5 Jan 2023 10:03:02 +1100

Hi all,

Today's linux-next merge of the thermal tree got a conflict in:

  drivers/thermal/intel/int340x_thermal/processor_thermal_device.c

between commit:

  d91a4714e54e ("thermal/int340x/processor_thermal: Use Intel TCC library")

from the pm tree and commit:

  e503a68ebfe3 ("thermal/intel/int340x: Replace parameter to simplify")

from the thermal tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc drivers/thermal/intel/int340x_thermal/processor_thermal_device.c
index a2ea22f2bffd,317703027ce9..000000000000
--- a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c
+++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c
@@@ -118,22 -174,39 +118,18 @@@ static int proc_thermal_get_zone_temp(s
  	*temp = 0;
  
  	for_each_online_cpu(cpu) {
 -		err = rdmsr_safe_on_cpu(cpu, MSR_IA32_THERM_STATUS, &eax,
 -					&edx);
 -		if (err)
 -			goto err_ret;
 -		else {
 -			if (eax & 0x80000000) {
 -				curr_temp_off = (eax >> 16) & 0x7f;
 -				if (!*temp || curr_temp_off < *temp)
 -					*temp = curr_temp_off;
 -			} else {
 -				err = -EINVAL;
 -				goto err_ret;
 -			}
 -		}
 +		curr_temp = intel_tcc_get_temp(cpu, false);
 +		if (curr_temp < 0)
 +			return curr_temp;
 +		if (!*temp || curr_temp > *temp)
 +			*temp = curr_temp;
  	}
  
 -	return 0;
 -err_ret:
 -	return err;
 -}
 -
 -static int proc_thermal_get_zone_temp(struct thermal_zone_device *zone,
 -					 int *temp)
 -{
 -	int ret;
 -
 -	ret = read_temp_msr(temp);
 -	if (!ret)
 -		*temp = (stored_tjmax - *temp) * 1000;
 +	*temp *= 1000;
  
 -	return ret;
 +	return 0;
  }
  
- static struct thermal_zone_device_ops proc_thermal_local_ops = {
- 	.get_temp       = proc_thermal_get_zone_temp,
- };
- 
  static int proc_thermal_read_ppcc(struct proc_thermal_device *proc_priv)
  {
  	int i;
@@@ -225,11 -298,12 +221,11 @@@ int proc_thermal_add(struct device *dev
  	status = acpi_evaluate_integer(adev->handle, "_TMP", NULL, &tmp);
  	if (ACPI_FAILURE(status)) {
  		/* there is no _TMP method, add local method */
 -		stored_tjmax = get_tjmax();
 -		if (stored_tjmax > 0)
 +		if (intel_tcc_get_tjmax(-1) > 0)
- 			ops = &proc_thermal_local_ops;
+ 			get_temp = proc_thermal_get_zone_temp;
  	}
  
- 	proc_priv->int340x_zone = int340x_thermal_zone_add(adev, ops);
+ 	proc_priv->int340x_zone = int340x_thermal_zone_add(adev, get_temp);
  	if (IS_ERR(proc_priv->int340x_zone)) {
  		return PTR_ERR(proc_priv->int340x_zone);
  	} else