Root/
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/debugfs.h> |
20 | #include <linux/uwb.h> |
21 | #include <linux/export.h> |
22 | |
23 | #include "uwb-internal.h" |
24 | |
25 | /** |
26 | * uwb_pal_init - initialize a UWB PAL |
27 | * @pal: the PAL to initialize |
28 | */ |
29 | void uwb_pal_init(struct uwb_pal *pal) |
30 | { |
31 | INIT_LIST_HEAD(&pal->node); |
32 | } |
33 | EXPORT_SYMBOL_GPL(uwb_pal_init); |
34 | |
35 | /** |
36 | * uwb_pal_register - register a UWB PAL |
37 | * @pal: the PAL |
38 | * |
39 | * The PAL must be initialized with uwb_pal_init(). |
40 | */ |
41 | int uwb_pal_register(struct uwb_pal *pal) |
42 | { |
43 | struct uwb_rc *rc = pal->rc; |
44 | int ret; |
45 | |
46 | if (pal->device) { |
47 | ret = sysfs_create_link(&pal->device->kobj, |
48 | &rc->uwb_dev.dev.kobj, "uwb_rc"); |
49 | if (ret < 0) |
50 | return ret; |
51 | ret = sysfs_create_link(&rc->uwb_dev.dev.kobj, |
52 | &pal->device->kobj, pal->name); |
53 | if (ret < 0) { |
54 | sysfs_remove_link(&pal->device->kobj, "uwb_rc"); |
55 | return ret; |
56 | } |
57 | } |
58 | |
59 | pal->debugfs_dir = uwb_dbg_create_pal_dir(pal); |
60 | |
61 | mutex_lock(&rc->uwb_dev.mutex); |
62 | list_add(&pal->node, &rc->pals); |
63 | mutex_unlock(&rc->uwb_dev.mutex); |
64 | |
65 | return 0; |
66 | } |
67 | EXPORT_SYMBOL_GPL(uwb_pal_register); |
68 | |
69 | /** |
70 | * uwb_pal_register - unregister a UWB PAL |
71 | * @pal: the PAL |
72 | */ |
73 | void uwb_pal_unregister(struct uwb_pal *pal) |
74 | { |
75 | struct uwb_rc *rc = pal->rc; |
76 | |
77 | uwb_radio_stop(pal); |
78 | |
79 | mutex_lock(&rc->uwb_dev.mutex); |
80 | list_del(&pal->node); |
81 | mutex_unlock(&rc->uwb_dev.mutex); |
82 | |
83 | debugfs_remove(pal->debugfs_dir); |
84 | |
85 | if (pal->device) { |
86 | sysfs_remove_link(&rc->uwb_dev.dev.kobj, pal->name); |
87 | sysfs_remove_link(&pal->device->kobj, "uwb_rc"); |
88 | } |
89 | } |
90 | EXPORT_SYMBOL_GPL(uwb_pal_unregister); |
91 | |
92 | /** |
93 | * uwb_rc_pal_init - initialize the PAL related parts of a radio controller |
94 | * @rc: the radio controller |
95 | */ |
96 | void uwb_rc_pal_init(struct uwb_rc *rc) |
97 | { |
98 | INIT_LIST_HEAD(&rc->pals); |
99 | } |
100 |
Branches:
ben-wpan
ben-wpan-stefan
javiroman/ks7010
jz-2.6.34
jz-2.6.34-rc5
jz-2.6.34-rc6
jz-2.6.34-rc7
jz-2.6.35
jz-2.6.36
jz-2.6.37
jz-2.6.38
jz-2.6.39
jz-3.0
jz-3.1
jz-3.11
jz-3.12
jz-3.13
jz-3.15
jz-3.16
jz-3.18-dt
jz-3.2
jz-3.3
jz-3.4
jz-3.5
jz-3.6
jz-3.6-rc2-pwm
jz-3.9
jz-3.9-clk
jz-3.9-rc8
jz47xx
jz47xx-2.6.38
master
Tags:
od-2011-09-04
od-2011-09-18
v2.6.34-rc5
v2.6.34-rc6
v2.6.34-rc7
v3.9