qcacld-3.0: Replace typedef tSirLinkSpeedInfo

The Linux Coding Style enumerates a few special cases where typedefs
are useful, but stresses "NEVER EVER use a typedef unless you can
clearly match one of those rules." The tSirLinkSpeedInfo typedef does
not meet any of those criteria, so replace it (and the "tp" variant)
with a reference to the underlying struct.

Further note the Linux Coding Style frowns upon mixed-case names and
so-called Hungarian notation, so in conjunction rename the underlying
struct to be in compliance.

Change-Id: I36ab84336b9f0290bc68eb5a42678fd49d0f3c51
CRs-Fixed: 2399107
This commit is contained in:
Jeff Johnson
2019-02-08 22:45:17 -08:00
committed by nshrivas
parent 10cde6968b
commit e943bca8f9
8 changed files with 53 additions and 30 deletions

View File

@@ -5433,11 +5433,11 @@ QDF_STATUS wlan_hdd_get_snr(struct hdd_adapter *adapter, int8_t *snr)
} }
struct linkspeed_priv { struct linkspeed_priv {
tSirLinkSpeedInfo linkspeed_info; struct link_speed_info linkspeed_info;
}; };
static void static void
hdd_get_link_speed_cb(tSirLinkSpeedInfo *linkspeed_info, void *context) hdd_get_link_speed_cb(struct link_speed_info *linkspeed_info, void *context)
{ {
struct osif_request *request; struct osif_request *request;
struct linkspeed_priv *priv; struct linkspeed_priv *priv;
@@ -5466,7 +5466,7 @@ int wlan_hdd_get_linkspeed_for_peermac(struct hdd_adapter *adapter,
int ret; int ret;
QDF_STATUS status; QDF_STATUS status;
void *cookie; void *cookie;
tSirLinkSpeedInfo *linkspeed_info; struct link_speed_info *linkspeed_info;
struct osif_request *request; struct osif_request *request;
struct linkspeed_priv *priv; struct linkspeed_priv *priv;
static const struct osif_request_params params = { static const struct osif_request_params params = {

View File

@@ -2670,11 +2670,11 @@ typedef struct sSirChAvoidUpdateReq {
} tSirChAvoidUpdateReq; } tSirChAvoidUpdateReq;
#endif /* FEATURE_WLAN_CH_AVOID */ #endif /* FEATURE_WLAN_CH_AVOID */
typedef struct sSirLinkSpeedInfo { struct link_speed_info {
/* MAC Address for the peer */ /* MAC Address for the peer */
struct qdf_mac_addr peer_macaddr; struct qdf_mac_addr peer_macaddr;
uint32_t estLinkSpeed; /* Linkspeed from firmware */ uint32_t estLinkSpeed; /* Linkspeed from firmware */
} tSirLinkSpeedInfo, *tpSirLinkSpeedInfo; };
/** /**
* struct sir_peer_info_req - peer info request struct * struct sir_peer_info_req - peer info request struct

View File

@@ -946,11 +946,22 @@ QDF_STATUS sme_init_thermal_info(mac_handle_t mac_handle);
QDF_STATUS sme_set_thermal_level(mac_handle_t mac_handle, uint8_t level); QDF_STATUS sme_set_thermal_level(mac_handle_t mac_handle, uint8_t level);
QDF_STATUS sme_txpower_limit(mac_handle_t mac_handle, tSirTxPowerLimit *psmetx); QDF_STATUS sme_txpower_limit(mac_handle_t mac_handle, tSirTxPowerLimit *psmetx);
/**
* sme_get_link_speed() - Retrieve current link speed
* @mac_handle: Global MAC handle
* @req: Link speed request structure
* @context: User context to be passed back when invoking @cb
* @cb: Callback function to be invoked with link speed results
*
* Return: QDF_STATUS_SUCCESS if the request was accepted, otherwise
* an appropriate error status.
*/
QDF_STATUS sme_get_link_speed(mac_handle_t mac_handle, QDF_STATUS sme_get_link_speed(mac_handle_t mac_handle,
tSirLinkSpeedInfo *lsReq, struct link_speed_info *req,
void *plsContext, void *context,
void (*pCallbackfn)(tSirLinkSpeedInfo *indParam, sme_link_speed_cb cb);
void *pContext));
QDF_STATUS sme_modify_add_ie(mac_handle_t mac_handle, QDF_STATUS sme_modify_add_ie(mac_handle_t mac_handle,
tSirModifyIE *pModifyIE, eUpdateIEsType updateType); tSirModifyIE *pModifyIE, eUpdateIEsType updateType);
QDF_STATUS sme_update_add_ie(mac_handle_t mac_handle, QDF_STATUS sme_update_add_ie(mac_handle_t mac_handle,

View File

@@ -129,6 +129,18 @@ typedef void (*link_layer_stats_cb)(hdd_handle_t hdd_handle,
typedef void (*ext_scan_ind_cb)(hdd_handle_t hdd_handle, typedef void (*ext_scan_ind_cb)(hdd_handle_t hdd_handle,
const uint16_t, void *); const uint16_t, void *);
/**
* typedef sme_link_speed_cb - sme_get_link_speed() callback function
* @info: link speed information
* @context: user context supplied to sme_get_link_speed()
*
* This is the signature of a callback function whose addresses is
* passed as the asynchronous callback function to sme_get_link_speed().
*/
typedef void (*sme_link_speed_cb)(struct link_speed_info *info,
void *context);
typedef void (*ocb_callback)(void *context, void *response); typedef void (*ocb_callback)(void *context, void *response);
typedef void (*sme_set_thermal_level_callback)(hdd_handle_t hdd_handle, typedef void (*sme_set_thermal_level_callback)(hdd_handle_t hdd_handle,
u_int8_t level); u_int8_t level);
@@ -273,9 +285,8 @@ typedef struct tagSmeStruct {
stats_ext_cb stats_ext_cb; stats_ext_cb stats_ext_cb;
stats_ext2_cb stats_ext2_cb; stats_ext2_cb stats_ext2_cb;
/* linkspeed callback */ /* linkspeed callback */
void (*pLinkSpeedIndCb)(tSirLinkSpeedInfo *indParam, sme_link_speed_cb link_speed_cb;
void *pDevContext); void *link_speed_context;
void *pLinkSpeedCbContext;
/* get peer info callback */ /* get peer info callback */
void (*pget_peer_info_ind_cb)(struct sir_peer_info_resp *param, void (*pget_peer_info_ind_cb)(struct sir_peer_info_resp *param,
void *pcontext); void *pcontext);

View File

@@ -7237,17 +7237,16 @@ bool sme_is_feature_supported_by_fw(enum cap_bitmap feature)
return IS_FEATURE_SUPPORTED_BY_FW(feature); return IS_FEATURE_SUPPORTED_BY_FW(feature);
} }
QDF_STATUS sme_get_link_speed(mac_handle_t mac_handle, tSirLinkSpeedInfo *lsReq, QDF_STATUS sme_get_link_speed(mac_handle_t mac_handle,
void *plsContext, struct link_speed_info *req,
void (*pCallbackfn)(tSirLinkSpeedInfo *indParam, void *context,
void *pContext)) sme_link_speed_cb cb)
{ {
QDF_STATUS status;
QDF_STATUS status = QDF_STATUS_SUCCESS;
struct mac_context *mac; struct mac_context *mac;
void *wma_handle; void *wma_handle;
if (!mac_handle || !pCallbackfn || !lsReq) { if (!mac_handle || !cb || !req) {
QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR,
FL("Invalid parameter")); FL("Invalid parameter"));
return QDF_STATUS_E_FAILURE; return QDF_STATUS_E_FAILURE;
@@ -7267,9 +7266,9 @@ QDF_STATUS sme_get_link_speed(mac_handle_t mac_handle, tSirLinkSpeedInfo *lsReq,
return QDF_STATUS_E_FAILURE; return QDF_STATUS_E_FAILURE;
} }
mac->sme.pLinkSpeedCbContext = plsContext; mac->sme.link_speed_context = context;
mac->sme.pLinkSpeedIndCb = pCallbackfn; mac->sme.link_speed_cb = cb;
status = wma_get_link_speed(wma_handle, lsReq); status = wma_get_link_speed(wma_handle, req);
sme_release_global_lock(&mac->sme); sme_release_global_lock(&mac->sme);
return status; return status;
} }

View File

@@ -148,7 +148,8 @@ void wma_set_peer_authorized_cb(void *wma_ctx, wma_peer_authorized_fp auth_cb);
QDF_STATUS wma_set_peer_param(void *wma_ctx, uint8_t *peer_addr, QDF_STATUS wma_set_peer_param(void *wma_ctx, uint8_t *peer_addr,
uint32_t param_id, uint32_t param_id,
uint32_t param_value, uint32_t vdev_id); uint32_t param_value, uint32_t vdev_id);
QDF_STATUS wma_get_link_speed(WMA_HANDLE handle, tSirLinkSpeedInfo *pLinkSpeed); QDF_STATUS wma_get_link_speed(WMA_HANDLE handle,
struct link_speed_info *pLinkSpeed);
#ifdef NOT_YET #ifdef NOT_YET
QDF_STATUS wma_update_channel_list(WMA_HANDLE handle, void *scan_chan_info); QDF_STATUS wma_update_channel_list(WMA_HANDLE handle, void *scan_chan_info);
#endif #endif

View File

@@ -805,7 +805,8 @@ WLAN_PHY_MODE wma_chan_phy_mode(uint8_t chan, enum phy_ch_width chan_width,
* *
* Return: QDF status * Return: QDF status
*/ */
QDF_STATUS wma_get_link_speed(WMA_HANDLE handle, tSirLinkSpeedInfo *pLinkSpeed) QDF_STATUS wma_get_link_speed(WMA_HANDLE handle,
struct link_speed_info *pLinkSpeed)
{ {
tp_wma_handle wma_handle = (tp_wma_handle) handle; tp_wma_handle wma_handle = (tp_wma_handle) handle;
wmi_mac_addr peer_macaddr; wmi_mac_addr peer_macaddr;

View File

@@ -3470,7 +3470,7 @@ int wma_peer_info_event_handler(void *handle, u_int8_t *cmd_param_info,
QDF_STATUS wma_send_link_speed(uint32_t link_speed) QDF_STATUS wma_send_link_speed(uint32_t link_speed)
{ {
struct mac_context *mac_ctx; struct mac_context *mac_ctx;
tSirLinkSpeedInfo *ls_ind; struct link_speed_info *ls_ind;
mac_ctx = cds_get_context(QDF_MODULE_ID_PE); mac_ctx = cds_get_context(QDF_MODULE_ID_PE);
if (!mac_ctx) { if (!mac_ctx) {
@@ -3478,16 +3478,16 @@ QDF_STATUS wma_send_link_speed(uint32_t link_speed)
return QDF_STATUS_E_INVAL; return QDF_STATUS_E_INVAL;
} }
ls_ind = qdf_mem_malloc(sizeof(tSirLinkSpeedInfo)); ls_ind = qdf_mem_malloc(sizeof(*ls_ind));
if (!ls_ind) if (!ls_ind)
return QDF_STATUS_E_NOMEM; return QDF_STATUS_E_NOMEM;
ls_ind->estLinkSpeed = link_speed; ls_ind->estLinkSpeed = link_speed;
if (mac_ctx->sme.pLinkSpeedIndCb) if (mac_ctx->sme.link_speed_cb)
mac_ctx->sme.pLinkSpeedIndCb(ls_ind, mac_ctx->sme.link_speed_cb(ls_ind,
mac_ctx->sme.pLinkSpeedCbContext); mac_ctx->sme.link_speed_context);
else else
WMA_LOGD("%s: pLinkSpeedIndCb is null", __func__); WMA_LOGD("%s: link_speed_cb is null", __func__);
qdf_mem_free(ls_ind); qdf_mem_free(ls_ind);
return QDF_STATUS_SUCCESS; return QDF_STATUS_SUCCESS;