Skip to content

Commit

Permalink
iwlwifi: fw: fix debug dump data declarations
Browse files Browse the repository at this point in the history
The debug dump ranges aren't just an array of such ranges
since each range has a variable size. Therefore, the use
of a struct array is misleading at best.

Change it to be a u8 data[] instead of the struct array,
the code doesn't significantly change since it's actually
doing things correctly now.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210819183728.693c9891097d.Idcaab1fd659e8be2f56be647b2534befd61a4460@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
  • Loading branch information
Johannes Berg authored and Luca Coelho committed Aug 26, 2021
1 parent 394f419 commit 8a433cb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
8 changes: 4 additions & 4 deletions drivers/net/wireless/intel/iwlwifi/fw/dbg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1547,7 +1547,7 @@ iwl_dump_ini_mem_fill_header(struct iwl_fw_runtime *fwrt,

dump->header.version = cpu_to_le32(IWL_INI_DUMP_VER);

return dump->ranges;
return dump->data;
}

/**
Expand Down Expand Up @@ -1611,7 +1611,7 @@ iwl_dump_ini_mon_fill_header(struct iwl_fw_runtime *fwrt,

data->header.version = cpu_to_le32(IWL_INI_DUMP_VER);

return data->ranges;
return data->data;
}

static void *
Expand Down Expand Up @@ -1647,7 +1647,7 @@ iwl_dump_ini_err_table_fill_header(struct iwl_fw_runtime *fwrt,
dump->header.version = cpu_to_le32(IWL_INI_DUMP_VER);
dump->version = reg->err_table.version;

return dump->ranges;
return dump->data;
}

static void *
Expand All @@ -1662,7 +1662,7 @@ iwl_dump_ini_special_mem_fill_header(struct iwl_fw_runtime *fwrt,
dump->type = reg->special_mem.type;
dump->version = reg->special_mem.version;

return dump->ranges;
return dump->data;
}

static u32 iwl_dump_ini_mem_ranges(struct iwl_fw_runtime *fwrt,
Expand Down
22 changes: 13 additions & 9 deletions drivers/net/wireless/intel/iwlwifi/fw/error-dump.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
/*
* Copyright (C) 2014, 2018-2020 Intel Corporation
* Copyright (C) 2014, 2018-2021 Intel Corporation
* Copyright (C) 2014-2015 Intel Mobile Communications GmbH
* Copyright (C) 2016-2017 Intel Deutschland GmbH
*/
Expand Down Expand Up @@ -305,11 +305,12 @@ struct iwl_fw_ini_error_dump_header {
/**
* struct iwl_fw_ini_error_dump - ini region dump
* @header: the header of this region
* @ranges: the memory ranges of this region
* @data: data of memory ranges in this region,
* see &struct iwl_fw_ini_error_dump_range
*/
struct iwl_fw_ini_error_dump {
struct iwl_fw_ini_error_dump_header header;
struct iwl_fw_ini_error_dump_range ranges[];
u8 data[];
} __packed;

/* This bit is used to differentiate between lmac and umac rxf */
Expand Down Expand Up @@ -399,12 +400,13 @@ struct iwl_fw_ini_dump_info {
* struct iwl_fw_ini_err_table_dump - ini error table dump
* @header: header of the region
* @version: error table version
* @ranges: the memory ranges of this this region
* @data: data of memory ranges in this region,
* see &struct iwl_fw_ini_error_dump_range
*/
struct iwl_fw_ini_err_table_dump {
struct iwl_fw_ini_error_dump_header header;
__le32 version;
struct iwl_fw_ini_error_dump_range ranges[];
u8 data[];
} __packed;

/**
Expand All @@ -427,28 +429,30 @@ struct iwl_fw_error_dump_rb {
* @write_ptr: write pointer position in the buffer
* @cycle_cnt: cycles count
* @cur_frag: current fragment in use
* @ranges: the memory ranges of this this region
* @data: data of memory ranges in this region,
* see &struct iwl_fw_ini_error_dump_range
*/
struct iwl_fw_ini_monitor_dump {
struct iwl_fw_ini_error_dump_header header;
__le32 write_ptr;
__le32 cycle_cnt;
__le32 cur_frag;
struct iwl_fw_ini_error_dump_range ranges[];
u8 data[];
} __packed;

/**
* struct iwl_fw_ini_special_device_memory - special device memory
* @header: header of the region
* @type: type of special memory
* @version: struct special memory version
* @ranges: the memory ranges of this this region
* @data: data of memory ranges in this region,
* see &struct iwl_fw_ini_error_dump_range
*/
struct iwl_fw_ini_special_device_memory {
struct iwl_fw_ini_error_dump_header header;
__le16 type;
__le16 version;
struct iwl_fw_ini_error_dump_range ranges[];
u8 data[];
} __packed;

/**
Expand Down

0 comments on commit 8a433cb

Please sign in to comment.