staging: comedi: cleanup comedi_recognize()
authorDan Carpenter <dan.carpenter@oracle.com>
Sat, 26 May 2012 12:14:45 +0000 (15:14 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 5 Jun 2012 03:33:39 +0000 (20:33 -0700)
This function is more complicated than it needs to be because of the
consts.  It's not worth saving them when we drop the consts anyway
when we return (void *)name_ptr.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc:
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers.c

index 7289dcb5c32c92ffe4e5f814f913b906622f35c3..438c52a313b1e2d9d9df2ae01914fe082e0a9ea2 100644 (file)
@@ -304,14 +304,13 @@ static int postconfig(struct comedi_device *dev)
  * that register their supported board names */
 static void *comedi_recognize(struct comedi_driver *driv, const char *name)
 {
-       unsigned i;
-       const char *const *name_ptr = driv->board_name;
+       char **name_ptr = (char **)driv->board_name;
+       int i;
+
        for (i = 0; i < driv->num_names; i++) {
                if (strcmp(*name_ptr, name) == 0)
-                       return (void *)name_ptr;
-               name_ptr =
-                   (const char *const *)((const char *)name_ptr +
-                                         driv->offset);
+                       return name_ptr;
+               name_ptr = (void *)name_ptr + driv->offset;
        }
 
        return NULL;