All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] staging: comedi: cleanup comedi_recognize()
@ 2012-05-24 10:28 Dan Carpenter
  2012-05-24 10:57 ` Ian Abbott
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: Dan Carpenter @ 2012-05-24 10:28 UTC (permalink / raw)
  To: kernel-janitors

This function is more complicated than it needs to be because of the
consts.  It's not worth saving them because we drop the consts anyway
when we return (void *)name_ptr.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c
index 1c3d638..a8f576d 100644
--- a/drivers/staging/comedi/drivers.c
+++ b/drivers/staging/comedi/drivers.c
@@ -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 = (char **)((void *)name_ptr + driv->offset);
 	}
 
 	return NULL;

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2012-06-06 14:11 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-24 10:28 [patch] staging: comedi: cleanup comedi_recognize() Dan Carpenter
2012-05-24 10:57 ` Ian Abbott
2012-05-24 11:16 ` Dan Carpenter
2012-05-24 11:17 ` Ian Abbott
2012-06-05 10:06 ` walter harms
2012-06-05 11:01 ` Dan Carpenter
2012-06-06  9:28 ` Ian Abbott
2012-06-06  9:45 ` walter harms
2012-06-06  9:49 ` Dan Carpenter
2012-06-06 11:20 ` Ian Abbott
2012-06-06 12:28 ` walter harms
2012-06-06 14:11 ` Ian Abbott

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.