Re: Kconfig for sn9c102 driver bugged

Trent Piepho <[email protected]>
Newsgroups gmane.linux.usb.devel,gmane.comp.video.video4linux
Message-ID <[email protected]>
On Sun, 18 Mar 2007, Mauro Carvalho Chehab wrote:
> Em Dom, 2007-03-18 às 09:40 +0100, Bram Stolk escreveu:
> > The Kconfig for the sn9c102 driver is wrong.
> > This driver is a V4L2 driver, but the Kconfig
> > lists V4L1 as a dependency.
>
> If you disable V4L1 support (and V4L1_COMPAT), the driver won't work,
> since it uses two obsolete functions:
>
>   CC [M]  /home/v4l/master/v4l/sn9c102_ov7630.o
> /home/v4l/master/v4l/sn9c102_core.c: In function 'sn9c102_create_sysfs':
> /home/v4l/master/v4l/sn9c102_core.c:1381: warning: implicit declaration of function 'video_device_create_file'
> /home/v4l/master/v4l/sn9c102_core.c:1414: warning: implicit declaration of function 'video_device_remove_file'

>
> $ sudo depmod -ae -F /boot/System.map
> WARNING: /lib/modules/2.6.20/kernel/drivers/media/video/sn9c102/sn9c102.ko needs unknown symbol video_device_create_file
> WARNING: /lib/modules/2.6.20/kernel/drivers/media/video/sn9c102/sn9c102.ko needs unknown symbol video_device_remove_file

This patch ok to fix it?

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
sn9c102_v4l2.patch (text/plain, 3.7 KB)
sn9c102: Make V4L2 driver

From: Trent Piepho <[email protected]>

sn9c102 is a v4l2 driver, except it used a couple v4l1 helper functions. 
Stop using those functions and depend on V4L2 in Kconfig.

Signed-off-by: Trent Piepho <[email protected]>

diff --git a/linux/drivers/media/video/sn9c102/Kconfig b/linux/drivers/media/video/sn9c102/Kconfig
--- a/linux/drivers/media/video/sn9c102/Kconfig
+++ b/linux/drivers/media/video/sn9c102/Kconfig
@@ -1,6 +1,6 @@ config USB_SN9C102
 config USB_SN9C102
 	tristate "USB SN9C1xx PC Camera Controller support"
-	depends on USB && VIDEO_V4L1
+	depends on USB && VIDEO_V4L2
 	---help---
 	  Say Y here if you want support for cameras based on SONiX SN9C101,
 	  SN9C102, SN9C103, SN9C105 and SN9C120 PC Camera Controllers.
diff --git a/linux/drivers/media/video/sn9c102/sn9c102_core.c b/linux/drivers/media/video/sn9c102/sn9c102_core.c
--- a/linux/drivers/media/video/sn9c102/sn9c102_core.c
+++ b/linux/drivers/media/video/sn9c102/sn9c102_core.c
@@ -1375,35 +1375,35 @@ static CLASS_DEVICE_ATTR(frame_header, S
 
 static int sn9c102_create_sysfs(struct sn9c102_device* cam)
 {
-	struct video_device *v4ldev = cam->v4ldev;
+	struct class_device *classdev = &(cam->v4ldev->class_dev);
 	int err = 0;
 
-	if ((err = video_device_create_file(v4ldev, &class_device_attr_reg)))
+	if ((err = class_device_create_file(classdev, &class_device_attr_reg)))
 		goto err_out;
-	if ((err = video_device_create_file(v4ldev, &class_device_attr_val)))
+	if ((err = class_device_create_file(classdev, &class_device_attr_val)))
 		goto err_reg;
-	if ((err = video_device_create_file(v4ldev,
+	if ((err = class_device_create_file(classdev,
 					    &class_device_attr_frame_header)))
 		goto err_val;
 
 	if (cam->sensor.sysfs_ops) {
-		if ((err = video_device_create_file(v4ldev,
+		if ((err = class_device_create_file(classdev,
 						  &class_device_attr_i2c_reg)))
 			goto err_frame_header;
-		if ((err = video_device_create_file(v4ldev,
+		if ((err = class_device_create_file(classdev,
 						  &class_device_attr_i2c_val)))
 			goto err_i2c_reg;
 	}
 
 	if (cam->bridge == BRIDGE_SN9C101 || cam->bridge == BRIDGE_SN9C102) {
-		if ((err = video_device_create_file(v4ldev,
+		if ((err = class_device_create_file(classdev,
 						    &class_device_attr_green)))
 			goto err_i2c_val;
 	} else {
-		if ((err = video_device_create_file(v4ldev,
+		if ((err = class_device_create_file(classdev,
 						    &class_device_attr_blue)))
 			goto err_i2c_val;
-		if ((err = video_device_create_file(v4ldev,
+		if ((err = class_device_create_file(classdev,
 						    &class_device_attr_red)))
 			goto err_blue;
 	}
@@ -1411,19 +1411,19 @@ static int sn9c102_create_sysfs(struct s
 	return 0;
 
 err_blue:
-	video_device_remove_file(v4ldev, &class_device_attr_blue);
+	class_device_remove_file(classdev, &class_device_attr_blue);
 err_i2c_val:
 	if (cam->sensor.sysfs_ops)
-		video_device_remove_file(v4ldev, &class_device_attr_i2c_val);
+		class_device_remove_file(classdev, &class_device_attr_i2c_val);
 err_i2c_reg:
 	if (cam->sensor.sysfs_ops)
-		video_device_remove_file(v4ldev, &class_device_attr_i2c_reg);
+		class_device_remove_file(classdev, &class_device_attr_i2c_reg);
 err_frame_header:
-	video_device_remove_file(v4ldev, &class_device_attr_frame_header);
+	class_device_remove_file(classdev, &class_device_attr_frame_header);
 err_val:
-	video_device_remove_file(v4ldev, &class_device_attr_val);
+	class_device_remove_file(classdev, &class_device_attr_val);
 err_reg:
-	video_device_remove_file(v4ldev, &class_device_attr_reg);
+	class_device_remove_file(classdev, &class_device_attr_reg);
 err_out:
 	return err;
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.