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

Author: Philippe Gerum <r...@xenomai.org>
Date:   Thu Aug 14 10:34:52 2014 +0200

cobalt/rtdm, drivers: move .open, .socket handlers to fd_ops

With the recent introduction of a generic file operation descriptor
which drops the legacy rt/nrt forms of these handlers, there is no
reason to keep them floating alone in the rtdm_device definition.

This patch moves the .open and .socket handlers into the rtdm_fd_ops
descriptor with other I/O handlers, fixing up the in-tree drivers
accordingly.

---

 include/cobalt/kernel/rtdm/driver.h     |   22 ++---------
 include/cobalt/kernel/rtdm/fd.h         |   37 +++++++++++-------
 kernel/cobalt/rtdm/core.c               |    4 +-
 kernel/cobalt/rtdm/device.c             |   42 ++++++++++----------
 kernel/drivers/analogy/rtdm_interface.c |    9 +----
 kernel/drivers/autotune/autotune.c      |    2 +-
 kernel/drivers/can/rtcan_raw.c          |   64 +++++++++++--------------------
 kernel/drivers/ipc/rtipc.c              |    2 +-
 kernel/drivers/serial/16550A.c          |    9 +----
 kernel/drivers/serial/mpc52xx_uart.c    |    9 +----
 kernel/drivers/serial/rt_imx_uart.c     |    6 +--
 kernel/drivers/testing/rtdmtest.c       |    7 +---
 kernel/drivers/testing/switchtest.c     |    7 +---
 kernel/drivers/testing/timerbench.c     |    7 +---
 kernel/drivers/udd/udd.c                |    4 +-
 15 files changed, 86 insertions(+), 145 deletions(-)

