diff mbox series

[v1,1/1] platform/x86: int1092: Switch to use acpi_evaluate_dsm_typed()

Message ID 20230118095152.41427-1-andriy.shevchenko@linux.intel.com (mailing list archive)
State Superseded, archived
Headers show
Series [v1,1/1] platform/x86: int1092: Switch to use acpi_evaluate_dsm_typed() | expand

Commit Message

Andy Shevchenko Jan. 18, 2023, 9:51 a.m. UTC
The acpi_evaluate_dsm_typed() provides a way to check the type of the
object evaluated by _DSM call. Use it instead of open coded variant.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/platform/x86/intel/int1092/intel_sar.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

Comments

kernel test robot Jan. 18, 2023, 12:56 p.m. UTC | #1
Hi Andy,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v6.2-rc4]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/platform-x86-int1092-Switch-to-use-acpi_evaluate_dsm_typed/20230118-184845
patch link:    https://lore.kernel.org/r/20230118095152.41427-1-andriy.shevchenko%40linux.intel.com
patch subject: [PATCH v1 1/1] platform/x86: int1092: Switch to use acpi_evaluate_dsm_typed()
config: x86_64-allyesconfig
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
        # https://github.com/intel-lab-lkp/linux/commit/6051c9fba08cdbd6ea1baeac8664b8f4462b427d
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Andy-Shevchenko/platform-x86-int1092-Switch-to-use-acpi_evaluate_dsm_typed/20230118-184845
        git checkout 6051c9fba08cdbd6ea1baeac8664b8f4462b427d
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=x86_64 olddefconfig
        make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/platform/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   drivers/platform/x86/intel/int1092/intel_sar.c: In function 'sar_get_device_mode':
>> drivers/platform/x86/intel/int1092/intel_sar.c:134:13: warning: unused variable 'value' [-Wunused-variable]
     134 |         int value;
         |             ^~~~~


vim +/value +134 drivers/platform/x86/intel/int1092/intel_sar.c

