diff options
author | Luca Coelho <luciano.coelho@intel.com> | 2017-09-19 12:35:18 +0300 |
---|---|---|
committer | Luca Coelho <luciano.coelho@intel.com> | 2017-10-06 15:22:28 +0300 |
commit | 813df5cef3bb119940998f2e70cb9016e4b434f7 (patch) | |
tree | 1c0457588b4f2a39fd849fad381703e6e07d595b /drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c | |
parent | 417795a3f4d634bb50dbffaf2ab9d7f46750b7e8 (diff) | |
download | linux-813df5cef3bb119940998f2e70cb9016e4b434f7.tar.xz |
iwlwifi: acpi: add common code to read from ACPI
There are many places where the same process of invoking a method from
ACPI is used, causing a lot of duplicate code. To improve this,
introduce a new function to get an ACPI object by invoking an ACPI
method that can be reused.
Additionally, since this function needs to be called when we only have
the trans, the opmode or the device, introduce a new debug macro that
gets the device as a parameter so it can be used in the new function.
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Diffstat (limited to 'drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c')
-rw-r--r-- | drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c | 37 |
1 files changed, 8 insertions, 29 deletions
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c index 4574a126c1ae..5165af25f010 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c @@ -68,13 +68,14 @@ #include <linux/export.h> #include <linux/etherdevice.h> #include <linux/pci.h> -#include <linux/acpi.h> + #include "iwl-drv.h" #include "iwl-modparams.h" #include "iwl-nvm-parse.h" #include "iwl-prph.h" #include "iwl-io.h" #include "iwl-csr.h" +#include "fw/acpi.h" /* NVM offsets (in words) definitions */ enum wkp_nvm_offsets { @@ -990,37 +991,15 @@ static u32 iwl_wrdd_get_mcc(struct device *dev, union acpi_object *wrdd) int iwl_get_bios_mcc(struct device *dev, char *mcc) { - acpi_handle root_handle; - acpi_handle handle; - struct acpi_buffer wrdd = {ACPI_ALLOCATE_BUFFER, NULL}; - acpi_status status; + union acpi_object *data; u32 mcc_val; - root_handle = ACPI_HANDLE(dev); - if (!root_handle) { - IWL_DEBUG_EEPROM(dev, - "Could not retrieve root port ACPI handle\n"); - return -ENOENT; - } - - /* Get the method's handle */ - status = acpi_get_handle(root_handle, (acpi_string)WRDD_METHOD, - &handle); - if (ACPI_FAILURE(status)) { - IWL_DEBUG_EEPROM(dev, "WRD method not found\n"); - return -ENOENT; - } - - /* Call WRDD with no arguments */ - status = acpi_evaluate_object(handle, NULL, NULL, &wrdd); - if (ACPI_FAILURE(status)) { - IWL_DEBUG_EEPROM(dev, "WRDC invocation failed (0x%x)\n", - status); - return -ENOENT; - } + data = iwl_acpi_get_object(dev, WRDD_METHOD); + if (IS_ERR(data)) + return PTR_ERR(data); - mcc_val = iwl_wrdd_get_mcc(dev, wrdd.pointer); - kfree(wrdd.pointer); + mcc_val = iwl_wrdd_get_mcc(dev, data); + kfree(data); if (!mcc_val) return -ENOENT; |