1 /*
2 * Copyright (c) 2020, The Linux Foundation. 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 #include <qdf_hang_event_notifier.h>
17 #include <qdf_notifier.h>
18 #include "htc_hang_event.h"
19 #include "htc_internal.h"
20 #include "htc_credit_history.h"
21
htc_recovery_notifier_call(struct notifier_block * block,unsigned long state,void * data)22 static int htc_recovery_notifier_call(struct notifier_block *block,
23 unsigned long state,
24 void *data)
25 {
26 htc_log_hang_credit_history(block, data);
27
28 return NOTIFY_OK;
29 }
30
31 static qdf_notif_block htc_recovery_notifier = {
32 .notif_block.notifier_call = htc_recovery_notifier_call,
33 };
34
htc_hang_event_notifier_register(HTC_TARGET * target)35 QDF_STATUS htc_hang_event_notifier_register(HTC_TARGET *target)
36 {
37 htc_recovery_notifier.priv_data = target;
38 return qdf_hang_event_register_notifier(&htc_recovery_notifier);
39 }
40
htc_hang_event_notifier_unregister(void)41 QDF_STATUS htc_hang_event_notifier_unregister(void)
42 {
43 return qdf_hang_event_unregister_notifier(&htc_recovery_notifier);
44 }
45