xref: /wlan-dirver/qca-wifi-host-cmn/qdf/linux/src/qdf_defer.c (revision dd4dc88b837a295134aa9869114a2efee0f4894b)
1 /*
2  * Copyright (c) 2014-2019 The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 /**
20  * DOC: qdf_defer.c
21  * This file provides OS dependent deferred API's.
22  */
23 
24 #include <linux/kernel.h>
25 #include <linux/module.h>
26 #include <linux/workqueue.h>
27 
28 #include "i_qdf_defer.h"
29 #include <qdf_module.h>
30 
31 /**
32  * __qdf_defer_func() - defer work handler
33  * @work: Pointer to defer work
34  *
35  * Return: none
36  */
37 void __qdf_defer_func(struct work_struct *work)
38 {
39 	__qdf_work_t *ctx = container_of(work, __qdf_work_t, work);
40 
41 	if (!ctx->fn) {
42 		QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
43 			  "No callback registered !!");
44 		return;
45 	}
46 	ctx->fn(ctx->arg);
47 }
48 qdf_export_symbol(__qdf_defer_func);
49 
50