dcfbd31ef4bcf6c Shravan S       2021-07-24  117  
dcfbd31ef4bcf6c Shravan S       2021-07-24  118  /**
dcfbd31ef4bcf6c Shravan S       2021-07-24  119   * sar_get_device_mode: Extraction of information from BIOS via DSM calls
dcfbd31ef4bcf6c Shravan S       2021-07-24  120   * @device: ACPI device for which to retrieve the data
dcfbd31ef4bcf6c Shravan S       2021-07-24  121   *
dcfbd31ef4bcf6c Shravan S       2021-07-24  122   * Retrieve the current device mode information from the BIOS.
dcfbd31ef4bcf6c Shravan S       2021-07-24  123   *
dcfbd31ef4bcf6c Shravan S       2021-07-24  124   * Return:
dcfbd31ef4bcf6c Shravan S       2021-07-24  125   * AE_OK on success
dcfbd31ef4bcf6c Shravan S       2021-07-24  126   * AE_ERROR on error
dcfbd31ef4bcf6c Shravan S       2021-07-24  127   */
dcfbd31ef4bcf6c Shravan S       2021-07-24  128  static acpi_status sar_get_device_mode(struct platform_device *device)
dcfbd31ef4bcf6c Shravan S       2021-07-24  129  {
dcfbd31ef4bcf6c Shravan S       2021-07-24  130  	struct wwan_sar_context *context = dev_get_drvdata(&device->dev);
dcfbd31ef4bcf6c Shravan S       2021-07-24  131  	acpi_status status = AE_OK;
dcfbd31ef4bcf6c Shravan S       2021-07-24  132  	union acpi_object *out;
dcfbd31ef4bcf6c Shravan S       2021-07-24  133  	u32 rev = 0;
dcfbd31ef4bcf6c Shravan S       2021-07-24 @134  	int value;
dcfbd31ef4bcf6c Shravan S       2021-07-24  135  
6051c9fba08cdbd Andy Shevchenko 2023-01-18  136  	out = acpi_evaluate_dsm_typed(context->handle, &context->guid, rev,
6051c9fba08cdbd Andy Shevchenko 2023-01-18  137  				      COMMAND_ID_DEV_MODE, NULL, ACPI_TYPE_INTEGER);
6051c9fba08cdbd Andy Shevchenko 2023-01-18  138  	if (!out) {
dcfbd31ef4bcf6c Shravan S       2021-07-24  139  		dev_err(&device->dev, "DSM cmd:%d Failed to retrieve value\n", COMMAND_ID_DEV_MODE);
dcfbd31ef4bcf6c Shravan S       2021-07-24  140  		status = AE_ERROR;
dcfbd31ef4bcf6c Shravan S       2021-07-24  141  		goto dev_mode_error;
dcfbd31ef4bcf6c Shravan S       2021-07-24  142  	}
6051c9fba08cdbd Andy Shevchenko 2023-01-18  143  	context->sar_data.device_mode = out->integer.value;
dcfbd31ef4bcf6c Shravan S       2021-07-24  144  	update_sar_data(context);
dcfbd31ef4bcf6c Shravan S       2021-07-24  145  	sysfs_notify(&device->dev.kobj, NULL, SYSFS_DATANAME);
dcfbd31ef4bcf6c Shravan S       2021-07-24  146  
dcfbd31ef4bcf6c Shravan S       2021-07-24  147  dev_mode_error:
dcfbd31ef4bcf6c Shravan S       2021-07-24  148  	ACPI_FREE(out);
dcfbd31ef4bcf6c Shravan S       2021-07-24  149  	return status;
dcfbd31ef4bcf6c Shravan S       2021-07-24  150  }
dcfbd31ef4bcf6c Shravan S       2021-07-24  151
kernel test robot Jan. 18, 2023, 2:26 p.m. UTC | #2
Hi Andy,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v6.2-rc4 next-20230118]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/platform-x86-int1092-Switch-to-use-acpi_evaluate_dsm_typed/20230118-184845
patch link:    https://lore.kernel.org/r/20230118095152.41427-1-andriy.shevchenko%40linux.intel.com
patch subject: [PATCH v1 1/1] platform/x86: int1092: Switch to use acpi_evaluate_dsm_typed()
config: i386-randconfig-a004-20230116 (https://download.01.org/0day-ci/archive/20230118/202301182233.vDnTdKEG-lkp@intel.com/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/6051c9fba08cdbd6ea1baeac8664b8f4462b427d
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Andy-Shevchenko/platform-x86-int1092-Switch-to-use-acpi_evaluate_dsm_typed/20230118-184845
        git checkout 6051c9fba08cdbd6ea1baeac8664b8f4462b427d
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/platform/x86/intel/int1092/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/platform/x86/intel/int1092/intel_sar.c:134:6: warning: unused variable 'value' [-Wunused-variable]
           int value;
               ^
   1 warning generated.


vim +/value +134 drivers/platform/x86/intel/int1092/intel_sar.c

dcfbd31ef4bcf6 Shravan S       2021-07-24  117  
dcfbd31ef4bcf6 Shravan S       2021-07-24  118  /**
dcfbd31ef4bcf6 Shravan S       2021-07-24  119   * sar_get_device_mode: Extraction of information from BIOS via DSM calls
dcfbd31ef4bcf6 Shravan S       2021-07-24  120   * @device: ACPI device for which to retrieve the data
dcfbd31ef4bcf6 Shravan S       2021-07-24  121   *
dcfbd31ef4bcf6 Shravan S       2021-07-24  122   * Retrieve the current device mode information from the BIOS.
dcfbd31ef4bcf6 Shravan S       2021-07-24  123   *
dcfbd31ef4bcf6 Shravan S       2021-07-24  124   * Return:
dcfbd31ef4bcf6 Shravan S       2021-07-24  125   * AE_OK on success
dcfbd31ef4bcf6 Shravan S       2021-07-24  126   * AE_ERROR on error
dcfbd31ef4bcf6 Shravan S       2021-07-24  127   */
dcfbd31ef4bcf6 Shravan S       2021-07-24  128  static acpi_status sar_get_device_mode(struct platform_device *device)
dcfbd31ef4bcf6 Shravan S       2021-07-24  129  {
dcfbd31ef4bcf6 Shravan S       2021-07-24  130  	struct wwan_sar_context *context = dev_get_drvdata(&device->dev);
dcfbd31ef4bcf6 Shravan S       2021-07-24  131  	acpi_status status = AE_OK;
dcfbd31ef4bcf6 Shravan S       2021-07-24  132  	union acpi_object *out;
dcfbd31ef4bcf6 Shravan S       2021-07-24  133  	u32 rev = 0;
dcfbd31ef4bcf6 Shravan S       2021-07-24 @134  	int value;
dcfbd31ef4bcf6 Shravan S       2021-07-24  135  
6051c9fba08cdb Andy Shevchenko 2023-01-18  136  	out = acpi_evaluate_dsm_typed(context->handle, &context->guid, rev,
6051c9fba08cdb Andy Shevchenko 2023-01-18  137  				      COMMAND_ID_DEV_MODE, NULL, ACPI_TYPE_INTEGER);
6051c9fba08cdb Andy Shevchenko 2023-01-18  138  	if (!out) {
dcfbd31ef4bcf6 Shravan S       2021-07-24  139  		dev_err(&device->dev, "DSM cmd:%d Failed to retrieve value\n", COMMAND_ID_DEV_MODE);
dcfbd31ef4bcf6 Shravan S       2021-07-24  140  		status = AE_ERROR;
dcfbd31ef4bcf6 Shravan S       2021-07-24  141  		goto dev_mode_error;
dcfbd31ef4bcf6 Shravan S       2021-07-24  142  	}
6051c9fba08cdb Andy Shevchenko 2023-01-18  143  	context->sar_data.device_mode = out->integer.value;
dcfbd31ef4bcf6 Shravan S       2021-07-24  144  	update_sar_data(context);
dcfbd31ef4bcf6 Shravan S       2021-07-24  145  	sysfs_notify(&device->dev.kobj, NULL, SYSFS_DATANAME);
dcfbd31ef4bcf6 Shravan S       2021-07-24  146  
dcfbd31ef4bcf6 Shravan S       2021-07-24  147  dev_mode_error:
dcfbd31ef4bcf6 Shravan S       2021-07-24  148  	ACPI_FREE(out);
dcfbd31ef4bcf6 Shravan S       2021-07-24  149  	return status;
dcfbd31ef4bcf6 Shravan S       2021-07-24  150  }
dcfbd31ef4bcf6 Shravan S       2021-07-24  151
diff mbox series

Patch

diff --git a/drivers/platform/x86/intel/int1092/intel_sar.c b/drivers/platform/x86/intel/int1092/intel_sar.c
index e03943e6380a..20499cafabcb 100644
--- a/drivers/platform/x86/intel/int1092/intel_sar.c
+++ b/drivers/platform/x86/intel/int1092/intel_sar.c
@@ -133,14 +133,14 @@  static acpi_status sar_get_device_mode(struct platform_device *device)
 	u32 rev = 0;
 	int value;
 
-	out = acpi_evaluate_dsm(context->handle, &context->guid, rev,
-				COMMAND_ID_DEV_MODE, NULL);
-	if (get_int_value(out, &value)) {
+	out = acpi_evaluate_dsm_typed(context->handle, &context->guid, rev,
+				      COMMAND_ID_DEV_MODE, NULL, ACPI_TYPE_INTEGER);
+	if (!out) {
 		dev_err(&device->dev, "DSM cmd:%d Failed to retrieve value\n", COMMAND_ID_DEV_MODE);
 		status = AE_ERROR;
 		goto dev_mode_error;
 	}
-	context->sar_data.device_mode = value;
+	context->sar_data.device_mode = out->integer.value;
 	update_sar_data(context);
 	sysfs_notify(&device->dev.kobj, NULL, SYSFS_DATANAME);
 
@@ -221,11 +221,11 @@  static void sar_get_data(int reg, struct wwan_sar_context *context)
 
 	req.type = ACPI_TYPE_INTEGER;
 	req.integer.value = reg;
-	out = acpi_evaluate_dsm(context->handle, &context->guid, rev,
-				COMMAND_ID_CONFIG_TABLE, &req);
+	out = acpi_evaluate_dsm_typed(context->handle, &context->guid, rev,
+				      COMMAND_ID_CONFIG_TABLE, &req, ACPI_TYPE_PACKAGE);
 	if (!out)
 		return;
-	if (out->type == ACPI_TYPE_PACKAGE && out->package.count >= 3 &&
+	if (out->package.count >= 3 &&
 	    out->package.elements[0].type == ACPI_TYPE_INTEGER &&
 	    out->package.elements[1].type == ACPI_TYPE_INTEGER &&
 	    out->package.elements[2].type == ACPI_TYPE_PACKAGE &&