summaryrefstree
path: root/kernel/drivers/input/sec_input/sec_input_notifier.c
blob: 858e857941361c4880282ad65bdebe15ac63efaf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
 * sec_notifier.c - samsung common functions
 *
 * Copyright (C) 2020 Samsung Electronics
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 */
//#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/input.h>

static BLOCKING_NOTIFIER_HEAD(sec_input_notifier_list);

/*
 * sec_input_register_notify
 * @nb: pointer of blocking notifier chain structure
 * @notifier_fn_t: register notifier callback function
 *
 * register universal notifier for any development issue.
 * ex) folder open/close, seucre touch enable/disable ...
 */
void sec_input_register_notify(struct notifier_block *nb, notifier_fn_t notifier_call, int priority)
{
	nb->notifier_call = notifier_call;
	nb->priority = priority;
	blocking_notifier_chain_register(&sec_input_notifier_list, nb);
}
EXPORT_SYMBOL(sec_input_register_notify);

/*
 * sec_input_unregister_notify
 * @nb: pointer of blocking notifier chain structure
 * 
 * unregister notifier
 */
void sec_input_unregister_notify(struct notifier_block *nb)
{
	blocking_notifier_chain_unregister(&sec_input_notifier_list, nb);
}
EXPORT_SYMBOL(sec_input_unregister_notify);

/*
 * sec_input_notify
 * @nb: pointer of blocking notifier chain structure
 * data: notifier type is defined in sec_input.h(enum sec_input_notify_t)
 * v: structure data
 *
 * notifier call function
 */
int sec_input_notify(struct notifier_block *nb, unsigned long noti, void *v)
{
	return blocking_notifier_call_chain(&sec_input_notifier_list, noti, v);
}
EXPORT_SYMBOL(sec_input_notify);

/*
 * sec_input_self_request_notify
 * @nb: pointer of blocking notifier chain structure
 *
 * only test
 */
int sec_input_self_request_notify(struct notifier_block *nb)
{
	return nb->notifier_call(nb, 0, NULL);
}
EXPORT_SYMBOL(sec_input_self_request_notify);

MODULE_DESCRIPTION("Samsung input notifier");
MODULE_LICENSE("GPL");