summaryrefslogtreecommitdiff
path: root/drivers/uwb/pal.c
diff options
context:
space:
mode:
authorDavid Vrabel <david.vrabel@csr.com>2008-09-17 16:34:40 +0100
committerDavid Vrabel <dv02@dv02pc01.europe.root.pri>2008-09-17 16:54:35 +0100
commitb60066c141997ac2e4ef08459b75638ae86ae781 (patch)
treee7c89b8652a0f0416d0da338c31337991bf57c93 /drivers/uwb/pal.c
parentb63795fa3a41151040b86119750a7df508d40cda (diff)
uwb: add symlinks in sysfs between radio controllers and PALs
Add a facility for PALs to have symlinks to their radio controller (and vice-versa) and make WUSB host controllers use this. Signed-off-by: David Vrabel <david.vrabel@csr.com>
Diffstat (limited to 'drivers/uwb/pal.c')
-rw-r--r--drivers/uwb/pal.c20
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);
*/
int uwb_pal_register(struct uwb_rc *rc, struct uwb_pal *pal)
{
+ int ret;
+
+ if (pal->device) {
+ ret = sysfs_create_link(&pal->device->kobj,
+ &rc->uwb_dev.dev.kobj, "uwb_rc");
+ if (ret < 0)
+ return ret;
+ ret = sysfs_create_link(&rc->uwb_dev.dev.kobj,
+ &pal->device->kobj, pal->name);
+ if (ret < 0) {
+ sysfs_remove_link(&pal->device->kobj, "uwb_rc");
+ return ret;
+ }
+ }
+
spin_lock(&rc->pal_lock);
list_add(&pal->node, &rc->pals);
spin_unlock(&rc->pal_lock);
@@ -57,6 +72,11 @@ void uwb_pal_unregister(struct uwb_rc *rc, struct uwb_pal *pal)
spin_lock(&rc->pal_lock);
list_del(&pal->node);
spin_unlock(&rc->pal_lock);
+
+ if (pal->device) {
+ sysfs_remove_link(&rc->uwb_dev.dev.kobj, pal->name);
+ sysfs_remove_link(&pal->device->kobj, "uwb_rc");
+ }
}
EXPORT_SYMBOL_GPL(uwb_pal_unregister);