qcacmn: Add qdf_opmode_str()

It is often useful to print the human readable version of an operating
mode in a log message or some other user-facing string. Add a function
for mapping QDF_OPMODE to human readable strings, qdf_opmode_str(), in
QDF such that various consumers do not have to implement it themselves.

Change-Id: I8756fb2ea97b3b8c7af2633b07694ad1e74d6d3e
CRs-Fixed: 2331888
This commit is contained in:
Dustin Brown
2018-10-10 17:08:31 -07:00
committed by nshrivas
vanhempi b13d3af59f
commit 90556671c5
2 muutettua tiedostoa jossa 49 lisäystä ja 0 poistoa

Näytä tiedosto

@@ -553,9 +553,20 @@ enum QDF_OPMODE {
QDF_WDS_MODE,
QDF_BTAMP_MODE,
QDF_AHDEMO_MODE,
/* Add new OP Modes to qdf_opmode_str as well */
QDF_MAX_NO_OF_MODE
};
/**
* qdf_opmode_str() - Return a human readable string representation of @opmode
* @opmode: The opmode to convert
*
* Return: string representation of @opmode
*/
const char *qdf_opmode_str(const enum QDF_OPMODE opmode);
/**
* enum QDF_GLOBAL_MODE - global mode when driver is loaded.
*

Näytä tiedosto

@@ -23,6 +23,44 @@
#include "qdf_trace.h"
#include "qdf_types.h"
const char *qdf_opmode_str(const enum QDF_OPMODE opmode)
{
switch (opmode) {
case QDF_STA_MODE:
return "STA";
case QDF_SAP_MODE:
return "SAP";
case QDF_P2P_CLIENT_MODE:
return "P2P Client";
case QDF_P2P_GO_MODE:
return "P2P GO";
case QDF_FTM_MODE:
return "FTM";
case QDF_IBSS_MODE:
return "IBSS";
case QDF_MONITOR_MODE:
return "Monitor";
case QDF_P2P_DEVICE_MODE:
return "P2P Device";
case QDF_OCB_MODE:
return "OCB";
case QDF_EPPING_MODE:
return "EPPing";
case QDF_QVIT_MODE:
return "QVIT";
case QDF_NDI_MODE:
return "NDI";
case QDF_WDS_MODE:
return "WDS";
case QDF_BTAMP_MODE:
return "BTAMP";
case QDF_AHDEMO_MODE:
return "AHDEMO";
default:
return "Invalid operating mode";
}
}
static QDF_STATUS qdf_consume_char(const char **str, char c)
{
if ((*str)[0] != c)