diff options
Diffstat (limited to 'drivers/uwb')
-rw-r--r-- | drivers/uwb/pal.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/uwb/pal.c b/drivers/uwb/pal.c index 5508993a820e..1afb38eacb9a 100644 --- a/drivers/uwb/pal.c +++ b/drivers/uwb/pal.c | |||
@@ -39,6 +39,21 @@ EXPORT_SYMBOL_GPL(uwb_pal_init); | |||
39 | */ | 39 | */ |
40 | int uwb_pal_register(struct uwb_rc *rc, struct uwb_pal *pal) | 40 | int uwb_pal_register(struct uwb_rc *rc, struct uwb_pal *pal) |
41 | { | 41 | { |
42 | int ret; | ||
43 | |||
44 | if (pal->device) { | ||
45 | ret = sysfs_create_link(&pal->device->kobj, | ||
46 | &rc->uwb_dev.dev.kobj, "uwb_rc"); | ||
47 | if (ret < 0) | ||
48 | return ret; | ||
49 | ret = sysfs_create_link(&rc->uwb_dev.dev.kobj, | ||
50 | &pal->device->kobj, pal->name); | ||
51 | if (ret < 0) { | ||
52 | sysfs_remove_link(&pal->device->kobj, "uwb_rc"); | ||
53 | return ret; | ||
54 | } | ||
55 | } | ||
56 | |||
42 | spin_lock(&rc->pal_lock); | 57 | spin_lock(&rc->pal_lock); |
43 | list_add(&pal->node, &rc->pals); | 58 | list_add(&pal->node, &rc->pals); |
44 | spin_unlock(&rc->pal_lock); | 59 | spin_unlock(&rc->pal_lock); |
@@ -57,6 +72,11 @@ void uwb_pal_unregister(struct uwb_rc *rc, struct uwb_pal *pal) | |||
57 | spin_lock(&rc->pal_lock); | 72 | spin_lock(&rc->pal_lock); |
58 | list_del(&pal->node); | 73 | list_del(&pal->node); |
59 | spin_unlock(&rc->pal_lock); | 74 | spin_unlock(&rc->pal_lock); |
75 | |||
76 | if (pal->device) { | ||
77 | sysfs_remove_link(&rc->uwb_dev.dev.kobj, pal->name); | ||
78 | sysfs_remove_link(&pal->device->kobj, "uwb_rc"); | ||
79 | } | ||
60 | } | 80 | } |
61 | EXPORT_SYMBOL_GPL(uwb_pal_unregister); | 81 | EXPORT_SYMBOL_GPL(uwb_pal_unregister); |
62 | 82 | ||