Skip to content

Commit

Permalink
ath10k-ct: fix compilation without debugfs
Browse files Browse the repository at this point in the history
The debug record in struct ath10k can only be used when compiled with
debugfs.  This fixes some unconditional uses in coredump.c and wmi.c.

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
  • Loading branch information
cotequeiroz committed May 4, 2020
1 parent 3637be6 commit ebe8143
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 4 deletions.
6 changes: 6 additions & 0 deletions ath10k-4.16/coredump.c
Expand Up @@ -830,7 +830,9 @@ static struct ath10k_dump_file_data *ath10k_coredump_build(struct ath10k *ar)
struct ath10k_ce_crash_hdr *ce_hdr;
struct ath10k_dump_file_data *dump_data;
struct ath10k_tlv_dump_data *dump_tlv;
#ifdef CONFIG_ATH10K_DEBUGFS
struct ath10k_dbglog_entry_storage_user *dbglog_storage;
#endif
size_t hdr_len = sizeof(*dump_data);
size_t len, sofar = 0;
unsigned char *buf;
Expand All @@ -851,7 +853,9 @@ static struct ath10k_dump_file_data *ath10k_coredump_build(struct ath10k *ar)
if (test_bit(ATH10K_FW_CRASH_DUMP_RAM_DATA, &ath10k_coredump_mask))
len += sizeof(*dump_tlv) + crash_data->ramdump_buf_len;

#ifdef CONFIG_ATH10K_DEBUGFS
len += sizeof(*dump_tlv) + sizeof(ar->debug.dbglog_entry_data);
#endif
len += sizeof(*dump_tlv) + sizeof(crash_data->stack_buf);
len += sizeof(*dump_tlv) + sizeof(crash_data->exc_stack_buf);

Expand Down Expand Up @@ -945,6 +949,7 @@ static struct ath10k_dump_file_data *ath10k_coredump_build(struct ath10k *ar)
sofar += sizeof(*dump_tlv) + crash_data->ramdump_buf_len;
}

#ifdef CONFIG_ATH10K_DEBUGFS
/* Gather dbg-log */
tmp = sizeof(ar->debug.dbglog_entry_data);
dump_tlv = (struct ath10k_tlv_dump_data *)(buf + sofar);
Expand All @@ -959,6 +964,7 @@ static struct ath10k_dump_file_data *ath10k_coredump_build(struct ath10k *ar)
dbglog_storage->tail_idx =
cpu_to_le32(ar->debug.dbglog_entry_data.tail_idx);
sofar += sizeof(*dump_tlv) + tmp;
#endif

