summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/intel/iwlwifi/pcie
diff options
context:
space:
mode:
authorLuca Coelho <luciano.coelho@intel.com>2017-09-19 12:35:18 +0300
committerLuca Coelho <luciano.coelho@intel.com>2017-10-06 15:22:28 +0300
commit813df5cef3bb119940998f2e70cb9016e4b434f7 (patch)
tree1c0457588b4f2a39fd849fad381703e6e07d595b /drivers/net/wireless/intel/iwlwifi/pcie
parent417795a3f4d634bb50dbffaf2ab9d7f46750b7e8 (diff)
downloadlinux-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/pcie')
-rw-r--r--drivers/net/wireless/intel/iwlwifi/pcie/drv.c33
1 files changed, 7 insertions, 26 deletions
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
index e0966f656376..09fb27e9adf5 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
@@ -73,6 +73,8 @@
#include <linux/pci-aspm.h>
#include <linux/acpi.h>
+#include "fw/acpi.h"
+
#include "iwl-trans.h"
#include "iwl-drv.h"
#include "internal.h"
@@ -641,37 +643,16 @@ static u64 splc_get_pwr_limit(struct iwl_trans *trans, union acpi_object *splc)
static void set_dflt_pwr_limit(struct iwl_trans *trans, struct pci_dev *pdev)
{
- acpi_handle pxsx_handle;
- acpi_handle handle;
- struct acpi_buffer splc = {ACPI_ALLOCATE_BUFFER, NULL};
- acpi_status status;
-
- pxsx_handle = ACPI_HANDLE(&pdev->dev);
- if (!pxsx_handle) {
- IWL_DEBUG_INFO(trans,
- "Could not retrieve root port ACPI handle\n");
- return;
- }
+ union acpi_object *data;
- /* Get the method's handle */
- status = acpi_get_handle(pxsx_handle, (acpi_string)ACPI_SPLC_METHOD,
- &handle);
- if (ACPI_FAILURE(status)) {
- IWL_DEBUG_INFO(trans, "SPLC method not found\n");
+ data = iwl_acpi_get_object(trans->dev, ACPI_SPLC_METHOD);
+ if (IS_ERR(data))
return;
- }
-
- /* Call SPLC with no arguments */
- status = acpi_evaluate_object(handle, NULL, NULL, &splc);
- if (ACPI_FAILURE(status)) {
- IWL_ERR(trans, "SPLC invocation failed (0x%x)\n", status);
- return;
- }
- trans->dflt_pwr_limit = splc_get_pwr_limit(trans, splc.pointer);
+ trans->dflt_pwr_limit = splc_get_pwr_limit(trans, data);
IWL_DEBUG_INFO(trans, "Default power limit set to %lld\n",
trans->dflt_pwr_limit);
- kfree(splc.pointer);
+ kfree(data);
}
#else /* CONFIG_ACPI */