The INPUT macro depends on the local dev variable. Do not hide it
as suggested in linux/Documentation/CodingStyle, Chapter 12, point 2.
diff -up em28xx-new.orig/em28xx.h em28xx-new/em28xx.h
--- em28xx-new.orig/em28xx.h	2008-12-10 21:31:09.000000000 +0100
+++ em28xx-new/em28xx.h	2008-12-13 18:12:46.000000000 +0100
@@ -337,7 +337,7 @@ struct em28xx_input {
 	enum enum28xx_mixchannel amix;
 };
 
-#define INPUT(nr) (&em28xx_boards[dev->model].input[nr])
+#define INPUT(dev, nr) (&em28xx_boards[(dev)->model].input[nr])
 
 enum em28xx_decoder {
 	EM28XX_TVP5150,
diff -up em28xx-new.orig/em28xx-video.c em28xx-new/em28xx-video.c
--- em28xx-new.orig/em28xx-video.c	2008-12-13 11:21:18.000000000 +0100
+++ em28xx-new/em28xx-video.c	2008-12-13 18:13:36.000000000 +0100
@@ -403,7 +403,7 @@ void em28xx_config_i2c(struct em28xx *de
 {
 	struct v4l2_routing route;
 
-	route.input = INPUT(dev->ctl_input)->vmux;
+	route.input = INPUT(dev, dev->ctl_input)->vmux;
 	route.output = 0;
 
 	/* configure decoder */
@@ -442,16 +442,16 @@ static void em28xx_empty_framequeues(str
 
 static void video_mux(struct em28xx *dev, int index)
 {
-	int input = INPUT(index)->vmux;
+	int input = INPUT(dev, index)->vmux;
 	struct v4l2_routing route;
 	int ainput;
 
-	route.input = INPUT(index)->vmux;
+	route.input = INPUT(dev, index)->vmux;
 	route.output = 0;
 
 	dev->ctl_input = index;
-	dev->ctl_ainput = INPUT(index)->amux;
-	dev->ctl_amix = INPUT(index)->amix;
+	dev->ctl_ainput = INPUT(dev, index)->amux;
+	dev->ctl_amix = INPUT(dev, index)->amix;
 
 	em28xx_i2c_call_clients(dev, VIDIOC_INT_S_VIDEO_ROUTING, &route);
 
@@ -2026,14 +2026,14 @@ static int em28xx_do_ioctl(struct inode 
 		n = i->index;
 		if (n >= MAX_EM28XX_INPUT)
 			return -EINVAL;
-		if (0 == INPUT(n)->type)
+		if (0 == INPUT(dev, n)->type)
 			return -EINVAL;
 		memset(i, 0, sizeof(*i));
 		i->index = n;
 		i->type = V4L2_INPUT_TYPE_CAMERA;
-		strcpy(i->name, iname[INPUT(n)->type]);
-		if ((EM28XX_VMUX_TELEVISION == INPUT(n)->type) ||
-			(EM28XX_VMUX_CABLE == INPUT(n)->type))
+		strcpy(i->name, iname[INPUT(dev, n)->type]);
+		if ((EM28XX_VMUX_TELEVISION == INPUT(dev, n)->type) ||
+			(EM28XX_VMUX_CABLE == INPUT(dev, n)->type))
 			i->type = V4L2_INPUT_TYPE_TUNER;
 		for (n = 0; dev->board->tvnorms[n].id; n++)
 			i->std |= dev->board->tvnorms[n].id;
@@ -2053,7 +2053,7 @@ static int em28xx_do_ioctl(struct inode 
 		if (*index >= MAX_EM28XX_INPUT)
 			return -EINVAL;
 
-		if (0 == INPUT(*index)->type)
+		if (0 == INPUT(dev, *index)->type)
 			return -EINVAL;
 
 		video_mux(dev, *index);
_______________________________________________
Em28xx mailing list
[email protected]
http://mcentral.de/mailman/listinfo/em28xx

Reply via email to