diff options
author | Luca Coelho <luciano.coelho@intel.com> | 2017-09-28 15:18:33 +0300 |
---|---|---|
committer | Luca Coelho <luciano.coelho@intel.com> | 2017-10-06 15:22:33 +0300 |
commit | 1184611ee88f309fe4a6ca3d50bde762434e386e (patch) | |
tree | 2001c476450f2c3b9203c1e10b89cbc4859436b9 /drivers/net/wireless/intel/iwlwifi/fw/acpi.c | |
parent | e59a00f4884815a2887837b9d34e0ae59c41d3d3 (diff) | |
download | blackbird-op-linux-1184611ee88f309fe4a6ca3d50bde762434e386e.tar.gz blackbird-op-linux-1184611ee88f309fe4a6ca3d50bde762434e386e.zip |
iwlwifi: acpi: move code that reads SPLC to acpi
Move most of the set_dflt_pwr_limit() function to acpi.c and make it
return the pwr_limit value instead of setting directly. Also rename
it to iwl_acpi_get_pwr_limit().
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Diffstat (limited to 'drivers/net/wireless/intel/iwlwifi/fw/acpi.c')
-rw-r--r-- | drivers/net/wireless/intel/iwlwifi/fw/acpi.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/acpi.c b/drivers/net/wireless/intel/iwlwifi/fw/acpi.c index adce36112b7f..75cae54ea7de 100644 --- a/drivers/net/wireless/intel/iwlwifi/fw/acpi.c +++ b/drivers/net/wireless/intel/iwlwifi/fw/acpi.c @@ -181,3 +181,30 @@ out_free: return ret; } IWL_EXPORT_SYMBOL(iwl_acpi_get_mcc); + +u64 iwl_acpi_get_pwr_limit(struct device *dev) +{ + union acpi_object *data, *wifi_pkg; + u64 dflt_pwr_limit; + + data = iwl_acpi_get_object(dev, ACPI_SPLC_METHOD); + if (IS_ERR(data)) { + dflt_pwr_limit = 0; + goto out; + } + + wifi_pkg = iwl_acpi_get_wifi_pkg(dev, data, + ACPI_SPLC_WIFI_DATA_SIZE); + if (IS_ERR(wifi_pkg) || + wifi_pkg->package.elements[1].integer.value != ACPI_TYPE_INTEGER) { + dflt_pwr_limit = 0; + goto out_free; + } + + dflt_pwr_limit = wifi_pkg->package.elements[1].integer.value; +out_free: + kfree(data); +out: + return dflt_pwr_limit; +} +IWL_EXPORT_SYMBOL(iwl_acpi_get_pwr_limit); |