|
@@ -21,6 +21,52 @@
|
|
|
#include "qdf_trace.h"
|
|
|
#include "qdf_types.h"
|
|
|
|
|
|
+#ifdef WLAN_DELAYED_WORK_DEBUG
|
|
|
+#include "qdf_tracker.h"
|
|
|
+
|
|
|
+#define qdf_dwork_tracker_bits 2 /* 4 buckets */
|
|
|
+static qdf_tracker_declare(qdf_dwork_tracker, qdf_dwork_tracker_bits,
|
|
|
+ "delayed work leaks", "delayed work create",
|
|
|
+ "delayed work destroy");
|
|
|
+
|
|
|
+void qdf_delayed_work_feature_init(void)
|
|
|
+{
|
|
|
+ qdf_tracker_init(&qdf_dwork_tracker);
|
|
|
+}
|
|
|
+
|
|
|
+void qdf_delayed_work_feature_deinit(void)
|
|
|
+{
|
|
|
+ qdf_tracker_deinit(&qdf_dwork_tracker);
|
|
|
+}
|
|
|
+
|
|
|
+void qdf_delayed_work_check_for_leaks(void)
|
|
|
+{
|
|
|
+ qdf_tracker_check_for_leaks(&qdf_dwork_tracker);
|
|
|
+}
|
|
|
+
|
|
|
+static inline QDF_STATUS qdf_dwork_dbg_track(struct qdf_delayed_work *dwork,
|
|
|
+ const char *func, uint32_t line)
|
|
|
+{
|
|
|
+ return qdf_tracker_track(&qdf_dwork_tracker, dwork, func, line);
|
|
|
+}
|
|
|
+
|
|
|
+static inline void qdf_dwork_dbg_untrack(struct qdf_delayed_work *dwork,
|
|
|
+ const char *func, uint32_t line)
|
|
|
+{
|
|
|
+ qdf_tracker_untrack(&qdf_dwork_tracker, dwork, func, line);
|
|
|
+}
|
|
|
+#else
|
|
|
+static inline QDF_STATUS qdf_dwork_dbg_track(struct qdf_delayed_work *dwork,
|
|
|
+ const char *func, uint32_t line)
|
|
|
+{
|
|
|
+ return QDF_STATUS_SUCCESS;
|
|
|
+}
|
|
|
+
|
|
|
+static inline void qdf_dwork_dbg_untrack(struct qdf_delayed_work *dwork,
|
|
|
+ const char *func, uint32_t line)
|
|
|
+{ }
|
|
|
+#endif /* WLAN_DELAYED_WORK_DEBUG */
|
|
|
+
|
|
|
static void __qdf_delayed_work_handler(struct work_struct *work)
|
|
|
{
|
|
|
struct qdf_delayed_work *dwork =
|
|
@@ -29,15 +75,22 @@ static void __qdf_delayed_work_handler(struct work_struct *work)
|
|
|
dwork->callback(dwork->context);
|
|
|
}
|
|
|
|
|
|
-QDF_STATUS qdf_delayed_work_create(struct qdf_delayed_work *dwork,
|
|
|
- qdf_delayed_work_cb callback,
|
|
|
- void *context)
|
|
|
+QDF_STATUS __qdf_delayed_work_create(struct qdf_delayed_work *dwork,
|
|
|
+ qdf_delayed_work_cb callback,
|
|
|
+ void *context,
|
|
|
+ const char *func, uint32_t line)
|
|
|
{
|
|
|
+ QDF_STATUS status;
|
|
|
+
|
|
|
QDF_BUG(dwork);
|
|
|
QDF_BUG(callback);
|
|
|
if (!dwork || !callback)
|
|
|
return QDF_STATUS_E_INVAL;
|
|
|
|
|
|
+ status = qdf_dwork_dbg_track(dwork, func, line);
|
|
|
+ if (QDF_IS_STATUS_ERROR(status))
|
|
|
+ return status;
|
|
|
+
|
|
|
INIT_DELAYED_WORK(&dwork->dwork, __qdf_delayed_work_handler);
|
|
|
dwork->callback = callback;
|
|
|
dwork->context = context;
|
|
@@ -45,9 +98,11 @@ QDF_STATUS qdf_delayed_work_create(struct qdf_delayed_work *dwork,
|
|
|
return QDF_STATUS_SUCCESS;
|
|
|
}
|
|
|
|
|
|
-void qdf_delayed_work_destroy(struct qdf_delayed_work *dwork)
|
|
|
+void __qdf_delayed_work_destroy(struct qdf_delayed_work *dwork,
|
|
|
+ const char *func, uint32_t line)
|
|
|
{
|
|
|
qdf_delayed_work_stop_sync(dwork);
|
|
|
+ qdf_dwork_dbg_untrack(dwork, func, line);
|
|
|
}
|
|
|
|
|
|
bool qdf_delayed_work_start(struct qdf_delayed_work *dwork, uint32_t msec)
|