diff --git a/hif/inc/hif.h b/hif/inc/hif.h index 8823e8cc4c44..9ff72e6640c0 100644 --- a/hif/inc/hif.h +++ b/hif/inc/hif.h @@ -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 { diff --git a/hif/src/hif_main.c b/hif/src/hif_main.c index c87da4da6990..6d775ad04a84 100644 --- a/hif/src/hif_main.c +++ b/hif/src/hif_main.c @@ -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); }