The intension for this patch was to address SW_TABLET_MODE detection problem. It is during the initial investigation; two other issues were identified and are related to the initial task. First, several WMI queries were reporting error 0x05 including HPWMI_HARDWARE_QUERY that is responsible for returning dock and table modes values. See patch v5 part 2 and 3 comments for list of WMI queries affected. The driver now reports the appropriate states and values correctly. Lastly, a limiting data size restriction was discovered. struct bios_args data member size limits all possible WMI commands to those requiring buffer size of 128 bytes or less. Several WMI commands and queries require a buffer size larger than 128 bytes hence limiting current and new feature supported by the driver. hp_wmi_perform_query function changed to handle the memory allocation and release of any required buffer size. Description of changes between version 4 and version 5 ------------------------------------------------------ v5 patch 1: Fix hp_wmi_read_int() reporting error (0x05) -Moved hp_wmi_read_int() to a separate patch. -Initially part of v4 patch 1 v5 patch 2: Fix SW_TABLET_MODE detection method -Remaining part are changes included in v4 patch 1 -Replaced return values with -ENODEV errors -Updated how the closing return value is calculated. -Patch 2 is dependent of patch 1 in order for tablet mode detection to work properly v5 patch 3: Fix 0x05 error code reported by several WMI calls -No new changes were introduced. -Patch is identical to v4 patch 2 v5 patch 4: Changing bios_args.data to be dynamically allocated -Replace sizeof() with struct_size() and flex_array_size() helpers -Added ret variable value when the output buffer is zero Jorge Lopez (4): Fix hp_wmi_read_int() reporting error (0x05) Fix SW_TABLET_MODE detection method Fix 0x05 error code reported by several WMI calls Changing bios_args.data to be dynamically allocated drivers/platform/x86/hp-wmi.c | 159 ++++++++++++++++++++++------------ 1 file changed, 106 insertions(+), 53 deletions(-) -- 2.25.1