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

Author: Philippe Gerum <r...@xenomai.org>
Date:   Thu Aug 14 11:30:23 2014 +0200

cobalt/rtdm: leave setting of default handlers to the fd layer

---

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

diff --git a/kernel/cobalt/rtdm/device.c b/kernel/cobalt/rtdm/device.c
index 8404f71..9c9ef5e 100644
--- a/kernel/cobalt/rtdm/device.c
+++ b/kernel/cobalt/rtdm/device.c
@@ -33,42 +33,17 @@
 
 #define RTDM_DEVICE_MAGIC      0x82846877
 
-#define SET_DEFAULT_DUAL_OP_IF_NULL(device, operation, handler)                
\
-       if ((device)->ops.operation##_rt == NULL)                       \
-               (device)->ops.operation##_rt =                          \
-               (__typeof__((device)->ops.operation##_rt))handler;      \
-       if ((device)->ops.operation##_nrt == NULL)                      \
-               (device)->ops.operation##_nrt =                         \
-               (__typeof__((device)->ops.operation##_nrt))handler;
-
-#define SET_DEFAULT_OP_IF_NULL(device, operation, handler)             \
-       if ((device)->ops.operation == NULL)                            \
-               (device)->ops.operation =                               \
-               (__typeof__((device)->ops.operation))handler;
-
 struct list_head rtdm_named_devices;   /* hash table */
 struct rb_root rtdm_protocol_devices;
 
 struct semaphore nrt_dev_lock;
 DEFINE_XNLOCK(rt_dev_lock);
 
-extern void __rt_dev_close(struct rtdm_fd *fd);
-
 static int enosys(void)
 {
        return -ENOSYS;
 }
 
-static int ebadf(void)
-{
-       return -EBADF;
-}
-
-static int enodev(void)
-{
-       return -ENODEV;
-}
-
 static inline unsigned long long get_proto_id(int pf, int type)
 {
        unsigned long long llpf = (unsigned)pf;
@@ -237,15 +212,6 @@ int rtdm_dev_register(struct rtdm_device *device)
        }
        device->reserved.close = device->ops.close;
        device->ops.close = __rt_dev_close;
-
-       SET_DEFAULT_DUAL_OP_IF_NULL(device, ioctl, enosys);
-       SET_DEFAULT_DUAL_OP_IF_NULL(device, read, enosys);
-       SET_DEFAULT_DUAL_OP_IF_NULL(device, write, enosys);
-       SET_DEFAULT_DUAL_OP_IF_NULL(device, recvmsg, enosys);
-       SET_DEFAULT_DUAL_OP_IF_NULL(device, sendmsg, enosys);
-       SET_DEFAULT_OP_IF_NULL(device, select_bind, ebadf);
-       SET_DEFAULT_OP_IF_NULL(device, mmap, enodev);
-
        atomic_set(&device->reserved.refcount, 0);
        device->reserved.exclusive_context = NULL;
 
diff --git a/kernel/cobalt/rtdm/internal.h b/kernel/cobalt/rtdm/internal.h
index cac5f52..8d98789 100644
--- a/kernel/cobalt/rtdm/internal.h
+++ b/kernel/cobalt/rtdm/internal.h
@@ -78,6 +78,8 @@ static inline void
 rtdm_proc_unregister_device(struct rtdm_device *device) { }
 #endif
 
+void __rt_dev_close(struct rtdm_fd *fd);
+
 int __rt_dev_ioctl_fallback(struct rtdm_fd *fd,
                            unsigned int request, void __user *arg);
 


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

Reply via email to