linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luca Coelho <luca@coelho.fi>
To: kvalo@codeaurora.org
Cc: luca@coelho.fi, linux-wireless@vger.kernel.org
Subject: [PATCH 03/11] iwlwifi: acpi: fill in SAR tables with defaults
Date: Thu, 19 Aug 2021 18:40:27 +0300	[thread overview]
Message-ID: <iwlwifi.20210819183728.7fb9716db7ba.I75541846e0720f80695186ba39398133c8758280@changeid> (raw)
In-Reply-To: <20210819154035.72584-1-luca@coelho.fi>

From: Luca Coelho <luciano.coelho@intel.com>

If the tables we get in the iwl_sar_set_profile() is smaller than the
revision we support, we need to fill the values with 0.  Make sure
that's the case.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/fw/acpi.c | 21 ++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/fw/acpi.c b/drivers/net/wireless/intel/iwlwifi/fw/acpi.c
index 37da836a8c08..1efac0b2a94d 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/acpi.c
+++ b/drivers/net/wireless/intel/iwlwifi/fw/acpi.c
@@ -420,16 +420,21 @@ static int iwl_sar_set_profile(union acpi_object *table,
 	 * The table from ACPI is flat, but we store it in a
 	 * structured array.
 	 */
-	for (i = 0; i < num_chains; i++) {
-		for (j = 0; j < num_sub_bands; j++) {
-			if (table[idx].type != ACPI_TYPE_INTEGER ||
-			    table[idx].integer.value > U8_MAX)
-				return -EINVAL;
+	for (i = 0; i < ACPI_SAR_NUM_CHAINS_REV2; i++) {
+		for (j = 0; j < ACPI_SAR_NUM_SUB_BANDS_REV2; j++) {
+			/* if we don't have the values, use the default */
+			if (i >= num_chains || j >= num_sub_bands) {
+				profile->chains[i].subbands[j] = 0;
+			} else {
+				if (table[idx].type != ACPI_TYPE_INTEGER ||
+				    table[idx].integer.value > U8_MAX)
+					return -EINVAL;
 
-			profile->chains[i].subbands[j] =
-				table[idx].integer.value;
+				profile->chains[i].subbands[j] =
+					table[idx].integer.value;
 
-			idx++;
+				idx++;
+			}
 		}
 	}
 
-- 
2.33.0


  parent reply	other threads:[~2021-08-19 15:40 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-19 15:40 [PATCH 00/11] iwlwifi: updates intended for v5.15 2021-08-19 Luca Coelho
2021-08-19 15:40 ` [PATCH 01/11] iwlwifi: bump FW API to 65 for AX devices Luca Coelho
2021-08-26 20:37   ` Luca Coelho
2021-08-19 15:40 ` [PATCH 02/11] iwlwifi: acpi: fill in WGDS table with defaults Luca Coelho
2021-08-19 15:40 ` Luca Coelho [this message]
2021-08-19 15:40 ` [PATCH 04/11] iwlwifi: pcie: avoid dma unmap/remap in crash dump Luca Coelho
2021-08-19 15:40 ` [PATCH 05/11] iwlwifi: fix __percpu annotation Luca Coelho
2021-08-19 15:40 ` [PATCH 06/11] iwlwifi: api: remove datamember from struct Luca Coelho
2021-08-19 15:40 ` [PATCH 07/11] iwlwifi: fw: fix debug dump data declarations Luca Coelho
2021-08-19 15:40 ` [PATCH 08/11] iwlwifi: add 'Rx control frame to MBSSID' HE capability Luca Coelho
2021-08-19 15:40 ` [PATCH 09/11] iwlwifi: yoyo: support for new DBGI_SRAM region Luca Coelho
2021-08-19 15:40 ` [PATCH 10/11] iwlwifi: mvm: don't schedule the roc_done_wk if it is already running Luca Coelho
2021-08-19 15:40 ` [PATCH 11/11] iwlwifi: allow debug init in RF-kill 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=iwlwifi.20210819183728.7fb9716db7ba.I75541846e0720f80695186ba39398133c8758280@changeid \
    --to=luca@coelho.fi \
    --cc=kvalo@codeaurora.org \
    --cc=linux-wireless@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).