/* Gather firmware stack dump */
tmp = sizeof(crash_data->stack_buf);
Expand Down
2 changes: 2 additions & 0 deletions ath10k-4.16/wmi.c
Expand Up @@ -4128,12 +4128,14 @@ static void ath10k_dfs_radar_report(struct ath10k *ar,

#ifdef ATH_HAVE_PULSE_EVENT_MSG /* so we can compile out-of-tree easier */
ath10k_dbg(ar, ATH10K_DBG_REGULATORY, "dfs radar detected: %s\n", pe.msg);
# ifdef CONFIG_ATH10K_DEBUGFS
if (pe.msg[0]) {
strncpy(ar->debug.dfs_last_msg, pe.msg,
sizeof(ar->debug.dfs_last_msg));
/* ensure null term */
ar->debug.dfs_last_msg[sizeof(ar->debug.dfs_last_msg) - 1] = 0;
}
# endif
#else
ath10k_dbg(ar, ATH10K_DBG_REGULATORY, "dfs radar detected\n");
#endif
Expand Down
6 changes: 6 additions & 0 deletions ath10k-4.19/coredump.c
Expand Up @@ -1018,7 +1018,9 @@ static struct ath10k_dump_file_data *ath10k_coredump_build(struct ath10k *ar)
struct ath10k_ce_crash_hdr *ce_hdr;
struct ath10k_dump_file_data *dump_data;
struct ath10k_tlv_dump_data *dump_tlv;
#ifdef CONFIG_ATH10K_DEBUGFS
struct ath10k_dbglog_entry_storage_user *dbglog_storage;
#endif
size_t hdr_len = sizeof(*dump_data);
size_t len, sofar = 0;
unsigned char *buf;
Expand All @@ -1039,7 +1041,9 @@ static struct ath10k_dump_file_data *ath10k_coredump_build(struct ath10k *ar)
if (test_bit(ATH10K_FW_CRASH_DUMP_RAM_DATA, &ath10k_coredump_mask))
len += sizeof(*dump_tlv) + crash_data->ramdump_buf_len;

#ifdef CONFIG_ATH10K_DEBUGFS
len += sizeof(*dump_tlv) + sizeof(ar->debug.dbglog_entry_data);
#endif
len += sizeof(*dump_tlv) + sizeof(crash_data->stack_buf);
len += sizeof(*dump_tlv) + sizeof(crash_data->exc_stack_buf);

Expand Down Expand Up @@ -1133,6 +1137,7 @@ static struct ath10k_dump_file_data *ath10k_coredump_build(struct ath10k *ar)
sofar += sizeof(*dump_tlv) + crash_data->ramdump_buf_len;
}

#ifdef CONFIG_ATH10K_DEBUGFS
/* Gather dbg-log */
tmp = sizeof(ar->debug.dbglog_entry_data);
dump_tlv = (struct ath10k_tlv_dump_data *)(buf + sofar);
Expand All @@ -1147,6 +1152,7 @@ static struct ath10k_dump_file_data *ath10k_coredump_build(struct ath10k *ar)
dbglog_storage->tail_idx =
cpu_to_le32(ar->debug.dbglog_entry_data.tail_idx);
sofar += sizeof(*dump_tlv) + tmp;
#endif

