Subject: linux-next: manual merge of the drivers-x86 tree with the drivers-x86-fixes tree

From: Stephen Rothwell <[email-masked]>
Date: Tue, 22 Apr 2025 17:56:08 +1000

Hi all,

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

  drivers/platform/x86/dell/alienware-wmi-wmax.c

between commit:

  4a8e04e2bdcb ("platform/x86: alienware-wmi-wmax: Fix uninitialized variable due to bad error handling")

from the drivers-x86-fixes tree and commit:

  32b6372ddd43 ("platform/x86: alienware-wmi-wmax: Improve platform profile probe")

from the drivers-x86 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/platform/x86/dell/alienware-wmi-wmax.c
index 3f9e1e986ecf,faeddfe3b79e..000000000000
--- a/drivers/platform/x86/dell/alienware-wmi-wmax.c
+++ b/drivers/platform/x86/dell/alienware-wmi-wmax.c
@@@ -189,48 -174,61 +214,69 @@@ static const struct dmi_system_id awcc_
  		},
  		.driver_data = &g_series_quirks,
  	},
 +	{
 +		.ident = "Dell Inc. G5 5505",
 +		.matches = {
 +			DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
 +			DMI_MATCH(DMI_PRODUCT_NAME, "G5 5505"),
 +		},
 +		.driver_data = &g_series_quirks,
 +	},
  };
  
