Skip to content

Commit 8ecf047

Browse files
committed
iwlwifi: pass number of chains and sub-bands to iwl_sar_set_profile()
The number of chains and sub-bands read from the ACPI tables varies depending on the revision. Pass these numbers to the iwl_sar_set_profile() function in order to make using different revisions easier. Signed-off-by: Luca Coelho <[email protected]> Link: https://lore.kernel.org/r/iwlwifi.20210805141826.905b54c398f8.I9bac8c3bc3b1b6bbe813de53746daee33e53fc86@changeid Signed-off-by: Luca Coelho <[email protected]>
1 parent dac7171 commit 8ecf047

File tree

1 file changed

+8
-5
lines changed
  • drivers/net/wireless/intel/iwlwifi/fw

1 file changed

+8
-5
lines changed

drivers/net/wireless/intel/iwlwifi/fw/acpi.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ IWL_EXPORT_SYMBOL(iwl_acpi_get_eckv);
412412

413413
static int iwl_sar_set_profile(union acpi_object *table,
414414
struct iwl_sar_profile *profile,
415-
bool enabled)
415+
bool enabled, u8 num_chains, u8 num_sub_bands)
416416
{
417417
int i, j, idx = 0;
418418

@@ -422,8 +422,8 @@ static int iwl_sar_set_profile(union acpi_object *table,
422422
* The table from ACPI is flat, but we store it in a
423423
* structured array.
424424
*/
425-
for (i = 0; i < ACPI_SAR_NUM_CHAINS; i++) {
426-
for (j = 0; j < ACPI_SAR_NUM_SUB_BANDS; j++) {
425+
for (i = 0; i < num_chains; i++) {
426+
for (j = 0; j < num_sub_bands; j++) {
427427
if (table[idx].type != ACPI_TYPE_INTEGER ||
428428
table[idx].integer.value > U8_MAX)
429429
return -EINVAL;
@@ -539,7 +539,8 @@ int iwl_sar_get_wrds_table(struct iwl_fw_runtime *fwrt)
539539
/* The profile from WRDS is officially profile 1, but goes
540540
* into sar_profiles[0] (because we don't have a profile 0).
541541
*/
542-
ret = iwl_sar_set_profile(table, &fwrt->sar_profiles[0], enabled);
542+
ret = iwl_sar_set_profile(table, &fwrt->sar_profiles[0], enabled,
543+
ACPI_SAR_NUM_CHAINS, ACPI_SAR_NUM_SUB_BANDS);
543544
out_free:
544545
kfree(data);
545546
return ret;
@@ -598,7 +599,9 @@ int iwl_sar_get_ewrd_table(struct iwl_fw_runtime *fwrt)
598599
*/
599600
ret = iwl_sar_set_profile(&wifi_pkg->package.elements[pos],
600601
&fwrt->sar_profiles[i + 1],
601-
enabled);
602+
enabled,
603+
ACPI_SAR_NUM_CHAINS,
604+
ACPI_SAR_NUM_SUB_BANDS);
602605
if (ret < 0)
603606
break;
604607

0 commit comments

Comments
 (0)