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

Author: Philippe Gerum <r...@xenomai.org>
Date:   Thu Sep 18 18:53:17 2014 +0200

cobalt/rtdm: remove legacy /proc device entries

As device information is now exported via sysfs, we don't need procfs
support anymore.

---

 include/cobalt/kernel/rtdm/driver.h |    5 ---
 kernel/cobalt/rtdm/device.c         |   21 ---------
 kernel/cobalt/rtdm/internal.h       |    6 ---
 kernel/cobalt/rtdm/proc.c           |   83 -----------------------------------
 4 files changed, 115 deletions(-)

diff --git a/include/cobalt/kernel/rtdm/driver.h 
b/include/cobalt/kernel/rtdm/driver.h
index 2896e3d..765f557 100644
--- a/include/cobalt/kernel/rtdm/driver.h
+++ b/include/cobalt/kernel/rtdm/driver.h
@@ -35,7 +35,6 @@
 #include <cobalt/kernel/intr.h>
 #include <cobalt/kernel/synch.h>
 #include <cobalt/kernel/select.h>
-#include <cobalt/kernel/vfile.h>
 #include <cobalt/kernel/clock.h>
 #include <cobalt/kernel/apc.h>
 #include <cobalt/kernel/init.h>
@@ -349,10 +348,6 @@ struct rtdm_device {
                atomic_t refcount;
                struct rtdm_dev_context *exclusive_context;
                struct rtdm_fd_ops ops;
-#ifdef CONFIG_XENO_OPT_VFILE
-               struct xnvfile_directory vfroot;
-               struct xnvfile_regular info_vfile;
-#endif
        };
 };
 
diff --git a/kernel/cobalt/rtdm/device.c b/kernel/cobalt/rtdm/device.c
index 131c9f1..5b87b8c 100644
--- a/kernel/cobalt/rtdm/device.c
+++ b/kernel/cobalt/rtdm/device.c
@@ -283,13 +283,9 @@ static void unregister_device_class(struct 
rtdm_device_class *class)
  * - -EEXIST is returned if the specified device name of protocol ID is
  * already in use.
  *
- * - -EAGAIN is returned if some /proc entry cannot be created.
- *
  * - -ENOMEM is returned if a memory allocation failed in the process
  * of registering the device.
  *
- * - -EAGAIN is returned if some /proc entry cannot be created.
- *
  * @coretags{secondary-only}
  */
 int rtdm_dev_register(struct rtdm_device *device)
@@ -368,11 +364,6 @@ int rtdm_dev_register(struct rtdm_device *device)
                xnlock_get_irqsave(&rt_dev_lock, s);
                list_add_tail(&device->named.entry, &rtdm_named_devices);
                xnlock_put_irqrestore(&rt_dev_lock, s);