- enum WMAX_THERMAL_INFORMATION_OPERATIONS {
- 	WMAX_OPERATION_SYS_DESCRIPTION		= 0x02,
- 	WMAX_OPERATION_LIST_IDS			= 0x03,
- 	WMAX_OPERATION_CURRENT_PROFILE		= 0x0B,
+ enum AWCC_GET_FAN_SENSORS_OPERATIONS {
+ 	AWCC_OP_GET_TOTAL_FAN_TEMPS		= 0x01,
+ 	AWCC_OP_GET_FAN_TEMP_ID			= 0x02,
  };
  
- enum WMAX_THERMAL_CONTROL_OPERATIONS {
- 	WMAX_OPERATION_ACTIVATE_PROFILE		= 0x01,
+ enum AWCC_THERMAL_INFORMATION_OPERATIONS {
+ 	AWCC_OP_GET_SYSTEM_DESCRIPTION		= 0x02,
+ 	AWCC_OP_GET_RESOURCE_ID			= 0x03,
+ 	AWCC_OP_GET_TEMPERATURE			= 0x04,
+ 	AWCC_OP_GET_FAN_RPM			= 0x05,
+ 	AWCC_OP_GET_FAN_MIN_RPM			= 0x08,
+ 	AWCC_OP_GET_FAN_MAX_RPM			= 0x09,
+ 	AWCC_OP_GET_CURRENT_PROFILE		= 0x0B,
+ 	AWCC_OP_GET_FAN_BOOST			= 0x0C,
  };
  
- enum WMAX_GAME_SHIFT_STATUS_OPERATIONS {
- 	WMAX_OPERATION_TOGGLE_GAME_SHIFT	= 0x01,
- 	WMAX_OPERATION_GET_GAME_SHIFT_STATUS	= 0x02,
+ enum AWCC_THERMAL_CONTROL_OPERATIONS {
+ 	AWCC_OP_ACTIVATE_PROFILE		= 0x01,
+ 	AWCC_OP_SET_FAN_BOOST			= 0x02,
  };
  
- enum WMAX_THERMAL_TABLES {
- 	WMAX_THERMAL_TABLE_BASIC		= 0x90,
- 	WMAX_THERMAL_TABLE_USTT			= 0xA0,
+ enum AWCC_GAME_SHIFT_STATUS_OPERATIONS {
+ 	AWCC_OP_TOGGLE_GAME_SHIFT		= 0x01,
+ 	AWCC_OP_GET_GAME_SHIFT_STATUS		= 0x02,
  };
  
- enum wmax_thermal_mode {
- 	THERMAL_MODE_USTT_BALANCED,
- 	THERMAL_MODE_USTT_BALANCED_PERFORMANCE,
- 	THERMAL_MODE_USTT_COOL,
- 	THERMAL_MODE_USTT_QUIET,
- 	THERMAL_MODE_USTT_PERFORMANCE,
- 	THERMAL_MODE_USTT_LOW_POWER,
- 	THERMAL_MODE_BASIC_QUIET,
- 	THERMAL_MODE_BASIC_BALANCED,
- 	THERMAL_MODE_BASIC_BALANCED_PERFORMANCE,
- 	THERMAL_MODE_BASIC_PERFORMANCE,
- 	THERMAL_MODE_LAST,
+ enum AWCC_THERMAL_TABLES {
+ 	AWCC_THERMAL_TABLE_LEGACY		= 0x9,
+ 	AWCC_THERMAL_TABLE_USTT			= 0xA,
+ };
+ 
+ enum AWCC_SPECIAL_THERMAL_CODES {
+ 	AWCC_SPECIAL_PROFILE_CUSTOM		= 0x00,
+ 	AWCC_SPECIAL_PROFILE_GMODE		= 0xAB,
+ };
+ 
+ enum AWCC_TEMP_SENSOR_TYPES {
+ 	AWCC_TEMP_SENSOR_CPU			= 0x01,
+ 	AWCC_TEMP_SENSOR_GPU			= 0x06,
+ };
+ 
+ enum awcc_thermal_profile {
+ 	AWCC_PROFILE_USTT_BALANCED,
+ 	AWCC_PROFILE_USTT_BALANCED_PERFORMANCE,
+ 	AWCC_PROFILE_USTT_COOL,
+ 	AWCC_PROFILE_USTT_QUIET,
+ 	AWCC_PROFILE_USTT_PERFORMANCE,
+ 	AWCC_PROFILE_USTT_LOW_POWER,
+ 	AWCC_PROFILE_LEGACY_QUIET,
+ 	AWCC_PROFILE_LEGACY_BALANCED,
+ 	AWCC_PROFILE_LEGACY_BALANCED_PERFORMANCE,
+ 	AWCC_PROFILE_LEGACY_PERFORMANCE,
+ 	AWCC_PROFILE_LAST,
  };
  
  struct wmax_led_args {
@@@ -639,35 -1192,38 +1240,38 @@@ static int awcc_platform_profile_probe(
  {
  	enum platform_profile_option profile;
  	struct awcc_priv *priv = drvdata;
- 	enum wmax_thermal_mode mode;
- 	u8 sys_desc[4];
- 	u32 first_mode;
- 	u32 out_data;
+ 	enum awcc_thermal_profile mode;
+ 	u8 id, offset = 0;
  	int ret;
  
- 	ret = wmax_thermal_information(priv->wdev, WMAX_OPERATION_SYS_DESCRIPTION,
- 				       0, (u32 *) &sys_desc);
- 	if (ret < 0)
- 		return ret;
+ 	/*
+ 	 * Thermal profile IDs are listed last at offset
+ 	 *	fan_count + temp_count + unknown_count
+ 	 */
+ 	for (unsigned int i = 0; i < ARRAY_SIZE(priv->res_count) - 1; i++)
+ 		offset += priv->res_count[i];
  
- 	first_mode = sys_desc[0] + sys_desc[1];
- 
- 	for (u32 i = 0; i < sys_desc[3]; i++) {
- 		ret = wmax_thermal_information(priv->wdev, WMAX_OPERATION_LIST_IDS,
- 					       i + first_mode, &out_data);
+ 	for (unsigned int i = 0; i < priv->profile_count; i++) {
+ 		ret = awcc_op_get_resource_id(priv->wdev, i + offset, &id);
 -		if (ret == -EIO)
 -			return ret;
+ 		/*
+ 		 * Some devices report an incorrect number of thermal profiles
+ 		 * so the resource ID list may end prematurely
+ 		 */
  		if (ret == -EBADRQC)
  			break;
 +		if (ret)
 +			return ret;
  
- 		if (!is_wmax_thermal_code(out_data))
+ 		if (!is_awcc_thermal_profile_id(id)) {
+ 			dev_dbg(&priv->wdev->dev, "Unmapped thermal profile ID 0x%02x\n", id);
  			continue;
+ 		}
  
- 		mode = out_data & WMAX_THERMAL_MODE_MASK;
- 		profile = wmax_mode_to_platform_profile[mode];
- 		priv->supported_thermal_profiles[profile] = out_data;
+ 		mode = FIELD_GET(AWCC_THERMAL_MODE_MASK, id);
+ 		profile = awcc_mode_to_platform_profile[mode];
+ 		priv->supported_profiles[profile] = id;
  
- 		set_bit(profile, choices);
+ 		__set_bit(profile, choices);
  	}
  
  	if (bitmap_empty(choices, PLATFORM_PROFILE_LAST))