diff --git a/include/cobalt/kernel/rtdm/driver.h 
b/include/cobalt/kernel/rtdm/driver.h
index 14f96f3..14c951b 100644
--- a/include/cobalt/kernel/rtdm/driver.h
+++ b/include/cobalt/kernel/rtdm/driver.h
@@ -305,40 +305,28 @@ struct rtdm_dev_reserved {
 /**
  * @brief RTDM device
  *
- * This structure specifies a RTDM device. As some fields, especially the
- * reserved area, will be modified by RTDM during runtime, the structure must
- * not reside in write-protected memory.
+ * This structure specifies a RTDM device. As some fields, especially
+ * the reserved area, will be modified by RTDM during runtime, the
+ * structure must not reside in write-protected memory.
  */
 struct rtdm_device {
        /** Data stored by RTDM inside a registered device (internal use only) 
*/
        struct rtdm_dev_reserved reserved;
-
        /** Revision number of this structure, see
         *  @ref drv_versioning "Driver Versioning" defines */
        int struct_version;
-
        /** Device flags, see @ref dev_flags "Device Flags" for details */
        int device_flags;
        /** Size of driver defined appendix to struct rtdm_dev_context */
        size_t context_size;
-
        /** Named device identification (orthogonal to Linux device name space) 
*/
        char device_name[RTDM_MAX_DEVNAME_LEN + 1];
-
        /** Protocol device identification: protocol family (PF_xxx) */
        int protocol_family;
        /** Protocol device identification: socket type (SOCK_xxx) */
        int socket_type;
-
-       /** Named device instance creation for real-time contexts. */
-       rtdm_open_handler_t open;
-
-       /** Protocol socket creation for real-time contexts. */
-       rtdm_socket_handler_t socket;
-
-       /** Default operations on newly opened device instance */
+       /** I/O operation handlers */
        struct rtdm_fd_ops ops;
-
        /** Device class ID, see @ref RTDM_CLASS_xxx */
        int device_class;
        /** Device sub-class, see RTDM_SUBCLASS_xxx definition in the
@@ -355,7 +343,6 @@ struct rtdm_device {
        const char *peripheral_name;
        /** Informational driver provider name (reported via /proc) */
        const char *provider_name;
-
        /** Name of /proc entry for the device, must not be NULL */
        const char *proc_name;
 #ifdef CONFIG_XENO_OPT_VFILE
@@ -363,7 +350,6 @@ struct rtdm_device {
        struct xnvfile_directory vfroot;
        struct xnvfile_regular info_vfile;
 #endif
-
        /** Driver definable device ID */
        int device_id;
        /** Driver definable device data */
diff --git a/include/cobalt/kernel/rtdm/fd.h b/include/cobalt/kernel/rtdm/fd.h
index d395546..fe72b68 100644
--- a/include/cobalt/kernel/rtdm/fd.h
+++ b/include/cobalt/kernel/rtdm/fd.h
@@ -116,21 +116,32 @@ typedef ssize_t rtdm_fd_recvmsg_t(struct rtdm_fd *fd, 
struct msghdr *msg, int fl
 typedef ssize_t rtdm_fd_sendmsg_t(struct rtdm_fd *fd, const struct msghdr 
*msg, int flags);
 
 struct rtdm_fd_ops {
-       rtdm_fd_ioctl_t *ioctl_rt;
-       rtdm_fd_ioctl_t *ioctl_nrt;
-       rtdm_fd_read_t *read_rt;
-       rtdm_fd_read_t *read_nrt;
-       rtdm_fd_write_t *write_rt;
-       rtdm_fd_write_t *write_nrt;
-       rtdm_fd_recvmsg_t *recvmsg_rt;
-       rtdm_fd_recvmsg_t *recvmsg_nrt;
-       rtdm_fd_sendmsg_t *sendmsg_rt;
-       rtdm_fd_sendmsg_t *sendmsg_nrt;
+       int (*open)(struct rtdm_fd *fd, int oflag);
+       int (*socket)(struct rtdm_fd *fd, int protocol);
+       void (*close)(struct rtdm_fd *fd);
+       int (*ioctl_rt)(struct rtdm_fd *fd,
+                       unsigned int request, void __user *arg);
+       int (*ioctl_nrt)(struct rtdm_fd *fd,
+                        unsigned int request, void __user *arg);
+       ssize_t (*read_rt)(struct rtdm_fd *fd,
+                          void __user *buf, size_t size);
+       ssize_t (*read_nrt)(struct rtdm_fd *fd,
+                           void __user *buf, size_t size);
+       ssize_t (*write_rt)(struct rtdm_fd *fd,
+                           const void __user *buf, size_t size);
+       ssize_t (*write_nrt)(struct rtdm_fd *fd,
+                            const void __user *buf, size_t size);
+       ssize_t (*recvmsg_rt)(struct rtdm_fd *fd,
+                             struct msghdr *msg, int flags);
+       ssize_t (*recvmsg_nrt)(struct rtdm_fd *fd,
+                              struct msghdr *msg, int flags);
+       ssize_t (*sendmsg_rt)(struct rtdm_fd *fd,
+                             const struct msghdr *msg, int flags);
+       ssize_t (*sendmsg_nrt)(struct rtdm_fd *fd,
+                              const struct msghdr *msg, int flags);
        int (*select_bind)(struct rtdm_fd *fd,
                           struct xnselector *selector,
-                          unsigned int type,
-                          unsigned int index);
-       void (*close)(struct rtdm_fd *fd);
+                          unsigned int type, unsigned int index);
        int (*mmap)(struct rtdm_fd *fd,
                    struct vm_area_struct *vma);
 };
diff --git a/kernel/cobalt/rtdm/core.c b/kernel/cobalt/rtdm/core.c
index 0503dfe..a89945c 100644
--- a/kernel/cobalt/rtdm/core.c
+++ b/kernel/cobalt/rtdm/core.c
@@ -158,7 +158,7 @@ int __rt_dev_open(struct xnsys_ppd *p, int ufd, const char 
*path, int oflag)
 
        trace_cobalt_fd_open(current, &context->fd, ufd, oflag);
 
-       ret = device->open(&context->fd, oflag);
+       ret = device->ops.open(&context->fd, oflag);
 
        if (!XENO_ASSERT(RTDM, !spltest()))
                splnone();
@@ -197,7 +197,7 @@ int __rt_dev_socket(struct xnsys_ppd *p, int ufd, int 
protocol_family,
 
        trace_cobalt_fd_socket(current, &context->fd, ufd, protocol_family);
 
-       ret = device->socket(&context->fd, protocol);
+       ret = device->ops.socket(&context->fd, protocol);
 
        if (!XENO_ASSERT(RTDM, !spltest()))
                splnone();
diff --git a/kernel/cobalt/rtdm/device.c b/kernel/cobalt/rtdm/device.c
index 8c2bf40..8404f71 100644
--- a/kernel/cobalt/rtdm/device.c
+++ b/kernel/cobalt/rtdm/device.c
@@ -34,17 +34,17 @@
 #define RTDM_DEVICE_MAGIC      0x82846877
 
 #define SET_DEFAULT_DUAL_OP_IF_NULL(device, operation, handler)                
\
-       if ((device).operation##_rt == NULL)                            \
-               (device).operation##_rt =                               \
-               (__typeof__((device).operation##_rt))handler;           \
-       if ((device).operation##_nrt == NULL)                           \
-               (device).operation##_nrt =                              \
-               (__typeof__((device).operation##_nrt))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).operation == NULL)                                 \
-               (device).operation =                                    \
-               (__typeof__((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;
@@ -209,27 +209,27 @@ int rtdm_dev_register(struct rtdm_device *device)
        switch (device->device_flags & RTDM_DEVICE_TYPE_MASK) {
        case RTDM_NAMED_DEVICE:
                /* Sanity check: any open handler? */
-               if (device->open == NULL) {
+               if (device->ops.open == NULL) {
                        printk(XENO_ERR "missing open handler for RTDM 
device\n");
                        return -EINVAL;
                }
-               device->socket = (typeof(device->socket))enosys;
+               device->ops.socket = (typeof(device->ops.socket))enosys;
                break;
 
        case RTDM_PROTOCOL_DEVICE:
                /* Sanity check: any socket handler? */
-               if (device->socket == NULL) {
+               if (device->ops.socket == NULL) {
                        printk(XENO_ERR "missing socket handler for RTDM 
device\n");
                        return -EINVAL;
                }
-               device->open = (typeof(device->open))enosys;
+               device->ops.open = (typeof(device->ops.open))enosys;
                break;
 
        default:
                return -EINVAL;
        }
 
-       /* Sanity check: non-RT close handler?
+       /* Sanity check: driver-defined close handler?
         * (Always required for forced cleanup) */
        if (device->ops.close == NULL) {
                printk(XENO_ERR "missing close handler for RTDM device\n");
@@ -238,13 +238,13 @@ 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->ops, ioctl, enosys);
-       SET_DEFAULT_DUAL_OP_IF_NULL(device->ops, read, enosys);
-       SET_DEFAULT_DUAL_OP_IF_NULL(device->ops, write, enosys);
-       SET_DEFAULT_DUAL_OP_IF_NULL(device->ops, recvmsg, enosys);
-       SET_DEFAULT_DUAL_OP_IF_NULL(device->ops, sendmsg, enosys);
-       SET_DEFAULT_OP_IF_NULL(device->ops, select_bind, ebadf);
-       SET_DEFAULT_OP_IF_NULL(device->ops, mmap, enodev);
+       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/drivers/analogy/rtdm_interface.c 
b/kernel/drivers/analogy/rtdm_interface.c
index c35959c..b32362f 100644
--- a/kernel/drivers/analogy/rtdm_interface.c
+++ b/kernel/drivers/analogy/rtdm_interface.c
@@ -219,22 +219,17 @@ static struct rtdm_device rtdm_devs[A4L_NB_DEVICES] =
                .device_flags =         RTDM_NAMED_DEVICE,
                .context_size =         sizeof(struct a4l_device_context),
                .device_name =          "",
-
-               .open =                 a4l_open,
-
                .ops = {
+                       .open =         a4l_open,
+                       .close =        a4l_close,
                        .ioctl_rt =     a4l_ioctl,
                        .read_rt =      a4l_read,
                        .write_rt =     a4l_write,
-
-                       .close =        a4l_close,
                        .ioctl_nrt =    a4l_ioctl,
                        .read_nrt =     a4l_read,
                        .write_nrt =    a4l_write,
-
                        .select_bind =  a4l_rt_select,
                },
-
                .device_class =         RTDM_CLASS_EXPERIMENTAL,
                .device_sub_class =     RTDM_SUBCLASS_ANALOGY,
                .driver_name =          "rtdm_analogy",
diff --git a/kernel/drivers/autotune/autotune.c 
b/kernel/drivers/autotune/autotune.c
index e250527..13741d1 100644
--- a/kernel/drivers/autotune/autotune.c
+++ b/kernel/drivers/autotune/autotune.c
@@ -630,8 +630,8 @@ static struct rtdm_device device = {
        .struct_version         =       RTDM_DEVICE_STRUCT_VER,
        .device_flags           =       RTDM_NAMED_DEVICE|RTDM_EXCLUSIVE,
        .context_size           =       sizeof(struct autotune_context),
-       .open                   =       autotune_open,
        .ops = {
+               .open           =       autotune_open,
                .ioctl_rt       =       autotune_ioctl_rt,
                .ioctl_nrt      =       autotune_ioctl_nrt,
                .close          =       autotune_close,
diff --git a/kernel/drivers/can/rtcan_raw.c b/kernel/drivers/can/rtcan_raw.c
index 3864d0f..e658ea3 100644
--- a/kernel/drivers/can/rtcan_raw.c
+++ b/kernel/drivers/can/rtcan_raw.c
@@ -977,47 +977,29 @@ ssize_t rtcan_raw_sendmsg(struct rtdm_fd *fd,
 
 
 static struct rtdm_device rtcan_proto_raw_dev = {
-    struct_version:     RTDM_DEVICE_STRUCT_VER,
-
-    device_flags:       RTDM_PROTOCOL_DEVICE,
-    context_size:       sizeof(struct rtcan_socket),
-
-    protocol_family:    PF_CAN,
-    socket_type:        SOCK_RAW,
-
-    socket:            rtcan_raw_socket,
-
-    ops: {
-       close:          rtcan_raw_close,
-
-       ioctl_rt:       rtcan_raw_ioctl,
-       ioctl_nrt:      rtcan_raw_ioctl,
-
-       read_rt:        NULL,
-       read_nrt:       NULL,
-
-       write_rt:       NULL,
-       write_nrt:      NULL,
-
-       recvmsg_rt:     rtcan_raw_recvmsg,
-       recvmsg_nrt:    NULL,
-
-       sendmsg_rt:     rtcan_raw_sendmsg,
-       sendmsg_nrt:    NULL,
-    },
-
-    device_class:       RTDM_CLASS_CAN,
-    device_sub_class:   RTDM_SUBCLASS_GENERIC,
-    profile_version:    RTCAN_PROFILE_VER,
-
-    driver_name:        "xeno_can",
-    driver_version:     RTDM_DRIVER_VER(RTCAN_MAJOR_VER,
-                                       RTCAN_MINOR_VER,
-                                       RTCAN_BUGFIX_VER),
-    peripheral_name:    "Real-Time CAN Raw Socket Interface",
-    provider_name:      "RT-Socket-CAN development team",
-
-    proc_name:          "rtcan"
+       .struct_version         = RTDM_DEVICE_STRUCT_VER,
+       .device_flags           = RTDM_PROTOCOL_DEVICE,
+       .context_size           = sizeof(struct rtcan_socket),
+       .protocol_family        = PF_CAN,
+       .socket_type            = SOCK_RAW,
+       .ops = {
+               .socket         = rtcan_raw_socket,
+               .close          = rtcan_raw_close,
+               .ioctl_rt       = rtcan_raw_ioctl,
+               .ioctl_nrt      = rtcan_raw_ioctl,
+               .recvmsg_rt     = rtcan_raw_recvmsg,
+               .sendmsg_rt     = rtcan_raw_sendmsg,
+       },
+       .device_class           = RTDM_CLASS_CAN,
+       .device_sub_class       = RTDM_SUBCLASS_GENERIC,
+       .profile_version        = RTCAN_PROFILE_VER,
+       .driver_name            = "rtcan",
+       .driver_version         = RTDM_DRIVER_VER(RTCAN_MAJOR_VER,
+                                                 RTCAN_MINOR_VER,
+                                                 RTCAN_BUGFIX_VER),
+       .peripheral_name        = "Real-Time CAN Raw Socket Interface",
+       .provider_name          = "RT-Socket-CAN development team",
+       .proc_name              = "rtcan"
 };
 
 
diff --git a/kernel/drivers/ipc/rtipc.c b/kernel/drivers/ipc/rtipc.c
index fb2aada..bd273ed 100644
--- a/kernel/drivers/ipc/rtipc.c
+++ b/kernel/drivers/ipc/rtipc.c
@@ -259,8 +259,8 @@ static struct rtdm_device device = {
        .device_name    =       "rtipc",
        .protocol_family=       PF_RTIPC,
        .socket_type    =       SOCK_DGRAM,
-       .socket         =       rtipc_socket,
        .ops = {
+               .socket         =       rtipc_socket,
                .close          =       rtipc_close,
                .recvmsg_rt     =       rtipc_recvmsg,
                .recvmsg_nrt    =       NULL,
diff --git a/kernel/drivers/serial/16550A.c b/kernel/drivers/serial/16550A.c
index 0076b94..7b869f2 100644
--- a/kernel/drivers/serial/16550A.c
+++ b/kernel/drivers/serial/16550A.c
@@ -1070,24 +1070,17 @@ ssize_t rt_16550_write(struct rtdm_fd *fd, const void 
*buf, size_t nbyte)
 
 static const struct rtdm_device __initdata device_tmpl = {
        .struct_version         = RTDM_DEVICE_STRUCT_VER,
-
        .device_flags           = RTDM_NAMED_DEVICE | RTDM_EXCLUSIVE,
        .context_size           = sizeof(struct rt_16550_context),
        .device_name            = "",
-
-       .open                   = rt_16550_open,
-
        .ops = {
+               .open           = rt_16550_open,
                .close          = rt_16550_close,
-
                .ioctl_rt       = rt_16550_ioctl,
                .ioctl_nrt      = rt_16550_ioctl,
-
                .read_rt        = rt_16550_read,
-
                .write_rt       = rt_16550_write,
        },
-
        .device_class           = RTDM_CLASS_SERIAL,
        .device_sub_class       = RTDM_SUBCLASS_16550A,
        .profile_version        = RTSER_PROFILE_VER,
diff --git a/kernel/drivers/serial/mpc52xx_uart.c 
b/kernel/drivers/serial/mpc52xx_uart.c
index 982d728..b960a7f 100644
--- a/kernel/drivers/serial/mpc52xx_uart.c
+++ b/kernel/drivers/serial/mpc52xx_uart.c
@@ -1234,24 +1234,17 @@ static ssize_t rt_mpc52xx_uart_write(struct rtdm_fd *fd,
 
 static const struct rtdm_device device_tmpl = {
        .struct_version         = RTDM_DEVICE_STRUCT_VER,
-
        .device_flags           = RTDM_NAMED_DEVICE | RTDM_EXCLUSIVE,
        .context_size           = sizeof(struct rt_mpc52xx_uart_ctx),
        .device_name            = "",
-
-       .open                   = rt_mpc52xx_uart_open,
-
        .ops = {
+               .open           = rt_mpc52xx_uart_open,
                .close          = rt_mpc52xx_uart_close,
-
                .ioctl_rt       = rt_mpc52xx_uart_ioctl,
                .ioctl_nrt      = rt_mpc52xx_uart_ioctl,
-
                .read_rt        = rt_mpc52xx_uart_read,
-
                .write_rt       = rt_mpc52xx_uart_write,
        },
-
        .device_class           = RTDM_CLASS_SERIAL,
        .device_sub_class       = RTDM_SUBCLASS_16550A,
        .profile_version        = RTSER_PROFILE_VER,
diff --git a/kernel/drivers/serial/rt_imx_uart.c 
b/kernel/drivers/serial/rt_imx_uart.c
index 2f9a8f1..1d547a9 100644
--- a/kernel/drivers/serial/rt_imx_uart.c
+++ b/kernel/drivers/serial/rt_imx_uart.c
@@ -1365,21 +1365,17 @@ static ssize_t rt_imx_uart_write(struct rtdm_fd *fd, 
const void *buf,
 
 static const struct rtdm_device __initdata device_tmpl = {
        .struct_version         = RTDM_DEVICE_STRUCT_VER,
-
        .device_flags           = RTDM_NAMED_DEVICE | RTDM_EXCLUSIVE,
        .context_size           = sizeof(struct rt_imx_uart_ctx),
        .device_name            = "",
-
-       .open                   = rt_imx_uart_open,
-
        .ops = {
+               .open           = rt_imx_uart_open,
                .close          = rt_imx_uart_close,
                .ioctl_rt       = rt_imx_uart_ioctl,
                .ioctl_nrt      = rt_imx_uart_ioctl,
                .read_rt        = rt_imx_uart_read,
                .write_rt       = rt_imx_uart_write,
        },
-
        .device_class           = RTDM_CLASS_SERIAL,
        .device_sub_class       = RTDM_SUBCLASS_16550A,
        .profile_version        = RTSER_PROFILE_VER,
diff --git a/kernel/drivers/testing/rtdmtest.c 
b/kernel/drivers/testing/rtdmtest.c
index d829fea..849a0eb 100644
--- a/kernel/drivers/testing/rtdmtest.c
+++ b/kernel/drivers/testing/rtdmtest.c
@@ -107,20 +107,15 @@ rtdm_test_ioctl(struct rtdm_fd *fd, unsigned int request, 
void __user *arg)
 
 static struct rtdm_device device[2] = { [0 ... 1] = {
        .struct_version         = RTDM_DEVICE_STRUCT_VER,
-
        .device_flags           = RTDM_NAMED_DEVICE | RTDM_EXCLUSIVE,
        .context_size           = sizeof(struct rtdm_test_context),
        .device_name            = "",
-
-       .open                   = rtdm_test_open,
-
        .ops = {
+               .open           = rtdm_test_open,
                .close          = rtdm_test_close,
-
                .ioctl_rt       = rtdm_test_ioctl,
                .ioctl_nrt      = rtdm_test_ioctl,
        },
-
        .device_class           = RTDM_CLASS_TESTING,
        .device_sub_class       = RTDM_SUBCLASS_RTDMTEST,
        .profile_version        = RTTST_PROFILE_VER,
diff --git a/kernel/drivers/testing/switchtest.c 
b/kernel/drivers/testing/switchtest.c
index 535a447..c66dca5 100644
--- a/kernel/drivers/testing/switchtest.c
+++ b/kernel/drivers/testing/switchtest.c
@@ -722,20 +722,15 @@ static int rtswitch_ioctl_rt(struct rtdm_fd *fd,
 
 static struct rtdm_device device = {
        .struct_version = RTDM_DEVICE_STRUCT_VER,
-
        .device_flags = RTDM_NAMED_DEVICE,
        .context_size = sizeof(struct rtswitch_context),
        .device_name = "",
-
-       .open = rtswitch_open,
-
        .ops = {
+               .open = rtswitch_open,
                .close = rtswitch_close,
-
                .ioctl_rt = rtswitch_ioctl_rt,
                .ioctl_nrt = rtswitch_ioctl_nrt,
        },
-
        .device_class = RTDM_CLASS_TESTING,
        .device_sub_class = RTDM_SUBCLASS_SWITCHTEST,
        .profile_version = RTTST_PROFILE_VER,
diff --git a/kernel/drivers/testing/timerbench.c 
b/kernel/drivers/testing/timerbench.c
index 9d35eac..e244104 100644
--- a/kernel/drivers/testing/timerbench.c
+++ b/kernel/drivers/testing/timerbench.c
@@ -455,20 +455,15 @@ static int rt_tmbench_ioctl_rt(struct rtdm_fd *fd,
 
 static struct rtdm_device device = {
        .struct_version         = RTDM_DEVICE_STRUCT_VER,
-
        .device_flags           = RTDM_NAMED_DEVICE,
        .context_size           = sizeof(struct rt_tmbench_context),
        .device_name            = "",
-
-       .open                   = rt_tmbench_open,
-
        .ops = {
+               .open           = rt_tmbench_open,
                .close          = rt_tmbench_close,
-
                .ioctl_rt       = rt_tmbench_ioctl_rt,
                .ioctl_nrt      = rt_tmbench_ioctl_nrt,
        },
-
        .device_class           = RTDM_CLASS_TESTING,
        .device_sub_class       = RTDM_SUBCLASS_TIMERBENCH,
        .profile_version        = RTTST_PROFILE_VER,
diff --git a/kernel/drivers/udd/udd.c b/kernel/drivers/udd/udd.c
index 95a0a1b..b652016 100644
--- a/kernel/drivers/udd/udd.c
+++ b/kernel/drivers/udd/udd.c
@@ -302,8 +302,8 @@ static inline int register_mapper(struct udd_device *udd)
        dev->struct_version = RTDM_DEVICE_STRUCT_VER;
        dev->device_flags = RTDM_NAMED_DEVICE;
        dev->context_size = 0;
-       dev->open = mapper_open;
        dev->ops = (struct rtdm_fd_ops){
+               .open = mapper_open,
                .close = mapper_close,
                .mmap = mapper_mmap,
        };
@@ -341,8 +341,8 @@ int udd_register_device(struct udd_device *udd)
        dev->struct_version = RTDM_DEVICE_STRUCT_VER;
        dev->device_flags = RTDM_NAMED_DEVICE;
        dev->context_size = sizeof(struct udd_context);
-       dev->open = udd_open;
        dev->ops = (struct rtdm_fd_ops){
+               .open = udd_open,
                .ioctl_rt = udd_ioctl_rt,
                .read_rt = udd_read_rt,
                .write_rt = udd_write_rt,


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

Reply via email to