qcacmn: Stringify HW_VERSION value when HW UNKNOWN

When new hardware is not found in the lookup table
for human readable hardware names, print the hex
value of the hardware version info.

Change-Id: If821ba04c83f2d9b54587379d92bdc1918d7a094
CRs-Fixed: 1092353
This commit is contained in:
Houston Hoffman 2016-11-21 12:13:36 -08:00 • committed by qcabuildsw
commit 60af6759fb
2 changed files with 20 additions and 1 deletions

View file

@ -283,6 +283,7 @@ struct hif_target_info {
uint32_t target_type;
uint32_t target_revision;
uint32_t soc_version;
char *hw_name;
};
struct hif_opaque_softc {

View file

@ -331,6 +331,9 @@ static const char *hif_get_hw_name(struct hif_target_info *info)
{
int i;
if (info->hw_name)
return info->hw_name;
for (i = 0; i < ARRAY_SIZE(qwlan_hw_list); i++) {
if (info->target_version == qwlan_hw_list[i].id &&
info->target_revision == qwlan_hw_list[i].subid) {
@ -338,7 +341,16 @@ static const char *hif_get_hw_name(struct hif_target_info *info)
}
}
return "Unknown Device";
info->hw_name = qdf_mem_malloc(64);
if (!info->hw_name)
return "Unknown Device (nomem)";
i = qdf_snprint(info->hw_name, 64, "HW_VERSION=%x.",
info->target_version);
if (i < 0)
return "Unknown Device (snprintf failure)";
else
return info->hw_name;
}
/**
@ -449,6 +461,12 @@ void hif_close(struct hif_opaque_softc *hif_ctx)
scn->athdiag_procfs_inited = false;
}
if (scn->target_info.hw_name) {
char *hw_name = scn->target_info.hw_name;
scn->target_info.hw_name = "ErrUnloading";
qdf_mem_free(hw_name);
}
hif_bus_close(scn);
qdf_mem_free(scn);
}