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

Author: Jorge Ramirez-Ortiz <j...@xenomai.org>
Date:   Thu Aug 14 09:37:27 2014 -0400

drivers/analogy: separate strings for boards and drivers

---

 include/cobalt/kernel/rtdm/analogy/driver.h           |    6 ++++--
 include/rtdm/analogy.h                                |    2 ++
 include/rtdm/uapi/analogy.h                           |    1 +
 kernel/drivers/analogy/device.c                       |    8 +++++++-
 kernel/drivers/analogy/driver.c                       |   10 +++++-----
 kernel/drivers/analogy/intel/8255.c                   |    1 +
 kernel/drivers/analogy/intel/parport.c                |    1 +
 kernel/drivers/analogy/national_instruments/ni_660x.c |    1 +
 kernel/drivers/analogy/national_instruments/ni_670x.c |    1 +
 kernel/drivers/analogy/national_instruments/pcimio.c  |    7 ++++++-
 kernel/drivers/analogy/sensoray/s526.c                |    1 +
 kernel/drivers/analogy/testing/fake.c                 |    1 +
 lib/analogy/descriptor.c                              |    2 +-
 13 files changed, 32 insertions(+), 10 deletions(-)

diff --git a/include/cobalt/kernel/rtdm/analogy/driver.h 
b/include/cobalt/kernel/rtdm/analogy/driver.h
index 46202bc..08a7546 100644
--- a/include/cobalt/kernel/rtdm/analogy/driver.h
+++ b/include/cobalt/kernel/rtdm/analogy/driver.h
@@ -44,11 +44,13 @@ struct a4l_driver {
 
        /* Visible description stuff */
        struct module *owner;
-                         /**< Pointer to module containing the code */
+                      /**< Pointer to module containing the code */
        unsigned int flags;
-                       /**< Type / status driver's flags */
+                      /**< Type / status driver's flags */
        char *board_name;
                       /**< Board name */
+       char *driver_name;
+                      /**< driver name */
        int privdata_size;
                       /**< Size of the driver's private data */
 
diff --git a/include/rtdm/analogy.h b/include/rtdm/analogy.h
index c47824d..57f2ec0 100644
--- a/include/rtdm/analogy.h
+++ b/include/rtdm/analogy.h
@@ -59,6 +59,8 @@
 struct a4l_descriptor {
        char board_name[A4L_NAMELEN];
                                     /**< Board name. */
+       char driver_name[A4L_NAMELEN];
+                                    /**< Driver name. */
        int nb_subd;
                 /**< Subdevices count. */
        int idx_read_subd;
diff --git a/include/rtdm/uapi/analogy.h b/include/rtdm/uapi/analogy.h
index 28ce8ab..98c6154 100644
--- a/include/rtdm/uapi/analogy.h
+++ b/include/rtdm/uapi/analogy.h
@@ -94,6 +94,7 @@ typedef struct a4l_link_desc a4l_lnkdesc_t;
 /* DEVINFO ioctl argument structure */
 struct a4l_dev_info {
        char board_name[A4L_NAMELEN];
+       char driver_name[A4L_NAMELEN];
        int nb_subd;
        int idx_read_subd;
        int idx_write_subd;
diff --git a/kernel/drivers/analogy/device.c b/kernel/drivers/analogy/device.c
index 4bccc83..63104e5 100644
--- a/kernel/drivers/analogy/device.c
+++ b/kernel/drivers/analogy/device.c
@@ -79,7 +79,7 @@ int a4l_rdproc_devs(struct seq_file *p, void *data)
                        name = "No driver";
                } else if (test_bit(A4L_DEV_ATTACHED_NR, &a4l_devs[i].flags)) {
                        status = "Linked";
-                       name = a4l_devs[i].driver->board_name;
+                       name = a4l_devs[i].driver->driver_name;
                } else {
                        status = "Broken";
                        name = "Unknown";
@@ -440,6 +440,12 @@ int a4l_ioctl_devinfo(struct a4l_device_context * cxt, 
void *arg)
                    A4L_NAMELEN : strlen(dev->driver->board_name);
 
                memcpy(info.board_name, dev->driver->board_name, len);
+
+               len = (strlen(dev->driver->driver_name) > A4L_NAMELEN) ?
+                   A4L_NAMELEN : strlen(dev->driver->driver_name);
+
+               memcpy(info.driver_name, dev->driver->driver_name, len);
+
                info.nb_subd = dev->transfer.nb_subd;
                /* TODO: for API compatibility issue, find the first
                   read subdevice and write subdevice */
diff --git a/kernel/drivers/analogy/driver.c b/kernel/drivers/analogy/driver.c
index 760869c..c9ba1cc 100644
--- a/kernel/drivers/analogy/driver.c
+++ b/kernel/drivers/analogy/driver.c
@@ -58,7 +58,7 @@ int a4l_register_drv(struct a4l_driver * drv)
        if (!realtime_core_enabled())
                return 0;
 
-       __a4l_dbg(1, core_dbg, "name=%s\n", drv->board_name);
+       __a4l_dbg(1, core_dbg, "board name=%s\n", drv->board_name);
 
        if (a4l_lct_drv(drv->board_name, NULL) != 0) {
                list_add(&drv->list, &a4l_drvs);
@@ -72,7 +72,7 @@ int a4l_unregister_drv(struct a4l_driver * drv)
        if (!realtime_core_enabled())
                return 0;
 
-       __a4l_dbg(1, core_dbg, "name=%s\n", drv->board_name);
+       __a4l_dbg(1, core_dbg, "board name=%s\n", drv->board_name);
 
        if (a4l_lct_drv(drv->board_name, NULL) == 0) {
                /* Here, we consider the argument is pointing
@@ -94,12 +94,12 @@ int a4l_rdproc_drvs(struct seq_file *p, void *data)
        struct list_head *this;
 
        seq_printf(p, "--  Analogy drivers --\n\n");
-       seq_printf(p, "| idx | driver name\n");
+
+       seq_printf(p, "| idx | board name \n");
 
        list_for_each(this, &a4l_drvs) {
                struct a4l_driver *drv = list_entry(this, struct a4l_driver, 
list);
-
-               seq_printf(p, "|  %02d | %s\n", i++, drv->board_name);
+               seq_printf(p, "|  %02d | %s \n", i++, drv->board_name);
        }
        return 0;
 }
diff --git a/kernel/drivers/analogy/intel/8255.c 
b/kernel/drivers/analogy/intel/8255.c
index 9dd66f9..ad8039b 100644
--- a/kernel/drivers/analogy/intel/8255.c
+++ b/kernel/drivers/analogy/intel/8255.c
@@ -309,6 +309,7 @@ static int dev_8255_detach(struct a4l_device *dev)
 static struct a4l_driver drv_8255 = {
        .owner = THIS_MODULE,
        .board_name = "analogy_8255",
+       .driver_name = "8255",
        .attach = dev_8255_attach,
        .detach = dev_8255_detach,
        .privdata_size = 0,
diff --git a/kernel/drivers/analogy/intel/parport.c 
b/kernel/drivers/analogy/intel/parport.c
index 799b368..eb07434 100644
--- a/kernel/drivers/analogy/intel/parport.c
+++ b/kernel/drivers/analogy/intel/parport.c
@@ -434,6 +434,7 @@ static int dev_parport_detach(struct a4l_device *dev)
 static struct a4l_driver drv_parport = {
        .owner = THIS_MODULE,
        .board_name = "analogy_parport",
+       .driver_name = "parport",
        .attach = dev_parport_attach,
        .detach = dev_parport_detach,
        .privdata_size = sizeof(parport_priv_t),
diff --git a/kernel/drivers/analogy/national_instruments/ni_660x.c 
b/kernel/drivers/analogy/national_instruments/ni_660x.c
index 14b0b00..b2737ad 100644
--- a/kernel/drivers/analogy/national_instruments/ni_660x.c
+++ b/kernel/drivers/analogy/national_instruments/ni_660x.c
@@ -513,6 +513,7 @@ static void ni_660x_select_pfi_output(struct a4l_device 
*dev,
 
 static struct a4l_driver ni_660x_drv = {
        .board_name = "analogy_ni_660x",
+       .driver_name = "ni_660x",
        .owner = THIS_MODULE,
        .attach = ni_660x_attach,
        .detach = ni_660x_detach,
diff --git a/kernel/drivers/analogy/national_instruments/ni_670x.c 
b/kernel/drivers/analogy/national_instruments/ni_670x.c
index 103a635..e437ac7 100644
--- a/kernel/drivers/analogy/national_instruments/ni_670x.c
+++ b/kernel/drivers/analogy/national_instruments/ni_670x.c
@@ -236,6 +236,7 @@ static int ni_670x_detach(struct a4l_device *dev);
 static struct a4l_driver ni_670x_drv = {
        .owner = THIS_MODULE,
        .board_name = "analogy_ni_670x",
+       .driver_name = "ni_670x",
        .attach = ni_670x_attach,
        .detach = ni_670x_detach,
        .privdata_size = sizeof(struct ni_670x_private),
diff --git a/kernel/drivers/analogy/national_instruments/pcimio.c 
b/kernel/drivers/analogy/national_instruments/pcimio.c
index 7209d19..e7a2ab3 100644
--- a/kernel/drivers/analogy/national_instruments/pcimio.c
+++ b/kernel/drivers/analogy/national_instruments/pcimio.c
@@ -1469,7 +1469,7 @@ static int pcimio_attach(struct a4l_device *dev, 
a4l_lnkdesc_t *arg)
 {
        int ret, bus, slot, i, irq;
        struct mite_struct *mite = NULL;
-       struct ni_board_struct * board = NULL;
+       struct ni_board_struct *board = NULL;
 
        if(arg->opts == NULL || arg->opts_size == 0)
                bus = slot = 0;
@@ -1552,6 +1552,8 @@ static int pcimio_attach(struct a4l_device *dev, 
a4l_lnkdesc_t *arg)
        if(ret < 0)
                return ret;
 
+       dev->driver->driver_name = devpriv->board_ptr->name;
+
        return ret;
 }
 
@@ -1570,12 +1572,15 @@ static int pcimio_detach(struct a4l_device *dev)
                a4l_mite_unsetup(devpriv->mite);
        }
 
+       dev->driver->driver_name = NULL;
+
        return 0;
 }
 
 static struct a4l_driver pcimio_drv = {
        .owner = THIS_MODULE,
        .board_name = "analogy_ni_pcimio",
+       .driver_name = NULL,
        .attach = pcimio_attach,
        .detach = pcimio_detach,
        .privdata_size = sizeof(ni_private),
diff --git a/kernel/drivers/analogy/sensoray/s526.c 
b/kernel/drivers/analogy/sensoray/s526.c
index f95a7de..8ecda7e 100644
--- a/kernel/drivers/analogy/sensoray/s526.c
+++ b/kernel/drivers/analogy/sensoray/s526.c
@@ -733,6 +733,7 @@ static int dev_s526_detach(struct a4l_device *dev)
 static struct a4l_driver drv_s526 = {
        .owner = THIS_MODULE,
        .board_name = "analogy_s526",
+       .driver_name = "s526",
        .attach = dev_s526_attach,
        .detach = dev_s526_detach,
        .privdata_size = sizeof(s526_priv_t),
diff --git a/kernel/drivers/analogy/testing/fake.c 
b/kernel/drivers/analogy/testing/fake.c
index 0cb9c13..c80c1cc 100644
--- a/kernel/drivers/analogy/testing/fake.c
+++ b/kernel/drivers/analogy/testing/fake.c
@@ -663,6 +663,7 @@ int test_detach(struct a4l_device *dev)
 static struct a4l_driver test_drv = {
        .owner = THIS_MODULE,
        .board_name = "analogy_fake",
+       .driver_name = "fake",
        .attach = test_attach,
        .detach = test_detach,
        .privdata_size = sizeof(struct fake_priv),
diff --git a/lib/analogy/descriptor.c b/lib/analogy/descriptor.c
index 876dcb6..bc4d7bd 100644
--- a/lib/analogy/descriptor.c
+++ b/lib/analogy/descriptor.c
@@ -291,7 +291,7 @@ out_a4l_sys_desc:
  * - -EFAULT is returned if a user <-> kernel transfer went wrong
  *
  */
-int a4l_open(a4l_desc_t * dsc, const char *fname)
+int a4l_open(a4l_desc_t *dsc, const char *fname)
 {
        int ret;
 


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

Reply via email to