[staging-next 3/6] staging/easycap: kill EASYCAP_IS_VIDEODEV_CLIENT compilation conditional

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



remove EASYCAP_IS_VIDEODEV_CLIENT and irrelevant code as the define
is always set in the in-kernel driver

Cc: Mike Thomas <rmthomas@xxxxxxxxxxx>
Signed-off-by: Tomas Winkler <tomas.winkler@xxxxxxxxx>
---
 drivers/staging/easycap/Makefile            |    1 -
 drivers/staging/easycap/easycap.h           |   10 +---
 drivers/staging/easycap/easycap_main.c      |   93 ---------------------------
 drivers/staging/easycap/easycap_sound_oss.c |    8 --
 4 files changed, 1 insertions(+), 111 deletions(-)

diff --git a/drivers/staging/easycap/Makefile b/drivers/staging/easycap/Makefile
index 1f9331b..b13e9ac 100644
--- a/drivers/staging/easycap/Makefile
+++ b/drivers/staging/easycap/Makefile
@@ -9,5 +9,4 @@ easycap-$(CONFIG_EASYCAP_OSS) += easycap_sound_oss.o
 obj-$(CONFIG_EASYCAP)       += easycap.o
 
 ccflags-y := -Wall
-ccflags-y += -DEASYCAP_IS_VIDEODEV_CLIENT
 
diff --git a/drivers/staging/easycap/easycap.h b/drivers/staging/easycap/easycap.h
index a80d023..1f94e23 100644
--- a/drivers/staging/easycap/easycap.h
+++ b/drivers/staging/easycap/easycap.h
@@ -29,7 +29,6 @@
  *  THE FOLLOWING PARAMETERS ARE UNDEFINED:
  *
  *                EASYCAP_DEBUG
- *                EASYCAP_IS_VIDEODEV_CLIENT
  *
  *  IF REQUIRED THEY MUST BE EXTERNALLY DEFINED, FOR EXAMPLE AS COMPILER
  *  OPTIONS.
@@ -81,12 +80,8 @@
 #include <sound/initval.h>
 #include <sound/control.h>
 #endif /* !CONFIG_EASYCAP_OSS */
-/*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/
-#ifdef EASYCAP_IS_VIDEODEV_CLIENT
 #include <media/v4l2-dev.h>
 #include <media/v4l2-device.h>
-#endif /*EASYCAP_IS_VIDEODEV_CLIENT*/
-/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
 #include <linux/videodev2.h>
 #include <linux/soundcard.h>
 