-
-               ret = rtdm_proc_register_device(device);
-               if (ret)
-                       goto fail_proc;
-
        } else {
                device->name = kstrdup(device->label, GFP_KERNEL);
                if (device->name == NULL) {
@@ -394,14 +385,6 @@ int rtdm_dev_register(struct rtdm_device *device)
                xnlock_put_irqrestore(&rt_dev_lock, s);
                if (ret < 0)
                        goto fail;
-
-               ret = rtdm_proc_register_device(device);
-               if (ret) {
-                       xnlock_get_irqsave(&rt_dev_lock, s);
-                       xnid_remove(&rtdm_protocol_devices, &device->proto.id);
-                       xnlock_put_irqrestore(&rt_dev_lock, s);
-                       goto fail;
-               }
        }
 
        device->rdev = rdev;
@@ -412,8 +395,6 @@ int rtdm_dev_register(struct rtdm_device *device)
        trace_cobalt_device_register(device);
 
        return 0;
-fail_proc:
-       xnregistry_remove(device->named.handle);
 fail:
        if (kdev)
                device_destroy(class->kclass, rdev);
@@ -487,8 +468,6 @@ int rtdm_dev_unregister(struct rtdm_device *device, 
unsigned int poll_delay)
 
        xnlock_put_irqrestore(&rt_dev_lock, s);
 
-       rtdm_proc_unregister_device(device);
-
        if (handle)
                xnregistry_remove(handle);
 
diff --git a/kernel/cobalt/rtdm/internal.h b/kernel/cobalt/rtdm/internal.h
index 06c78a6..fa728ed 100644
--- a/kernel/cobalt/rtdm/internal.h
+++ b/kernel/cobalt/rtdm/internal.h
@@ -53,15 +53,9 @@ void rtdm_dev_cleanup(void);
 #ifdef CONFIG_XENO_OPT_VFILE
 int rtdm_proc_init(void);
 void rtdm_proc_cleanup(void);
-int rtdm_proc_register_device(struct rtdm_device *device);
-void rtdm_proc_unregister_device(struct rtdm_device *device);
 #else
 static inline int rtdm_proc_init(void) { return 0; }
 static void inline rtdm_proc_cleanup(void) { }
-static inline int
-rtdm_proc_register_device(struct rtdm_device *device) { return 0; }
-static inline void
-rtdm_proc_unregister_device(struct rtdm_device *device) { }
 #endif
 
 void __rt_dev_close(struct rtdm_fd *fd);
diff --git a/kernel/cobalt/rtdm/proc.c b/kernel/cobalt/rtdm/proc.c
index dbc582f..87b279b 100644
--- a/kernel/cobalt/rtdm/proc.c
+++ b/kernel/cobalt/rtdm/proc.c
@@ -249,89 +249,6 @@ static struct xnvfile_regular allfd_vfile = {
        .ops = &allfd_vfile_ops,
 };
 
-static int devinfo_vfile_show(struct xnvfile_regular_iterator *it, void *data)
-{
-       struct rtdm_device_class *class;
-       struct rtdm_device *device;
-
-       if (down_interruptible(&nrt_dev_lock))
-               return -ERESTARTSYS;
-
-       /*
-        * As the device may have disappeared while the handler was called,
-        * first match the pointer against registered devices.
-        */
-       list_for_each_entry(device, &rtdm_named_devices, named.entry)
-               if (device == xnvfile_priv(it->vfile))
-                       goto found;
-
-       xntree_for_each_entry(device, &rtdm_protocol_devices, proto.id)
-               if (device == xnvfile_priv(it->vfile))
-                       goto found;
-
-       up(&nrt_dev_lock);
-       return -ENODEV;
-
-found:
-       class = device->class;
-
-       xnvfile_printf(it, "class:\t\t%d\nsub-class:\t%d\n",
-                      class->profile_info.class_id,
-                      class->profile_info.subclass_id);
-
-       xnvfile_printf(it, "flags:\t\t%s%s%s\n",
-                      (class->device_flags & RTDM_EXCLUSIVE) ?
-                      "EXCLUSIVE  " : "",
-                      (class->device_flags & RTDM_NAMED_DEVICE) ?
-                      "NAMED_DEVICE  " : "",
-                      (class->device_flags & RTDM_PROTOCOL_DEVICE) ?
-                      "PROTOCOL_DEVICE  " : "");
-
-       xnvfile_printf(it, "lock count:\t%d\n",
-                      atomic_read(&device->refcount));
-
-       up(&nrt_dev_lock);
-       return 0;
-}
-
-static struct xnvfile_regular_ops devinfo_vfile_ops = {
-       .show = devinfo_vfile_show,
-};
-
-int rtdm_proc_register_device(struct rtdm_device *device)
-{
-       int ret;
-
-       ret = xnvfile_init_dir(device->name,
-                              &device->vfroot, &rtdm_vfroot);
-       if (ret)
-               goto err_out;
-
-       memset(&device->info_vfile, 0, sizeof(device->info_vfile));
-       device->info_vfile.ops = &devinfo_vfile_ops;
-
-       ret = xnvfile_init_regular("information", &device->info_vfile,
-                                  &device->vfroot);
-       if (ret) {
-               xnvfile_destroy_dir(&device->vfroot);
-               goto err_out;
-       }
-
-       xnvfile_priv(&device->info_vfile) = device;
-
-       return 0;
-
-      err_out:
-       printk(XENO_ERR "error while creating RTDM device vfile\n");
-       return ret;
-}
-
-void rtdm_proc_unregister_device(struct rtdm_device *device)
-{
-       xnvfile_destroy_regular(&device->info_vfile);
-       xnvfile_destroy_dir(&device->vfroot);
-}
-
 int __init rtdm_proc_init(void)
 {
        int ret;


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

Reply via email to