• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
3  *
4  * HDF is dual licensed: you can use it either under the terms of
5  * the GPL, or the BSD license, at your option.
6  * See the LICENSE file in the root of this repository for complete details.
7  */
8 
9 #include "wifi_module.h"
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
AddFeature(struct WifiModule * module,uint16_t featureType,struct WifiFeature * feature)15 int32_t AddFeature(struct WifiModule *module, uint16_t featureType, struct WifiFeature *feature)
16 {
17     if ((module == NULL) || (feature == NULL) || (featureType >= HDF_WIFI_FEATURE_NUM)) {
18         HDF_LOGE("%s: para error", __func__);
19         return HDF_FAILURE;
20     }
21     module->feList.fe[featureType] = (struct WifiFeature *)feature;
22     if (feature->init != NULL) {
23         return feature->init(feature);
24     }
25 
26     HDF_LOGE("%s: feature has no init", __func__);
27     return HDF_FAILURE;
28 }
29 
DelFeature(struct WifiModule * module,uint16_t featureType)30 int32_t DelFeature(struct WifiModule *module, uint16_t featureType)
31 {
32     struct WifiFeature *featureData = NULL;
33     if ((module == NULL) || (featureType >= HDF_WIFI_FEATURE_NUM)) {
34         HDF_LOGE("%s: para error", __func__);
35         return HDF_FAILURE;
36     }
37 
38     featureData = module->feList.fe[featureType];
39     if ((featureData != NULL) && (featureData->deInit != NULL)) {
40         featureData->deInit(module->feList.fe[featureType]);
41         featureData = NULL;
42         return HDF_SUCCESS;
43     }
44     return HDF_FAILURE;
45 }
46 
47 #ifdef __cplusplus
48 }
49 #endif
50