1 /* 2 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. 3 * 4 * Permission to use, copy, modify, and/or distribute this software for any 5 * purpose with or without fee is hereby granted, provided that the above 6 * copyright notice and this permission notice appear in all copies. 7 * 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 */ 16 17 /** 18 * DOC: osif_twt_rsp.c 19 * 20 */ 21 #include <qdf_status.h> 22 #include <wlan_cfg80211.h> 23 #include <osif_twt_rsp.h> 24 #include <osif_twt_util.h> 25 #include <wlan_osif_request_manager.h> 26 27 /** 28 * osif_twt_enable_complete_cb() - callback for twt enable complete event 29 * @psoc: Pointer to global psoc 30 * @event: Pointer to TWT enable dialog complete event structure 31 * @context: TWT enable context set during TWT enable request 32 * 33 * Return: QDF_STATUS 34 */ 35 QDF_STATUS 36 osif_twt_enable_complete_cb(struct wlan_objmgr_psoc *psoc, 37 struct twt_enable_complete_event_param *event, 38 void *context) 39 { 40 struct twt_en_dis_priv *twt_en_priv; 41 struct osif_request *request = NULL; 42 43 osif_debug("osif_twt_enable_complete_cb"); 44 request = osif_request_get(context); 45 if (!request) { 46 osif_err("obsolete request"); 47 return QDF_STATUS_E_FAILURE; 48 } 49 50 twt_en_priv = osif_request_priv(request); 51 if (!twt_en_priv) { 52 osif_err("obsolete twt_en_priv"); 53 return QDF_STATUS_E_FAILURE; 54 } 55 56 twt_en_priv->pdev_id = event->pdev_id; 57 twt_en_priv->status = event->status; 58 59 osif_request_complete(request); 60 osif_request_put(request); 61 return QDF_STATUS_SUCCESS; 62 } 63 64 /** 65 * osif_twt_disable_complete_cb() - callback for twt disable complete event 66 * @psoc: Pointer to global psoc 67 * @event: Pointer to TWT disable dialog complete event structure 68 * @context: TWT disable context set during TWT disable request 69 * 70 * Return: QDF_STATUS 71 */ 72 QDF_STATUS 73 osif_twt_disable_complete_cb(struct wlan_objmgr_psoc *psoc, 74 struct twt_disable_complete_event_param *event, 75 void *context) 76 { 77 struct twt_en_dis_priv *twt_en_priv; 78 struct osif_request *request = NULL; 79 80 osif_debug("osif_handle_twt_disable_complete"); 81 request = osif_request_get(context); 82 if (!request) { 83 osif_err("obsolete request"); 84 return QDF_STATUS_E_FAILURE; 85 } 86 87 twt_en_priv = osif_request_priv(request); 88 if (!twt_en_priv) { 89 osif_err("obsolete twt_en_priv"); 90 return QDF_STATUS_E_FAILURE; 91 } 92 93 twt_en_priv->pdev_id = event->pdev_id; 94 twt_en_priv->status = event->status; 95 96 osif_request_complete(request); 97 osif_request_put(request); 98 return QDF_STATUS_SUCCESS; 99 } 100 101