/* Gather firmware stack dump */
tmp = sizeof(crash_data->stack_buf);
Expand Down
3 changes: 2 additions & 1 deletion ath10k-4.19/wmi.c
Expand Up @@ -4295,7 +4295,8 @@ static void ath10k_dfs_radar_report(struct ath10k *ar,

radar_detected:

#ifdef ATH_HAVE_PULSE_EVENT_MSG /* so we can compile out-of-tree easier */
/* so we can compile out-of-tree easier */
#if defined(ATH_HAVE_PULSE_EVENT_MSG) && defined(CONFIG_ATH10K_DEBUGFS)
if (pe.msg[0]) {
strncpy(ar->debug.dfs_last_msg, pe.msg,
sizeof(ar->debug.dfs_last_msg));
Expand Down
6 changes: 6 additions & 0 deletions ath10k-4.20/coredump.c
Expand Up @@ -1018,7 +1018,9 @@ static struct ath10k_dump_file_data *ath10k_coredump_build(struct ath10k *ar)
struct ath10k_ce_crash_hdr *ce_hdr;
struct ath10k_dump_file_data *dump_data;
struct ath10k_tlv_dump_data *dump_tlv;
#ifdef CONFIG_ATH10K_DEBUGFS
struct ath10k_dbglog_entry_storage_user *dbglog_storage;
#endif
size_t hdr_len = sizeof(*dump_data);
size_t len, sofar = 0;
unsigned char *buf;
Expand All @@ -1039,7 +1041,9 @@ static struct ath10k_dump_file_data *ath10k_coredump_build(struct ath10k *ar)
if (test_bit(ATH10K_FW_CRASH_DUMP_RAM_DATA, &ath10k_coredump_mask))
len += sizeof(*dump_tlv) + crash_data->ramdump_buf_len;

#ifdef CONFIG_ATH10K_DEBUGFS
len += sizeof(*dump_tlv) + sizeof(ar->debug.dbglog_entry_data);
#endif
len += sizeof(*dump_tlv) + sizeof(crash_data->stack_buf);
len += sizeof(*dump_tlv) + sizeof(crash_data->exc_stack_buf);

Expand Down Expand Up @@ -1133,6 +1137,7 @@ static struct ath10k_dump_file_data *ath10k_coredump_build(struct ath10k *ar)
sofar += sizeof(*dump_tlv) + crash_data->ramdump_buf_len;
}

#ifdef CONFIG_ATH10K_DEBUGFS
/* Gather dbg-log */
tmp = sizeof(ar->debug.dbglog_entry_data);
dump_tlv = (struct ath10k_tlv_dump_data *)(buf + sofar);
Expand All @@ -1147,6 +1152,7 @@ static struct ath10k_dump_file_data *ath10k_coredump_build(struct ath10k *ar)
dbglog_storage->tail_idx =
cpu_to_le32(ar->debug.dbglog_entry_data.tail_idx);
sofar += sizeof(*dump_tlv) + tmp;
#endif

/* Gather firmware stack dump */
tmp = sizeof(crash_data->stack_buf);
Expand Down
3 changes: 2 additions & 1 deletion ath10k-4.20/wmi.c
Expand Up @@ -4342,7 +4342,8 @@ static void ath10k_dfs_radar_report(struct ath10k *ar,

radar_detected:

#ifdef ATH_HAVE_PULSE_EVENT_MSG /* so we can compile out-of-tree easier */
/* so we can compile out-of-tree easier */
#if defined(ATH_HAVE_PULSE_EVENT_MSG) && defined(CONFIG_ATH10K_DEBUGFS)
if (pe.msg[0]) {
strncpy(ar->debug.dfs_last_msg, pe.msg,
sizeof(ar->debug.dfs_last_msg));
Expand Down
6 changes: 6 additions & 0 deletions ath10k-5.2/coredump.c
Expand Up @@ -1121,7 +1121,9 @@ static struct ath10k_dump_file_data *ath10k_coredump_build(struct ath10k *ar)
struct ath10k_ce_crash_hdr *ce_hdr;
struct ath10k_dump_file_data *dump_data;
struct ath10k_tlv_dump_data *dump_tlv;
#ifdef CONFIG_ATH10K_DEBUGFS
struct ath10k_dbglog_entry_storage_user *dbglog_storage;
#endif
size_t hdr_len = sizeof(*dump_data);
size_t len, sofar = 0;
unsigned char *buf;
Expand All @@ -1142,7 +1144,9 @@ static struct ath10k_dump_file_data *ath10k_coredump_build(struct ath10k *ar)
if (test_bit(ATH10K_FW_CRASH_DUMP_RAM_DATA, &ath10k_coredump_mask))
len += sizeof(*dump_tlv) + crash_data->ramdump_buf_len;

#ifdef CONFIG_ATH10K_DEBUGFS
len += sizeof(*dump_tlv) + sizeof(ar->debug.dbglog_entry_data);
#endif
len += sizeof(*dump_tlv) + sizeof(crash_data->stack_buf);
len += sizeof(*dump_tlv) + sizeof(crash_data->exc_stack_buf);

Expand Down Expand Up @@ -1236,6 +1240,7 @@ static struct ath10k_dump_file_data *ath10k_coredump_build(struct ath10k *ar)
sofar += sizeof(*dump_tlv) + crash_data->ramdump_buf_len;
}

#ifdef CONFIG_ATH10K_DEBUGFS
/* Gather dbg-log */
tmp = sizeof(ar->debug.dbglog_entry_data);
dump_tlv = (struct ath10k_tlv_dump_data *)(buf + sofar);
Expand All @@ -1250,6 +1255,7 @@ static struct ath10k_dump_file_data *ath10k_coredump_build(struct ath10k *ar)
dbglog_storage->tail_idx =
cpu_to_le32(ar->debug.dbglog_entry_data.tail_idx);
sofar += sizeof(*dump_tlv) + tmp;
#endif

/* Gather firmware stack dump */
tmp = sizeof(crash_data->stack_buf);
Expand Down
3 changes: 2 additions & 1 deletion ath10k-5.2/wmi.c
Expand Up @@ -4458,7 +4458,8 @@ static void ath10k_dfs_radar_report(struct ath10k *ar,

radar_detected:

#ifdef ATH_HAVE_PULSE_EVENT_MSG /* so we can compile out-of-tree easier */
/* so we can compile out-of-tree easier */
#if defined(ATH_HAVE_PULSE_EVENT_MSG) && defined(CONFIG_ATH10K_DEBUGFS)
if (pe.msg[0]) {
strncpy(ar->debug.dfs_last_msg, pe.msg,
sizeof(ar->debug.dfs_last_msg));
Expand Down
6 changes: 6 additions & 0 deletions ath10k-5.4/coredump.c
Expand Up @@ -1121,7 +1121,9 @@ static struct ath10k_dump_file_data *ath10k_coredump_build(struct ath10k *ar)
struct ath10k_ce_crash_hdr *ce_hdr;
struct ath10k_dump_file_data *dump_data;
struct ath10k_tlv_dump_data *dump_tlv;
#ifdef CONFIG_ATH10K_DEBUGFS
struct ath10k_dbglog_entry_storage_user *dbglog_storage;
#endif
size_t hdr_len = sizeof(*dump_data);
size_t len, sofar = 0;
unsigned char *buf;
Expand All @@ -1142,7 +1144,9 @@ static struct ath10k_dump_file_data *ath10k_coredump_build(struct ath10k *ar)
if (test_bit(ATH10K_FW_CRASH_DUMP_RAM_DATA, &ath10k_coredump_mask))
len += sizeof(*dump_tlv) + crash_data->ramdump_buf_len;

#ifdef CONFIG_ATH10K_DEBUGFS
len += sizeof(*dump_tlv) + sizeof(ar->debug.dbglog_entry_data);
#endif
len += sizeof(*dump_tlv) + sizeof(crash_data->stack_buf);
len += sizeof(*dump_tlv) + sizeof(crash_data->exc_stack_buf);

Expand Down Expand Up @@ -1238,6 +1242,7 @@ static struct ath10k_dump_file_data *ath10k_coredump_build(struct ath10k *ar)
}
}

#ifdef CONFIG_ATH10K_DEBUGFS
/* Gather dbg-log */
tmp = sizeof(ar->debug.dbglog_entry_data);
dump_tlv = (struct ath10k_tlv_dump_data *)(buf + sofar);
Expand All @@ -1252,6 +1257,7 @@ static struct ath10k_dump_file_data *ath10k_coredump_build(struct ath10k *ar)
dbglog_storage->tail_idx =
cpu_to_le32(ar->debug.dbglog_entry_data.tail_idx);
sofar += sizeof(*dump_tlv) + tmp;
#endif

/* Gather firmware stack dump */
tmp = sizeof(crash_data->stack_buf);
Expand Down
3 changes: 2 additions & 1 deletion ath10k-5.4/wmi.c
Expand Up @@ -4458,7 +4458,8 @@ static void ath10k_dfs_radar_report(struct ath10k *ar,

radar_detected:

#ifdef ATH_HAVE_PULSE_EVENT_MSG /* so we can compile out-of-tree easier */
/* so we can compile out-of-tree easier */
#if defined(ATH_HAVE_PULSE_EVENT_MSG) && defined(CONFIG_ATH10K_DEBUGFS)
if (pe.msg[0]) {
strncpy(ar->debug.dfs_last_msg, pe.msg,
sizeof(ar->debug.dfs_last_msg));
Expand Down

0 comments on commit ebe8143

Please sign in to comment.