From: Luca Coelho <luca@coelho.fi>
To: kvalo@codeaurora.org
Cc: linux-wireless@vger.kernel.org, Luca Coelho <luciano.coelho@intel.com>
Subject: [PATCH 16/18] iwlwifi: acpi: move code that reads SPLC to acpi
Date: Fri, 29 Sep 2017 19:44:21 +0300 [thread overview]
Message-ID: <20170929164423.23666-17-luca@coelho.fi> (raw)
In-Reply-To: <20170929164423.23666-1-luca@coelho.fi>
From: Luca Coelho <luciano.coelho@intel.com>
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>
---
drivers/net/wireless/intel/iwlwifi/fw/acpi.c | 27 +++++++++++++++++++++++++++
drivers/net/wireless/intel/iwlwifi/fw/acpi.h | 7 +++++++
drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 25 ++-----------------------
3 files changed, 36 insertions(+), 23 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 @@ int iwl_acpi_get_mcc(struct device *dev, char *mcc)
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);
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/acpi.h b/drivers/net/wireless/intel/iwlwifi/fw/acpi.h
index fe9c1066c3b6..cb5f32c1d705 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/acpi.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/acpi.h
@@ -108,6 +108,8 @@ union acpi_object *iwl_acpi_get_wifi_pkg(struct device *dev,
*/
int iwl_acpi_get_mcc(struct device *dev, char *mcc);
+u64 iwl_acpi_get_pwr_limit(struct device *dev);
+
#else /* CONFIG_ACPI */
static inline void *iwl_acpi_get_object(struct device *dev, acpi_string method)
@@ -127,5 +129,10 @@ static inline int iwl_acpi_get_mcc(struct device *dev, char *mcc)
return -ENOENT;
}
+static inline u64 iwl_acpi_get_pwr_limit(struct device *dev)
+{
+ return 0;
+}
+
#endif /* CONFIG_ACPI */
#endif /* __iwl_fw_acpi__ */
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
index 08f71b4297be..d81f2414fd8e 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
@@ -78,6 +78,7 @@
#include "iwl-trans.h"
#include "iwl-drv.h"
#include "internal.h"
+#include "fw/acpi.h"
#define IWL_PCI_DEVICE(dev, subdev, cfg) \
.vendor = PCI_VENDOR_ID_INTEL, .device = (dev), \
@@ -587,28 +588,6 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
};
MODULE_DEVICE_TABLE(pci, iwl_hw_card_ids);
-static void set_dflt_pwr_limit(struct iwl_trans *trans, struct pci_dev *pdev)
-{
- union acpi_object *data, *wifi_pkg;
-
- data = iwl_acpi_get_object(trans->dev, ACPI_SPLC_METHOD);
- if (IS_ERR(data))
- return;
-
- wifi_pkg = iwl_acpi_get_wifi_pkg(trans->dev, data,
- ACPI_SPLC_WIFI_DATA_SIZE);
- if (IS_ERR(wifi_pkg) ||
- wifi_pkg->package.elements[1].integer.value != ACPI_TYPE_INTEGER)
- goto out;
-
- trans->dflt_pwr_limit = wifi_pkg->package.elements[1].integer.value;
-
- IWL_DEBUG_INFO(trans, "Default power limit set to %lld\n",
- trans->dflt_pwr_limit);
-out:
- kfree(data);
-}
-
/* PCI registers */
#define PCI_CFG_RETRY_TIMEOUT 0x041
@@ -672,7 +651,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
goto out_free_trans;
}
- set_dflt_pwr_limit(iwl_trans, pdev);
+ iwl_trans->dflt_pwr_limit = iwl_acpi_get_pwr_limit(iwl_trans->dev);
/* register transport layer debugfs here */
ret = iwl_trans_pcie_dbgfs_register(iwl_trans);
--
2.14.1
next prev parent reply other threads:[~2017-09-29 16:46 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-29 16:44 [PATCH 00/18] iwlwifi: updates intended for v4.15 2017-09-29 Luca Coelho
2017-09-29 16:44 ` [PATCH 01/18] iwlwifi: mvm: don't send identical PHY_CTXT_CMD Luca Coelho
2017-09-29 16:44 ` [PATCH 02/18] iwlwifi: fw: api: remove excess enum value documentation Luca Coelho
2017-09-29 16:44 ` [PATCH 03/18] iwlwifi: mvm: add marker cmd response struct Luca Coelho
2017-09-29 16:44 ` [PATCH 04/18] iwlwifi: fix minor code style issues Luca Coelho
2017-09-29 16:44 ` [PATCH 05/18] iwlwifi: pcie: dump registers when HW becomes inaccessible Luca Coelho
2017-10-06 12:25 ` [PATCH v2 " Luca Coelho
2017-09-29 16:44 ` [PATCH 06/18] iwlwifi: mvm: change warning to warn_once() Luca Coelho
2017-09-29 16:44 ` [PATCH 07/18] iwlwifi: acpi: add common code to read from ACPI Luca Coelho
2017-09-29 16:44 ` [PATCH 08/18] iwlwifi: acpi: move ACPI method definitions to acpi.h Luca Coelho
2017-09-29 16:44 ` [PATCH 09/18] iwlwifi: acpi: move ACPI-related " Luca Coelho
2017-09-29 16:44 ` [PATCH 10/18] iwlwifi: acpi: generalize iwl_mvm_sar_find_wifi_pkg() Luca Coelho
2017-09-29 16:44 ` [PATCH 11/18] iwlwifi: acpi: use iwl_acpi_get_wifi_pkg when reading reading SPLC Luca Coelho
2017-09-29 16:44 ` [PATCH 12/18] iwlwifi: acpi: make iwl_get_bios_mcc() use the common acpi functions Luca Coelho
2017-09-29 16:44 ` [PATCH 13/18] iwlwifi: acpi: remove a couple of unnecessary ifdefs Luca Coelho
2017-09-29 16:44 ` [PATCH 14/18] iwlwifi: acpi: move function to get mcc into acpi code Luca Coelho
2017-09-29 16:44 ` [PATCH 15/18] iwlwifi: fix indentation in a000 family configuration Luca Coelho
2017-09-29 16:44 ` Luca Coelho [this message]
2017-09-29 16:44 ` [PATCH 17/18] iwlwifi: mvm: warn on invalid statistics size Luca Coelho
2017-09-29 16:44 ` [PATCH 18/18] iwlwifi: remove dflt_pwr_limit from the transport Luca Coelho
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170929164423.23666-17-luca@coelho.fi \
--to=luca@coelho.fi \
--cc=kvalo@codeaurora.org \
--cc=linux-wireless@vger.kernel.org \
--cc=luciano.coelho@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox