Module: xenomai-forge
Branch: next
Commit: 2dab013261774f075583750edcf70422a2677477
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=2dab013261774f075583750edcf70422a2677477

Author: Philippe Gerum <r...@xenomai.org>
Date:   Sat Sep 20 19:06:28 2014 +0200

cobalt/rtdm: privatize local data

---

 kernel/cobalt/rtdm/device.c   |   21 ++++++++++-----------
 kernel/cobalt/rtdm/internal.h |    6 ------
 2 files changed, 10 insertions(+), 17 deletions(-)

diff --git a/kernel/cobalt/rtdm/device.c b/kernel/cobalt/rtdm/device.c
index 951a35d..98ff9cd 100644
--- a/kernel/cobalt/rtdm/device.c
+++ b/kernel/cobalt/rtdm/device.c
@@ -47,11 +47,10 @@
 
 #define RTDM_DEVICE_MAGIC      0x82846877
 
-struct list_head rtdm_named_devices;   /* hash table */
-struct rb_root rtdm_protocol_devices;
-
-struct semaphore nrt_dev_lock;
-DEFINE_XNLOCK(rt_dev_lock);
+static struct list_head named_devices;
+static struct rb_root protocol_devices;
+static struct semaphore nrt_dev_lock;
+DEFINE_PRIVATE_XNLOCK(rt_dev_lock);
 
 static struct class *rtdm_class;
 
@@ -117,7 +116,7 @@ struct rtdm_device *__rtdm_get_protodev(int 
protocol_family, int socket_type)
 
        xnlock_get_irqsave(&rt_dev_lock, s);
 
-       xnid = xnid_fetch(&rtdm_protocol_devices, id);
+       xnid = xnid_fetch(&protocol_devices, id);
        if (xnid) {
                device = container_of(xnid, struct rtdm_device, proto.id);
                __rtdm_get_device(device);
@@ -358,7 +357,7 @@ int rtdm_dev_register(struct rtdm_device *device)
                }
 
                xnlock_get_irqsave(&rt_dev_lock, s);
-               list_add_tail(&device->named.entry, &rtdm_named_devices);
+               list_add_tail(&device->named.entry, &named_devices);
                xnlock_put_irqrestore(&rt_dev_lock, s);
        } else {
                device->name = kstrdup(device->label, GFP_KERNEL);
@@ -377,7 +376,7 @@ int rtdm_dev_register(struct rtdm_device *device)
 
                id = get_proto_id(drv->protocol_family, drv->socket_type);
                xnlock_get_irqsave(&rt_dev_lock, s);
-               ret = xnid_enter(&rtdm_protocol_devices, &device->proto.id, id);
+               ret = xnid_enter(&protocol_devices, &device->proto.id, id);
                xnlock_put_irqrestore(&rt_dev_lock, s);
                if (ret < 0)
                        goto fail;
@@ -441,7 +440,7 @@ void rtdm_dev_unregister(struct rtdm_device *device)
                handle = device->named.handle;
                list_del(&device->named.entry);
        } else
-               xnid_remove(&rtdm_protocol_devices, &device->proto.id);
+               xnid_remove(&protocol_devices, &device->proto.id);
 
        xnlock_put_irqrestore(&rt_dev_lock, s);
 
@@ -464,8 +463,8 @@ int __init rtdm_init(void)
 {
        sema_init(&nrt_dev_lock, 1);
 
-       INIT_LIST_HEAD(&rtdm_named_devices);
-       xntree_init(&rtdm_protocol_devices);
+       INIT_LIST_HEAD(&named_devices);
+       xntree_init(&protocol_devices);
 
        rtdm_class = class_create(THIS_MODULE, "rtdm");
        if (IS_ERR(rtdm_class)) {
diff --git a/kernel/cobalt/rtdm/internal.h b/kernel/cobalt/rtdm/internal.h
index 58c8f93..2d64c6a 100644
--- a/kernel/cobalt/rtdm/internal.h
+++ b/kernel/cobalt/rtdm/internal.h
@@ -29,12 +29,6 @@
 #include <cobalt/kernel/lock.h>
 #include <rtdm/driver.h>
 
-DECLARE_EXTERN_XNLOCK(rt_dev_lock);
-
-extern struct semaphore nrt_dev_lock;
-extern struct list_head rtdm_named_devices;
-extern struct rb_root rtdm_protocol_devices;
-
 static inline void __rtdm_get_device(struct rtdm_device *device)
 {
        atomic_inc(&device->refcount);


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to