qcacld-3.0: Refine the TWT callback APIs

Currently the TWT enable complete and disable complete APIs specify a
void pointer for the context parameter.  It is fine for an API to use
a void pointer for a data structure that is opaque or a binary blob,
but in these cases an HDD handle is always passed, so explicitly
reference that type. This will allow the compiler to verify that the
correct type of parameter is being passed.

Change-Id: Ibbe3f6809e892833473d234bf19a9245d7e7c1f1
CRs-Fixed: 2276989
This commit is contained in:
Jeff Johnson 2018-07-03 19:40:44 -07:00 • committed by nshrivas
commit 3a08ff978a
5 changed files with 54 additions and 63 deletions

View file

@ -90,24 +90,6 @@ void hdd_update_tgt_twt_cap(struct hdd_context *hdd_ctx,
*/
void hdd_send_twt_enable_cmd(struct hdd_context *hdd_ctx);
/**
* hdd_twt_enable_comp_cb() - TWT enable complete event callback
* @hdd_ctx: pointer to global HDD Context
* @twt_event: TWT event data received from the target
*
* Return: None
*/
void hdd_twt_enable_comp_cb(void *hdd_ctx,
struct wmi_twt_enable_complete_event_param *params);
/**
* hdd_twt_disable_comp_cb() - TWT disable complete event callback
* @hdd_ctx: pointer to global HDD Context
*
* Return: None
*/
void hdd_twt_disable_comp_cb(void *hdd_ctx);
/**
* wlan_hdd_twt_init() - Initialize TWT
* @hdd_ctx: pointer to global HDD Context
@ -144,15 +126,6 @@ static inline void hdd_send_twt_enable_cmd(struct hdd_context *hdd_ctx)
{
}
static inline void hdd_twt_enable_comp_cb(void *hdd_ctx,
struct wmi_twt_enable_complete_event_param *params)
{
}
static inline void hdd_twt_disable_comp_cb(void *hdd_ctx)
{
}
static inline void wlan_hdd_twt_init(struct hdd_context *hdd_ctx)
{
}

View file

@ -79,10 +79,18 @@ void hdd_send_twt_enable_cmd(struct hdd_context *hdd_ctx)
wma_send_twt_enable_cmd(pdev_id, congestion_timeout);
}
void hdd_twt_enable_comp_cb(void *hddctx,
struct wmi_twt_enable_complete_event_param *params)
/**
* hdd_twt_enable_comp_cb() - TWT enable complete event callback
* @hdd_handle: opaque handle for the global HDD Context
* @twt_event: TWT event data received from the target
*
* Return: None
*/
static void
hdd_twt_enable_comp_cb(hdd_handle_t hdd_handle,
struct wmi_twt_enable_complete_event_param *params)
{
struct hdd_context *hdd_ctx = hddctx;
struct hdd_context *hdd_ctx = hdd_handle_to_context(hdd_handle);
enum twt_status prev_state;
if (!hdd_ctx) {
@ -112,9 +120,16 @@ void hdd_twt_enable_comp_cb(void *hddctx,
prev_state, hdd_ctx->twt_state);
}
void hdd_twt_disable_comp_cb(void *hddctx)
/**
* hdd_twt_disable_comp_cb() - TWT disable complete event callback
* @hdd_handle: opaque handle for the global HDD Context
*
* Return: None
*/
static void
hdd_twt_disable_comp_cb(hdd_handle_t hdd_handle)
{
struct hdd_context *hdd_ctx = hddctx;
struct hdd_context *hdd_ctx = hdd_handle_to_context(hdd_handle);
enum twt_status prev_state;
if (!hdd_ctx) {

View file

@ -2490,25 +2490,23 @@ uint8_t sme_get_mcs_idx(uint16_t max_rate, uint8_t rate_flags,
#ifdef WLAN_SUPPORT_TWT
/**
* sme_register_twt_enable_complete_cb() - TWT enable registrar
* @hal: HAL handle
* @mac_handle: MAC handle
* @twt_enable_cb: Function callback to handle enable event
* @hdd_ctx: Global HDD Context
*
* Return: QDF Status
*/
QDF_STATUS sme_register_twt_enable_complete_cb(tHalHandle hal,
void (*twt_enable_cb)(void *hdd_ctx,
struct wmi_twt_enable_complete_event_param *params));
QDF_STATUS sme_register_twt_enable_complete_cb(mac_handle_t mac_handle,
twt_enable_cb twt_enable_cb);
/**
* sme_register_twt_disable_complete_cb - TWT disable registrar
* @hal: HAL handle
* @mac_handle: MAC handle
* @twt_disable_cb: Function callback to handle disable event
*
* Return: QDF Status
*/
QDF_STATUS sme_register_twt_disable_complete_cb(tHalHandle hal,
void (*twt_disable_cb)(void *hdd_ctx));
QDF_STATUS sme_register_twt_disable_complete_cb(mac_handle_t mac_handle,
twt_disable_cb twt_disable_cb);
/**
* sme_deregister_twt_enable_complete_cb() - TWT enable deregistrar
@ -2516,7 +2514,7 @@ QDF_STATUS sme_register_twt_disable_complete_cb(tHalHandle hal,
*
* Return: QDF Status
*/
QDF_STATUS sme_deregister_twt_enable_complete_cb(tHalHandle hal);
QDF_STATUS sme_deregister_twt_enable_complete_cb(mac_handle_t mac_handle);
/**
* sme_deregister_twt_disable_complete_cb - TWT disable deregistrar
@ -2524,28 +2522,31 @@ QDF_STATUS sme_deregister_twt_enable_complete_cb(tHalHandle hal);
*
* Return: QDF Status
*/
QDF_STATUS sme_deregister_twt_disable_complete_cb(tHalHandle hal);
QDF_STATUS sme_deregister_twt_disable_complete_cb(mac_handle_t mac_handle);
#else
static inline QDF_STATUS sme_register_twt_enable_complete_cb(tHalHandle hal,
void (*twt_enable_cb)(void *hdd_ctx,
struct wmi_twt_enable_complete_event_param *params))
static inline
QDF_STATUS sme_register_twt_enable_complete_cb(mac_handle_t mac_handle,
twt_enable_cb twt_enable_cb)
{
return QDF_STATUS_SUCCESS;
}
static inline QDF_STATUS sme_register_twt_disable_complete_cb(tHalHandle hal,
void (*twt_disable_cb)(void *hdd_ctx))
static inline
QDF_STATUS sme_register_twt_disable_complete_cb(mac_handle_t mac_handle,
twt_disable_cb twt_disable_cb)
{
return QDF_STATUS_SUCCESS;
}
static inline QDF_STATUS sme_deregister_twt_enable_complete_cb(tHalHandle hal)
static inline
QDF_STATUS sme_deregister_twt_enable_complete_cb(mac_handle_t mac_handle)
{
return QDF_STATUS_SUCCESS;
}
static inline QDF_STATUS sme_deregister_twt_disable_complete_cb(tHalHandle hal)
static inline
QDF_STATUS sme_deregister_twt_disable_complete_cb(mac_handle_t mac_handle)
{
return QDF_STATUS_SUCCESS;
}

View file

@ -127,6 +127,10 @@ typedef void (*p2p_lo_callback)(void *context, void *event);
typedef void (*sme_send_oem_data_rsp_msg)(struct oem_data_rsp *);
#endif
typedef void (*twt_enable_cb)(hdd_handle_t hdd_handle,
struct wmi_twt_enable_complete_event_param *params);
typedef void (*twt_disable_cb)(hdd_handle_t hdd_handle);
#ifdef FEATURE_WLAN_APF
/**
* typedef apf_get_offload_cb - APF offload callback signature
@ -284,9 +288,8 @@ typedef struct tagSmeStruct {
void (*tx_queue_cb)(void *, uint32_t vdev_id,
enum netif_action_type action,
enum netif_reason_type reason);
void (*twt_enable_cb)(void *hdd_ctx,
struct wmi_twt_enable_complete_event_param *params);
void (*twt_disable_cb)(void *hdd_ctx);
twt_enable_cb twt_enable_cb;
twt_disable_cb twt_disable_cb;
#ifdef FEATURE_WLAN_APF
apf_get_offload_cb apf_get_offload_cb;
apf_read_mem_cb apf_read_mem_cb;

View file

@ -15435,12 +15435,11 @@ QDF_STATUS sme_deregister_tx_queue_cb(tHalHandle hal)
}
#ifdef WLAN_SUPPORT_TWT
QDF_STATUS sme_register_twt_enable_complete_cb(tHalHandle hal,
void (*twt_enable_cb)(void *hdd_ctx,
struct wmi_twt_enable_complete_event_param *params))
QDF_STATUS sme_register_twt_enable_complete_cb(mac_handle_t mac_handle,
twt_enable_cb twt_enable_cb)
{
QDF_STATUS status;
tpAniSirGlobal mac = PMAC_STRUCT(hal);
tpAniSirGlobal mac = MAC_CONTEXT(mac_handle);
status = sme_acquire_global_lock(&mac->sme);
if (QDF_IS_STATUS_SUCCESS(status)) {
@ -15454,11 +15453,11 @@ QDF_STATUS sme_register_twt_enable_complete_cb(tHalHandle hal,
return status;
}
QDF_STATUS sme_register_twt_disable_complete_cb(tHalHandle hal,
void (*twt_disable_cb)(void *hdd_ctx))
QDF_STATUS sme_register_twt_disable_complete_cb(mac_handle_t mac_handle,
twt_disable_cb twt_disable_cb)
{
QDF_STATUS status;
tpAniSirGlobal mac = PMAC_STRUCT(hal);
tpAniSirGlobal mac = MAC_CONTEXT(mac_handle);
status = sme_acquire_global_lock(&mac->sme);
if (QDF_IS_STATUS_SUCCESS(status)) {
@ -15472,14 +15471,14 @@ QDF_STATUS sme_register_twt_disable_complete_cb(tHalHandle hal,
return status;
}
QDF_STATUS sme_deregister_twt_enable_complete_cb(tHalHandle hal)
QDF_STATUS sme_deregister_twt_enable_complete_cb(mac_handle_t mac_handle)
{
return sme_register_twt_enable_complete_cb(hal, NULL);
return sme_register_twt_enable_complete_cb(mac_handle, NULL);
}
QDF_STATUS sme_deregister_twt_disable_complete_cb(tHalHandle hal)
QDF_STATUS sme_deregister_twt_disable_complete_cb(mac_handle_t mac_handle)
{
return sme_register_twt_disable_complete_cb(hal, NULL);
return sme_register_twt_disable_complete_cb(mac_handle, NULL);
}
#endif