summaryrefslogtreecommitdiff
path: root/qcwcn/wifi_hal/rssi_monitor.cpp
diff options
context:
space:
mode:
authorSubhani Shaik <subhanis@codeaurora.org>2017-11-30 00:59:17 +0530
committerRoshan Pius <rpius@google.com>2017-12-14 17:45:19 +0000
commit9b620802a517b1745255e7622b81c426918b7a2e (patch)
tree068da4a28b877d951739912e6a003df4e49c09ec /qcwcn/wifi_hal/rssi_monitor.cpp
parent1f86a9565af7ae36981f6b9dc3b1c70fec39d9d8 (diff)
downloadwlan-9b620802a517b1745255e7622b81c426918b7a2e.tar.gz
WiFi-Hal: Clean up the return codes in wifi-hal
Use error codes from "enum wifi_error" throughout the wifi-hal. Convert the error codes returned by kernel to "enum wifi_error" codes appropriately before passing them to upper layers. Change-Id: I62937e3c7870ba1b48b8aeedf38c89c2424532b4 (cherry-picked from d54aafdb39c095318c7fecab6551e018297069ed)
Diffstat (limited to 'qcwcn/wifi_hal/rssi_monitor.cpp')
-rw-r--r--qcwcn/wifi_hal/rssi_monitor.cpp66
1 files changed, 33 insertions, 33 deletions
diff --git a/qcwcn/wifi_hal/rssi_monitor.cpp b/qcwcn/wifi_hal/rssi_monitor.cpp
index b4df331..66b62e6 100644
--- a/qcwcn/wifi_hal/rssi_monitor.cpp
+++ b/qcwcn/wifi_hal/rssi_monitor.cpp
@@ -253,7 +253,7 @@ wifi_error wifi_start_rssi_monitoring(wifi_request_id id,
s8 min_rssi,
wifi_rssi_event_handler eh)
{
- int ret = WIFI_SUCCESS;
+ wifi_error ret;
struct nlattr *nlData;
WifiVendorCommand *vCommand = NULL;
wifi_handle wifiHandle = getWifiHandle(iface);
@@ -264,7 +264,7 @@ wifi_error wifi_start_rssi_monitoring(wifi_request_id id,
&vCommand);
if (ret != WIFI_SUCCESS) {
ALOGE("%s: Initialization failed", __FUNCTION__);
- return mapErrorKernelToWifiHAL(ret);
+ return mapKernelErrortoWifiHalError(ret);
}
ALOGV("%s: Max RSSI:%d Min RSSI:%d", __FUNCTION__,
@@ -274,47 +274,49 @@ wifi_error wifi_start_rssi_monitoring(wifi_request_id id,
if (!nlData)
goto cleanup;
- if (vCommand->put_u32(
- QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_CONTROL,
- QCA_WLAN_RSSI_MONITORING_START) ||
- vCommand->put_u32(
- QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_REQUEST_ID,
- id) ||
- vCommand->put_s8(
- QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_MAX_RSSI,
- max_rssi) ||
- vCommand->put_s8(
- QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_MIN_RSSI,
- min_rssi))
- {
+ ret = vCommand->put_u32(QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_CONTROL,
+ QCA_WLAN_RSSI_MONITORING_START);
+ if (ret != WIFI_SUCCESS)
+ goto cleanup;
+ ret = vCommand->put_u32(QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_REQUEST_ID,
+ id);
+ if (ret != WIFI_SUCCESS)
+ goto cleanup;
+ ret = vCommand->put_s8(QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_MAX_RSSI,
+ max_rssi);
+ if (ret != WIFI_SUCCESS)
+ goto cleanup;
+ ret = vCommand->put_s8(QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_MIN_RSSI,
+ min_rssi);
+ if (ret != WIFI_SUCCESS)
goto cleanup;
- }
vCommand->attr_end(nlData);
rssiCommand = RSSIMonitorCommand::instance(wifiHandle, id);
if (rssiCommand == NULL) {
ALOGE("%s: Error rssiCommand NULL", __FUNCTION__);
- return WIFI_ERROR_OUT_OF_MEMORY;
+ ret = WIFI_ERROR_OUT_OF_MEMORY;
+ goto cleanup;
}
rssiCommand->setCallbackHandler(eh);
ret = vCommand->requestResponse();
- if (ret < 0)
+ if (ret != WIFI_SUCCESS)
goto cleanup;
rssiCommand->enableEventHandling();
cleanup:
delete vCommand;
- return mapErrorKernelToWifiHAL(ret);
+ return mapKernelErrortoWifiHalError(ret);
}
wifi_error wifi_stop_rssi_monitoring(wifi_request_id id,
wifi_interface_handle iface)
{
- int ret = WIFI_SUCCESS;
+ wifi_error ret;
struct nlattr *nlData;
WifiVendorCommand *vCommand = NULL;
wifi_handle wifiHandle = getWifiHandle(iface);
@@ -322,7 +324,7 @@ wifi_error wifi_stop_rssi_monitoring(wifi_request_id id,
rssi_monitor_event_handlers* event_handlers;
hal_info *info = getHalInfo(wifiHandle);
- event_handlers = (rssi_monitor_event_handlers*)info->rssi_handlers;
+ event_handlers = info->rssi_handlers;
rssiCommand = event_handlers->mRSSIMonitorCommandInstance;
if (rssiCommand == NULL ||
@@ -337,7 +339,7 @@ wifi_error wifi_stop_rssi_monitoring(wifi_request_id id,
&vCommand);
if (ret != WIFI_SUCCESS) {
ALOGE("%s: Initialization failed", __FUNCTION__);
- return mapErrorKernelToWifiHAL(ret);
+ return mapKernelErrortoWifiHalError(ret);
}
/* Add the vendor specific attributes for the NL command. */
@@ -345,26 +347,24 @@ wifi_error wifi_stop_rssi_monitoring(wifi_request_id id,
if (!nlData)
goto cleanup;
- if (vCommand->put_u32(
- QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_CONTROL,
- QCA_WLAN_RSSI_MONITORING_STOP) ||
- vCommand->put_u32(
- QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_REQUEST_ID,
- id))
- {
+ ret = vCommand->put_u32(QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_CONTROL,
+ QCA_WLAN_RSSI_MONITORING_STOP);
+ if (ret != WIFI_SUCCESS)
+ goto cleanup;
+ ret = vCommand->put_u32(QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_REQUEST_ID,
+ id);
+ if (ret != WIFI_SUCCESS)
goto cleanup;
- }
vCommand->attr_end(nlData);
ret = vCommand->requestResponse();
- if (ret < 0)
+ if (ret != WIFI_SUCCESS)
goto cleanup;
rssiCommand->disableEventHandling();
-
cleanup:
delete vCommand;
- return mapErrorKernelToWifiHAL(ret);
+ return mapKernelErrortoWifiHalError(ret);
}