qcacld-3.0: Define API to retrieve adapter by interface name
Define HDD API to get adapter by interface name. This will be used in
NDI + NDI and similar scenarios.
Change-Id: Icd7fb7c60c67e73aa030752b2e6840853a242fc9
CRs-Fixed: 2032704
diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c
index f4bbf27..343530e 100644
--- a/core/hdd/src/wlan_hdd_main.c
+++ b/core/hdd/src/wlan_hdd_main.c
@@ -4749,6 +4749,31 @@
return NULL;
}
+hdd_adapter_t *hdd_get_adapter_by_iface_name(hdd_context_t *hdd_ctx,
+ const char *iface_name)
+{
+ hdd_adapter_list_node_t *adapter_node = NULL, *next = NULL;
+ hdd_adapter_t *adapter;
+ QDF_STATUS qdf_status;
+
+ qdf_status = hdd_get_front_adapter(hdd_ctx, &adapter_node);
+
+ while ((NULL != adapter_node) &&
+ (QDF_STATUS_SUCCESS == qdf_status)) {
+ adapter = adapter_node->pAdapter;
+
+ if (adapter &&
+ !qdf_str_cmp(adapter->dev->name, iface_name))
+ return adapter;
+
+ qdf_status =
+ hdd_get_next_adapter(hdd_ctx,
+ adapter_node, &next);
+ adapter_node = next;
+ }
+ return NULL;
+}
+
/**
* hdd_get_adapter() - to get adapter matching the mode
* @hdd_ctx: hdd context