Cleanup proposal for media/gspca

Ezequiel elezegarcia at gmail.com
Wed Nov 16 01:34:45 UTC 2011


Hi folks,

Is it ok to submit a patchset for a style improvement for a perfectly working
driver? I am specifically speaking of media/gspca. 

I really hated this cast:

  gspca_dev = (struct gspca_dev *) video_devdata(file);

wich is only legal because a struct video_device is the first member
of gspca_dev. IMHO, this is 'unnecesary obfuscation'.
The thing is the driver is surely working fine and there is no good
reasong for the change.

So again: 

Is it ok to submit a patchset for a style improvement for a perfectly working
driver? Something like this:

diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c
index 881e04c..5d962ce 100644
--- a/drivers/media/video/gspca/gspca.c
+++ b/drivers/media/video/gspca/gspca.c
@@ -1304,9 +1306,11 @@ static void gspca_release(struct video_device *vfd)
 static int dev_open(struct file *file)
 {
 	struct gspca_dev *gspca_dev;
+	struct video_device *vdev;
 
 	PDEBUG(D_STREAM, "[%s] open", current->comm);
-	gspca_dev = (struct gspca_dev *) video_devdata(file);
+	vdev = video_devdata(file);
+	gspca_dev = video_get_drvdata(vdev);
 	if (!gspca_dev->present)

Thanks,
Ezequiel.



More information about the devel mailing list