aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/uwb/pal.c
diff options
context:
space:
mode:
authorInaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>2008-09-17 11:34:06 -0400
committerDavid Vrabel <dv02@dv02pc01.europe.root.pri>2008-09-17 11:54:23 -0400
commit183b9b592a622a7719ee38e275fd7ff3aaf74d0d (patch)
tree53bf5c09cd8e3ba85b4b8711ac69ff02141c8727 /drivers/uwb/pal.c
parent34e95e41f1fd751e33a7eb3fa66594903b81f13d (diff)
uwb: add the UWB stack (core files)
UWB device and radio controller device and event management. Signed-off-by: David Vrabel <david.vrabel@csr.com>
Diffstat (limited to 'drivers/uwb/pal.c')
-rw-r--r--drivers/uwb/pal.c71
1 files changed, 71 insertions, 0 deletions
diff --git a/drivers/uwb/pal.c b/drivers/uwb/pal.c
new file mode 100644
index 000000000000..5508993a820e
--- /dev/null
+++ b/drivers/uwb/pal.c
@@ -0,0 +1,71 @@
1/*
2 * UWB PAL support.
3 *
4 * Copyright (C) 2008 Cambridge Silicon Radio Ltd.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License version
8 * 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18#include <linux/kernel.h>
19#include <linux/uwb.h>
20
21#include "uwb-internal.h"
22
23/**
24 * uwb_pal_init - initialize a UWB PAL
25 * @pal: the PAL to initialize
26 */
27void uwb_pal_init(struct uwb_pal *pal)
28{
29 INIT_LIST_HEAD(&pal->node);
30}
31EXPORT_SYMBOL_GPL(uwb_pal_init);
32
33/**
34 * uwb_pal_register - register a UWB PAL
35 * @rc: the radio controller the PAL will be using
36 * @pal: the PAL
37 *
38 * The PAL must be initialized with uwb_pal_init().
39 */
40int uwb_pal_register(struct uwb_rc *rc, struct uwb_pal *pal)
41{
42 spin_lock(&rc->pal_lock);
43 list_add(&pal->node, &rc->pals);
44 spin_unlock(&rc->pal_lock);
45
46 return 0;
47}
48EXPORT_SYMBOL_GPL(uwb_pal_register);
49
50/**
51 * uwb_pal_register - unregister a UWB PAL
52 * @rc: the radio controller the PAL was using
53 * @pal: the PAL
54 */
55void uwb_pal_unregister(struct uwb_rc *rc, struct uwb_pal *pal)
56{
57 spin_lock(&rc->pal_lock);
58 list_del(&pal->node);
59 spin_unlock(&rc->pal_lock);
60}
61EXPORT_SYMBOL_GPL(uwb_pal_unregister);
62
63/**
64 * uwb_rc_pal_init - initialize the PAL related parts of a radio controller
65 * @rc: the radio controller
66 */
67void uwb_rc_pal_init(struct uwb_rc *rc)
68{
69 spin_lock_init(&rc->pal_lock);
70 INIT_LIST_HEAD(&rc->pals);
71}