summaryrefstree
path: root/kernel/drivers/misc/modem_v1/modem_notifier.c
blob: 0c2d68a5500df58a559b5c758a9c4c4ab9bd4f22 (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
/*
 * Copyright (C) 2015 Samsung Electronics.
 *
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
 * may be copied, distributed, and modified under those terms.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */

#include <stdarg.h>
#include <linux/string.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/notifier.h>
#include <linux/modem_notifier.h>

#include "modem_prj.h"
#include "modem_utils.h"

static struct raw_notifier_head modem_event_notifier;

int register_modem_event_notifier(struct notifier_block *nb)
{
	if (!nb)
		return -ENOENT;

	return raw_notifier_chain_register(&modem_event_notifier, nb);
}

void modem_notify_event(enum modem_event evt)
{
	mif_err("event notify (%d) ++\n", evt);
	raw_notifier_call_chain(&modem_event_notifier, evt, NULL);
	mif_err("event notify (%d) --\n", evt);
}