@@ -295,12 +290,9 @@ struct easycap {
 	int isdongle;
 	int minor;
 
-/*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/
-#ifdef EASYCAP_IS_VIDEODEV_CLIENT
 	struct video_device video_device;
 	struct v4l2_device v4l2_device;
-#endif /*EASYCAP_IS_VIDEODEV_CLIENT*/
-/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
+
 	int status;
 	unsigned int audio_pages_per_fragment;
 	unsigned int audio_bytes_per_fragment;
diff --git a/drivers/staging/easycap/easycap_main.c b/drivers/staging/easycap/easycap_main.c
index d4d58e4..cee3252 100644
--- a/drivers/staging/easycap/easycap_main.c
+++ b/drivers/staging/easycap/easycap_main.c
@@ -141,38 +141,19 @@ int isdongle(struct easycap *peasycap)
 /*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
 static int easycap_open(struct inode *inode, struct file *file)
 {
-	#ifndef EASYCAP_IS_VIDEODEV_CLIENT
-	struct usb_interface *pusb_interface;
-	#else
 	struct video_device *pvideo_device;
-	#endif /*EASYCAP_IS_VIDEODEV_CLIENT*/
 	struct easycap *peasycap;
 	int rc;
 
 	JOT(4, "\n");
 	SAY("==========OPEN=========\n");
 
-/*---------------------------------------------------------------------------*/
-#ifndef EASYCAP_IS_VIDEODEV_CLIENT
-	if (!inode) {
-		SAY("ERROR: inode is NULL.\n");
-		return -EFAULT;
-	}
-	pusb_interface = usb_find_interface(&easycap_usb_driver, iminor(inode));
-	if (!pusb_interface) {
-		SAY("ERROR: pusb_interface is NULL.\n");
-		return -EFAULT;
-	}
-	peasycap = usb_get_intfdata(pusb_interface);
-/*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/
-#else
 	pvideo_device = video_devdata(file);
 	if (!pvideo_device) {
 		SAY("ERROR: pvideo_device is NULL.\n");
 		return -EFAULT;
 	}
 	peasycap = (struct easycap *)video_get_drvdata(pvideo_device);
-#endif /*EASYCAP_IS_VIDEODEV_CLIENT*/
 	if (!peasycap) {
 		SAY("ERROR: peasycap is NULL\n");
 		return -EFAULT;
@@ -710,41 +691,11 @@ int kill_video_urbs(struct easycap *peasycap)
 /****************************************************************************/
 /*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
 /*--------------------------------------------------------------------------*/
-static int easycap_release(struct inode *inode, struct file *file)
-{
-#ifndef EASYCAP_IS_VIDEODEV_CLIENT
-	struct easycap *peasycap;
-
-
-	peasycap = file->private_data;
-	if (!peasycap) {
-		SAY("ERROR:  peasycap is NULL.\n");
-		SAY("ending unsuccessfully\n");
-		return -EFAULT;
-	}
-	if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
-		SAY("ERROR: bad peasycap: %p\n", peasycap);
-		return -EFAULT;
-	}
-	if (0 != kill_video_urbs(peasycap)) {
-		SAM("ERROR: kill_video_urbs() failed\n");
-		return -EFAULT;
-	}
-	JOM(4, "ending successfully\n");
-#endif /*EASYCAP_IS_VIDEODEV_CLIENT*/
-
-	return 0;
-}
-#ifdef EASYCAP_IS_VIDEODEV_CLIENT
 static int easycap_open_noinode(struct file *file)
 {
 	return easycap_open(NULL, file);
 }
 
-static int easycap_release_noinode(struct file *file)
-{
-	return easycap_release(NULL, file);
-}
 static int videodev_release(struct video_device *pvideo_device)
 {
 	struct easycap *peasycap;
@@ -766,7 +717,6 @@ static int videodev_release(struct video_device *pvideo_device)
 	JOM(4, "ending successfully\n");
 	return 0;
 }
-#endif /*EASYCAP_IS_VIDEODEV_CLIENT*/
 /*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
 /*****************************************************************************/
 /*--------------------------------------------------------------------------*/
@@ -3011,7 +2961,6 @@ static void easycap_complete(struct urb *purb)
 static const struct file_operations easycap_fops = {
 	.owner		= THIS_MODULE,
 	.open		= easycap_open,
-	.release	= easycap_release,
 	.unlocked_ioctl	= easycap_unlocked_ioctl,
 	.poll		= easycap_poll,
 	.mmap		= easycap_mmap,
@@ -3023,16 +2972,13 @@ static const struct usb_class_driver easycap_class = {
 	.minor_base = USB_SKEL_MINOR_BASE,
 };
 /*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/
-#ifdef EASYCAP_IS_VIDEODEV_CLIENT
 static const struct v4l2_file_operations v4l2_fops = {
 	.owner		= THIS_MODULE,
 	.open		= easycap_open_noinode,
-	.release	= easycap_release_noinode,
 	.unlocked_ioctl	= easycap_unlocked_ioctl,
 	.poll		= easycap_poll,
 	.mmap		= easycap_mmap,
 };
-#endif /*EASYCAP_IS_VIDEODEV_CLIENT*/
 /*****************************************************************************/
 /*---------------------------------------------------------------------------*/
 /*
@@ -3073,11 +3019,7 @@ static int easycap_usb_probe(struct usb_interface *pusb_interface,
 	struct easycap_format *peasycap_format;
 	int fmtidx;
 	struct inputset *inputset;
-/*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/
-#ifdef EASYCAP_IS_VIDEODEV_CLIENT
 	struct v4l2_device *pv4l2_device;
-#endif /*EASYCAP_IS_VIDEODEV_CLIENT*/
-/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
 
 /*---------------------------------------------------------------------------*/
 /*
@@ -3351,7 +3293,6 @@ static int easycap_usb_probe(struct usb_interface *pusb_interface,
 								bInterfaceNumber);
 			return -ENODEV;
 		}
-#ifdef EASYCAP_IS_VIDEODEV_CLIENT
 /*---------------------------------------------------------------------------*/
 /*
  *  SOME VERSIONS OF THE videodev MODULE OVERWRITE THE DATA WHICH HAS
@@ -3369,7 +3310,6 @@ static int easycap_usb_probe(struct usb_interface *pusb_interface,
 			peasycap = (struct easycap *)
 				container_of(pv4l2_device, struct easycap, v4l2_device);
 		}
-#endif /*EASYCAP_IS_VIDEODEV_CLIENT*/
 	}
 /*---------------------------------------------------------------------------*/
 	if ((USB_CLASS_VIDEO == bInterfaceClass) ||
@@ -3926,19 +3866,6 @@ static int easycap_usb_probe(struct usb_interface *pusb_interface,
  *  THE VIDEO DEVICE CAN BE REGISTERED NOW, AS IT IS READY.
  */
 /*--------------------------------------------------------------------------*/
-#ifndef EASYCAP_IS_VIDEODEV_CLIENT
-		if (0 != (usb_register_dev(pusb_interface, &easycap_class))) {
-			err("Not able to get a minor for this device");
-			usb_set_intfdata(pusb_interface, NULL);
-			return -ENODEV;
-		} else {
-			(peasycap->registered_video)++;
-			SAM("easycap attached to minor #%d\n", pusb_interface->minor);
-			peasycap->minor = pusb_interface->minor;
-			break;
-		}
-/*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/
-#else
 		if (0 != (v4l2_device_register(&(pusb_interface->dev),
 							&(peasycap->v4l2_device)))) {
 			SAM("v4l2_device_register() failed\n");
@@ -3977,7 +3904,6 @@ static int easycap_usb_probe(struct usb_interface *pusb_interface,
 							peasycap->video_device.minor);
 			peasycap->minor = peasycap->video_device.minor;
 		}
-#endif /*EASYCAP_IS_VIDEODEV_CLIENT*/
 /*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
 
 		break;
@@ -4330,11 +4256,7 @@ static void easycap_usb_disconnect(struct usb_interface *pusb_interface)
 	struct list_head *plist_head;
 	struct data_urb *pdata_urb;
 	int minor, m, kd;
-/*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/
-#ifdef EASYCAP_IS_VIDEODEV_CLIENT
 	struct v4l2_device *pv4l2_device;
-#endif /*EASYCAP_IS_VIDEODEV_CLIENT*/
-/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
 
 	JOT(4, "\n");
 
@@ -4361,8 +4283,6 @@ static void easycap_usb_disconnect(struct usb_interface *pusb_interface)
 		return;
 	}
 /*---------------------------------------------------------------------------*/
-#ifdef EASYCAP_IS_VIDEODEV_CLIENT
-/*---------------------------------------------------------------------------*/
 /*
  *  SOME VERSIONS OF THE videodev MODULE OVERWRITE THE DATA WHICH HAS
  *  BEEN WRITTEN BY THE CALL TO usb_set_intfdata() IN easycap_usb_probe(),
@@ -4379,7 +4299,6 @@ static void easycap_usb_disconnect(struct usb_interface *pusb_interface)
 		peasycap = (struct easycap *)
 			container_of(pv4l2_device, struct easycap, v4l2_device);
 	}
-#endif /*EASYCAP_IS_VIDEODEV_CLIENT*/
 /*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
 /*---------------------------------------------------------------------------*/
 	if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
@@ -4463,17 +4382,6 @@ static void easycap_usb_disconnect(struct usb_interface *pusb_interface)
 			SAY("ERROR: %i=kd is bad: cannot lock dongle\n", kd);
 		}
 /*---------------------------------------------------------------------------*/
-#ifndef EASYCAP_IS_VIDEODEV_CLIENT
-		if (!peasycap) {
-			SAM("ERROR: peasycap has become NULL\n");
-		} else {
-			usb_deregister_dev(pusb_interface, &easycap_class);
-			peasycap->registered_video--;
-			JOM(4, "intf[%i]: usb_deregister_dev() minor = %i\n",
-					bInterfaceNumber, minor);
-		}
-/*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/
-#else
 		if (!peasycap->v4l2_device.name[0]) {
 			SAM("ERROR: peasycap->v4l2_device.name is empty\n");
 			if (0 <= kd && DONGLE_MANY > kd)
@@ -4489,7 +4397,6 @@ static void easycap_usb_disconnect(struct usb_interface *pusb_interface)
 		JOM(4, "intf[%i]: video_unregister_device() minor=%i\n",
 				bInterfaceNumber, minor);
 		peasycap->registered_video--;
-#endif /*EASYCAP_IS_VIDEODEV_CLIENT*/
 /*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
 
 		if (0 <= kd && DONGLE_MANY > kd) {
diff --git a/drivers/staging/easycap/easycap_sound_oss.c b/drivers/staging/easycap/easycap_sound_oss.c
index d3980a6..d92baf2 100644
--- a/drivers/staging/easycap/easycap_sound_oss.c
+++ b/drivers/staging/easycap/easycap_sound_oss.c
@@ -277,11 +277,7 @@ static int easyoss_open(struct inode *inode, struct file *file)
 	struct usb_interface *pusb_interface;
 	struct easycap *peasycap;
 	int subminor;
-/*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/
-#ifdef EASYCAP_IS_VIDEODEV_CLIENT
 	struct v4l2_device *pv4l2_device;
-#endif /*EASYCAP_IS_VIDEODEV_CLIENT*/
-/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
 
 	JOT(4, "begins\n");
 
@@ -300,8 +296,6 @@ static int easyoss_open(struct inode *inode, struct file *file)
 		return -1;
 	}
 /*---------------------------------------------------------------------------*/
-#ifdef EASYCAP_IS_VIDEODEV_CLIENT
-/*---------------------------------------------------------------------------*/
 /*
  *  SOME VERSIONS OF THE videodev MODULE OVERWRITE THE DATA WHICH HAS
  *  BEEN WRITTEN BY THE CALL TO usb_set_intfdata() IN easycap_usb_probe(),
@@ -318,8 +312,6 @@ static int easyoss_open(struct inode *inode, struct file *file)
 		peasycap = container_of(pv4l2_device,
 				struct easycap, v4l2_device);
 	}
-#endif /*EASYCAP_IS_VIDEODEV_CLIENT*/
-/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
 /*---------------------------------------------------------------------------*/
 	if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
 		SAY("ERROR: bad peasycap: %p\n", peasycap);
-- 
1.7.4

---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux