mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-14 08:36:12 -04:00
qcacld-3.0: Introduce hdd_handle_to_context()
Currently direct typecasting is used to convert an HDD handle to HDD context. Typecasting has the disadvantage that it does not allow the compiler to validate that the input item being typecast really is an hdd_handle_t. In order to allow the compiler to typecheck the input item introduce a converter API, and update the current existing typecasts to use the converter. Change-Id: Ifc7c3e062af234b378f1fb806cae0814ac52e423 CRs-Fixed: 2273915
This commit is contained in:
parent
d2111fa3ae
commit
ea70b9480d
3 changed files with 13 additions and 7 deletions
|
|
@ -3385,4 +3385,15 @@ mac_handle_t hdd_adapter_get_mac_handle(struct hdd_adapter *adapter)
|
|||
hdd_context_get_mac_handle(adapter->hdd_ctx) : NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* hdd_handle_to_context() - turn an HDD handle into an HDD context
|
||||
* @hdd_handle: HDD handle to be converted
|
||||
*
|
||||
* Return: HDD context referenced by @hdd_handle
|
||||
*/
|
||||
static inline
|
||||
struct hdd_context *hdd_handle_to_context(hdd_handle_t hdd_handle)
|
||||
{
|
||||
return (struct hdd_context *)hdd_handle;
|
||||
}
|
||||
#endif /* end #if !defined(WLAN_HDD_MAIN_H) */
|
||||
|
|
|
|||
|
|
@ -1907,7 +1907,7 @@ static void hdd_update_ra_rate_limit(struct hdd_context *hdd_ctx,
|
|||
void hdd_update_tgt_cfg(hdd_handle_t hdd_handle, struct wma_tgt_cfg *cfg)
|
||||
{
|
||||
int ret;
|
||||
struct hdd_context *hdd_ctx = (struct hdd_context *)hdd_handle;
|
||||
struct hdd_context *hdd_ctx = hdd_handle_to_context(hdd_handle);
|
||||
uint8_t temp_band_cap;
|
||||
struct cds_config_info *cds_cfg = cds_get_ini_config();
|
||||
uint8_t antenna_mode;
|
||||
|
|
|
|||
|
|
@ -2296,17 +2296,12 @@ void wlan_hdd_cfg80211_link_layer_stats_ext_callback(hdd_handle_t ctx,
|
|||
|
||||
hdd_enter();
|
||||
|
||||
if (!ctx) {
|
||||
hdd_err("Invalid HDD context.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!rsp) {
|
||||
hdd_err("Invalid result.");
|
||||
return;
|
||||
}
|
||||
|
||||
hdd_ctx = (struct hdd_context *)ctx;
|
||||
hdd_ctx = hdd_handle_to_context(ctx);
|
||||
linkLayer_stats_results = rsp;
|
||||
|
||||
status = wlan_hdd_validate_context(hdd_ctx);
|
||||
|
|
|
|||
Loading…
Reference in a new issue