From f443d5878a45933e9924f755bcad28e3732e1750 Mon Sep 17 00:00:00 2001 From: Gianluca Gennari Date: Tue, 20 Mar 2012 10:10:39 -0300 Subject: [media] lirc: delete unused init/exit function prototypes The lirc sasem and imon drivers now use the module_usb_driver macro, so the old init/exit function prototypes are useless. This patch eliminates this warnings: media_build/v4l/lirc_imon.c:74:19: warning: 'imon_init' declared 'static' but never defined [-Wunused-function] media_build/v4l/lirc_imon.c:75:20: warning: 'imon_exit' declared 'static' but never defined [-Wunused-function] media_build/v4l/lirc_sasem.c:84:19: warning: 'sasem_init' declared 'static' but never defined [-Wunused-function] media_build/v4l/lirc_sasem.c:85:20: warning: 'sasem_exit' declared 'static' but never defined [-Wunused-function] Signed-off-by: Gianluca Gennari Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/lirc/lirc_imon.c | 4 ---- drivers/staging/media/lirc/lirc_sasem.c | 4 ---- 2 files changed, 8 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/lirc/lirc_imon.c b/drivers/staging/media/lirc/lirc_imon.c index 5f7f8cd3a66..083219da3a3 100644 --- a/drivers/staging/media/lirc/lirc_imon.c +++ b/drivers/staging/media/lirc/lirc_imon.c @@ -70,10 +70,6 @@ static ssize_t vfd_write(struct file *file, const char __user *buf, static int ir_open(void *data); static void ir_close(void *data); -/* Driver init/exit prototypes */ -static int __init imon_init(void); -static void __exit imon_exit(void); - /*** G L O B A L S ***/ #define IMON_DATA_BUF_SZ 35 diff --git a/drivers/staging/media/lirc/lirc_sasem.c b/drivers/staging/media/lirc/lirc_sasem.c index 74421043b95..d5bc35aea1c 100644 --- a/drivers/staging/media/lirc/lirc_sasem.c +++ b/drivers/staging/media/lirc/lirc_sasem.c @@ -80,10 +80,6 @@ static ssize_t vfd_write(struct file *file, const char *buf, static int ir_open(void *data); static void ir_close(void *data); -/* Driver init/exit prototypes */ -static int __init sasem_init(void); -static void __exit sasem_exit(void); - /*** G L O B A L S ***/ #define SASEM_DATA_BUF_SZ 32 -- cgit v1.2.3-18-g5258 From 7cfce77d779f43299c1cfeddd72462fed596c168 Mon Sep 17 00:00:00 2001 From: Konstantin Khlebnikov Date: Wed, 21 Mar 2012 02:56:33 -0300 Subject: [media] mm/drivers: use vm_flags_t for vma flags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Konstantin Khlebnikov Cc: linux-media@vger.kernel.org Cc: devel@driverdev.osuosl.org Cc: Laurent Pinchart Cc: Mauro Carvalho Chehab Cc: Greg Kroah-Hartman Cc: John Stultz Cc: "Arve Hjønnevåg" Acked-by: Laurent Pinchart Acked-by: Greg Kroah-Hartman Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/android/ashmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c index 9f1f27e7c86..4511420849b 100644 --- a/drivers/staging/android/ashmem.c +++ b/drivers/staging/android/ashmem.c @@ -269,7 +269,7 @@ out: return ret; } -static inline unsigned long calc_vm_may_flags(unsigned long prot) +static inline vm_flags_t calc_vm_may_flags(unsigned long prot) { return _calc_vm_trans(prot, PROT_READ, VM_MAYREAD) | _calc_vm_trans(prot, PROT_WRITE, VM_MAYWRITE) | -- cgit v1.2.3-18-g5258 From 4ae2e594b70b04fb90fd5fef96a996f42ecea7d5 Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Sat, 24 Mar 2012 18:39:18 -0300 Subject: [media] staging/media/as102: Don't call release_firmware() on uninitialized variable If, in drivers/staging/media/as102/as102_fw.c::as102_fw_upload(), the call cmd_buf = kzalloc(MAX_FW_PKT_SIZE, GFP_KERNEL); should fail and return NULL so that we jump to the 'error:' label, then we'll end up calling 'release_firmware(firmware);' with 'firmware' still uninitialized - not good. The easy fix is to just initialize 'firmware' to NULL when we declare it, since release_firmware() deals gracefully with being passed NULL pointers. Signed-off-by: Jesper Juhl Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/as102/as102_fw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/as102/as102_fw.c b/drivers/staging/media/as102/as102_fw.c index 43ebc43e6b9..1075fb1df0d 100644 --- a/drivers/staging/media/as102/as102_fw.c +++ b/drivers/staging/media/as102/as102_fw.c @@ -165,7 +165,7 @@ error: int as102_fw_upload(struct as10x_bus_adapter_t *bus_adap) { int errno = -EFAULT; - const struct firmware *firmware; + const struct firmware *firmware = NULL; unsigned char *cmd_buf = NULL; char *fw1, *fw2; struct usb_device *dev = bus_adap->usb_dev; -- cgit v1.2.3-18-g5258 From b803cc58c33c0c5b6220150336a6f1c7958f1404 Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Mon, 9 Apr 2012 16:51:48 -0300 Subject: [media] staging: as102: Remove redundant NULL check before release_firmware() and pointless comments release_firmware() deals gracefullt with NULL pointers - it's redundant to check for them before calling the function. Also remove a few pointless comments - it's rather obvious from the code that kfree() free's a buffer and that release_firmware() releases firmware - comments just stating that add no value. Signed-off-by: Jesper Juhl Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/as102/as102_fw.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/as102/as102_fw.c b/drivers/staging/media/as102/as102_fw.c index 1075fb1df0d..b9670ee41b4 100644 --- a/drivers/staging/media/as102/as102_fw.c +++ b/drivers/staging/media/as102/as102_fw.c @@ -230,11 +230,8 @@ int as102_fw_upload(struct as10x_bus_adapter_t *bus_adap) pr_info("%s: firmware: %s loaded with success\n", DRIVER_NAME, fw2); error: - /* free data buffer */ kfree(cmd_buf); - /* release firmware if needed */ - if (firmware != NULL) - release_firmware(firmware); + release_firmware(firmware); LEAVE(); return errno; -- cgit v1.2.3-18-g5258 From a020182ad68fd74f433693cc19059e5f7918d31c Mon Sep 17 00:00:00 2001 From: Tim Gardner Date: Thu, 12 Apr 2012 17:00:07 -0300 Subject: [media] staging: go7007: Add MODULE_FIRMWARE Signed-off-by: Tim Gardner Cc: Greg Kroah-Hartman Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/go7007/s2250-loader.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/staging') diff --git a/drivers/staging/media/go7007/s2250-loader.c b/drivers/staging/media/go7007/s2250-loader.c index 4e132519e25..829c248350f 100644 --- a/drivers/staging/media/go7007/s2250-loader.c +++ b/drivers/staging/media/go7007/s2250-loader.c @@ -189,3 +189,5 @@ module_exit(s2250loader_cleanup); MODULE_AUTHOR(""); MODULE_DESCRIPTION("firmware loader for Sensoray 2250/2251"); MODULE_LICENSE("GPL v2"); +MODULE_FIRMWARE(S2250_LOADER_FIRMWARE); +MODULE_FIRMWARE(S2250_FIRMWARE); -- cgit v1.2.3-18-g5258 From 5126f2590bee412e3053de851cb07f531e4be36a Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Thu, 10 May 2012 04:57:22 -0300 Subject: [media] v4l2-dev: add flag to have the core lock all file operations This used to be the default if the lock pointer was set, but now that lock is by default only used for ioctl serialization. Those drivers that already used core locking have this flag set explicitly, except for some drivers where it was obvious that there was no need to serialize any file operations other than ioctl. The drivers that didn't need this flag were: drivers/media/radio/dsbr100.c drivers/media/radio/radio-isa.c drivers/media/radio/radio-keene.c drivers/media/radio/radio-miropcm20.c drivers/media/radio/radio-mr800.c drivers/media/radio/radio-tea5764.c drivers/media/radio/radio-timb.c drivers/media/video/vivi.c sound/i2c/other/tea575x-tuner.c The other drivers that use core locking and where it was not immediately obvious that this flag wasn't needed were changed so that the flag is set together with a comment that that driver needs work to avoid having to set that flag. This will often involve taking the core lock in the fops themselves. Eventually this flag should go and it should not be used in new drivers. There are a few reasons why we want to avoid core locking of non-ioctl fops: in the case of mmap this can lead to a deadlock in rare situations since when mmap is called the mmap_sem is held and it is possible for other parts of the code to take that lock as well (copy_from_user()/copy_to_user() perform a down_read(&mm->mmap_sem) when a page fault occurs). It is very unlikely that that happens since the core lock serializes all fops, but the kernel warns about it if lock validation is turned on. For poll it is also undesirable to take the core lock as that can introduce increased latency. The same is true for read/write. While it was possible to make flags or something to turn on/off taking the core lock for each file operation, in practice it is much simpler to just not take it at all except for ioctl and leave it to the driver to take the lock. There are only a handful fops compared to the zillion ioctls we have. I also wanted to make it obvious which drivers still take the lock for all fops, so that's why I chose to have drivers set it explicitly. Signed-off-by: Hans Verkuil Acked-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/dt3155v4l/dt3155v4l.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'drivers/staging') diff --git a/drivers/staging/media/dt3155v4l/dt3155v4l.c b/drivers/staging/media/dt3155v4l/dt3155v4l.c index 280c84ec4cc..c365cdf714e 100644 --- a/drivers/staging/media/dt3155v4l/dt3155v4l.c +++ b/drivers/staging/media/dt3155v4l/dt3155v4l.c @@ -898,6 +898,10 @@ dt3155_probe(struct pci_dev *pdev, const struct pci_device_id *id) INIT_LIST_HEAD(&pd->dmaq); mutex_init(&pd->mux); pd->vdev->lock = &pd->mux; /* for locking v4l2_file_operations */ + /* Locking in file operations other than ioctl should be done + by the driver, not the V4L2 core. + This driver needs auditing so that this flag can be removed. */ + set_bit(V4L2_FL_LOCK_ALL_FOPS, &pd->vdev->flags); spin_lock_init(&pd->lock); pd->csr2 = csr2_init; pd->config = config_init; -- cgit v1.2.3-18-g5258 From 8173090acb33500496b69ca20c7f33c3bf665958 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Fri, 20 Apr 2012 07:30:48 -0300 Subject: [media] v4l: fix compiler warnings media_build/v4l/adv7343.c: In function 'adv7343_setstd': media_build/v4l/adv7343.c:133:6: warning: variable 'output_idx' set but not used [-Wunused-but-set-variable] media_build/v4l/tvp5150.c: In function 'tvp5150_mbus_fmt': media_build/v4l/tvp5150.c:833:14: warning: variable 'std' set but not used [-Wunused-but-set-variable] media_build/v4l/tvp7002.c: In function 'tvp7002_query_dv_preset': media_build/v4l/tvp7002.c:673:18: warning: variable 'device' set but not used [-Wunused-but-set-variable] media_build/v4l/c-qcam.c: In function 'qc_capture': media_build/v4l/c-qcam.c:381:33: warning: variable 'bitsperxfer' set but not used [-Wunused-but-set-variable] media_build/v4l/pms.c: In function 'pms_s_std': media_build/v4l/pms.c:738:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable] media_build/v4l/pms.c: In function 'init_mediavision': media_build/v4l/pms.c:959:6: warning: variable 'id' set but not used [-Wunused-but-set-variable] media_build/v4l/cx25821-alsa.c: In function 'cx25821_irq': media_build/v4l/cx25821-alsa.c:294:6: warning: variable 'audint_count' set but not used [-Wunused-but-set-variable] media_build/v4l/zr364xx.c: In function 'zr364xx_fillbuff': media_build/v4l/zr364xx.c:510:25: warning: variable 'frm' set but not used [-Wunused-but-set-variable] media_build/v4l/s2255drv.c: In function 's2255_fillbuff': media_build/v4l/s2255drv.c:637:23: warning: variable 'frm' set but not used [-Wunused-but-set-variable] media_build/v4l/s2255drv.c: In function 'vidioc_s_fmt_vid_cap': media_build/v4l/s2255drv.c:990:6: warning: variable 'norm' set but not used [-Wunused-but-set-variable] media_build/v4l/tm6000-stds.c: In function 'tm6000_set_audio_std': media_build/v4l/tm6000-stds.c:341:10: warning: variable 'nicam_flag' set but not used [-Wunused-but-set-variable] media_build/v4l/tm6000-video.c: In function 'get_next_buf': media_build/v4l/tm6000-video.c:172:8: warning: variable 'outp' set but not used [-Wunused-but-set-variable] media_build/v4l/tm6000-video.c: In function 'copy_streams': media_build/v4l/tm6000-video.c:214:36: warning: variable 'c' set but not used [-Wunused-but-set-variable] media_build/v4l/tm6000-input.c: In function 'tm6000_ir_urb_received': media_build/v4l/tm6000-input.c:171:6: warning: variable 'rc' set but not used [-Wunused-but-set-variable] media_build/v4l/usbvision-core.c: In function 'usbvision_decompress': media_build/v4l/usbvision-core.c:604:23: warning: variable 'max_pos' set but not used [-Wunused-but-set-variable] media_build/v4l/usbvision-core.c: In function 'usbvision_parse_compress': media_build/v4l/usbvision-core.c:705:39: warning: variable 'rc' set but not used [-Wunused-but-set-variable] media_build/v4l/usbvision-core.c:705:22: warning: variable 'bytes_per_pixel' set but not used [-Wunused-but-set-variable] media_build/v4l/zoran_device.c: In function 'write_overlay_mask': media_build/v4l/zoran_device.c:545:6: warning: variable 'reg' set but not used [-Wunused-but-set-variable] media_build/v4l/go7007-v4l2.c: In function 'go7007_streamoff': media_build/v4l/go7007-v4l2.c:79:6: warning: variable 'retval' set but not used [-Wunused-but-set-variable] Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/go7007/go7007-v4l2.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/go7007/go7007-v4l2.c b/drivers/staging/media/go7007/go7007-v4l2.c index 3ef4cd8b4de..c184ad30fbd 100644 --- a/drivers/staging/media/go7007/go7007-v4l2.c +++ b/drivers/staging/media/go7007/go7007-v4l2.c @@ -76,7 +76,6 @@ static void abort_queued(struct go7007 *go) static int go7007_streamoff(struct go7007 *go) { - int retval = -EINVAL; unsigned long flags; mutex_lock(&go->hw_lock); @@ -87,7 +86,6 @@ static int go7007_streamoff(struct go7007 *go) abort_queued(go); spin_unlock_irqrestore(&go->spinlock, flags); go7007_reset_encoder(go); - retval = 0; } mutex_unlock(&go->hw_lock); return 0; -- cgit v1.2.3-18-g5258 From 0550b29464f1d43a690198a6a8e984ae788ba9fa Mon Sep 17 00:00:00 2001 From: joseph daniel Date: Sun, 6 May 2012 01:33:51 -0300 Subject: [media] staging/media/as102: removed else statements The else statement is actually not required, as we can assign AS10X_CMD_ERROR to the error variable directly. Signed-off-by: joseph daniel Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/as102/as10x_cmd.c | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/as102/as10x_cmd.c b/drivers/staging/media/as102/as10x_cmd.c index 262bb94ad27..a73df10982d 100644 --- a/drivers/staging/media/as102/as10x_cmd.c +++ b/drivers/staging/media/as102/as10x_cmd.c @@ -31,7 +31,7 @@ */ int as10x_cmd_turn_on(struct as10x_bus_adapter_t *adap) { - int error; + int error = AS10X_CMD_ERROR; struct as10x_cmd_t *pcmd, *prsp; ENTER(); @@ -54,8 +54,6 @@ int as10x_cmd_turn_on(struct as10x_bus_adapter_t *adap) (uint8_t *) prsp, sizeof(prsp->body.turn_on.rsp) + HEADER_SIZE); - } else { - error = AS10X_CMD_ERROR; } if (error < 0) @@ -77,7 +75,7 @@ out: */ int as10x_cmd_turn_off(struct as10x_bus_adapter_t *adap) { - int error; + int error = AS10X_CMD_ERROR; struct as10x_cmd_t *pcmd, *prsp; ENTER(); @@ -99,8 +97,6 @@ int as10x_cmd_turn_off(struct as10x_bus_adapter_t *adap) sizeof(pcmd->body.turn_off.req) + HEADER_SIZE, (uint8_t *) prsp, sizeof(prsp->body.turn_off.rsp) + HEADER_SIZE); - } else { - error = AS10X_CMD_ERROR; } if (error < 0) @@ -124,7 +120,7 @@ out: int as10x_cmd_set_tune(struct as10x_bus_adapter_t *adap, struct as10x_tune_args *ptune) { - int error; + int error = AS10X_CMD_ERROR; struct as10x_cmd_t *preq, *prsp; ENTER(); @@ -159,8 +155,6 @@ int as10x_cmd_set_tune(struct as10x_bus_adapter_t *adap, (uint8_t *) prsp, sizeof(prsp->body.set_tune.rsp) + HEADER_SIZE); - } else { - error = AS10X_CMD_ERROR; } if (error < 0) @@ -184,7 +178,7 @@ out: int as10x_cmd_get_tune_status(struct as10x_bus_adapter_t *adap, struct as10x_tune_status *pstatus) { - int error; + int error = AS10X_CMD_ERROR; struct as10x_cmd_t *preq, *prsp; ENTER(); @@ -208,8 +202,6 @@ int as10x_cmd_get_tune_status(struct as10x_bus_adapter_t *adap, sizeof(preq->body.get_tune_status.req) + HEADER_SIZE, (uint8_t *) prsp, sizeof(prsp->body.get_tune_status.rsp) + HEADER_SIZE); - } else { - error = AS10X_CMD_ERROR; } if (error < 0) @@ -241,7 +233,7 @@ out: */ int as10x_cmd_get_tps(struct as10x_bus_adapter_t *adap, struct as10x_tps *ptps) { - int error; + int error = AS10X_CMD_ERROR; struct as10x_cmd_t *pcmd, *prsp; ENTER(); @@ -266,8 +258,6 @@ int as10x_cmd_get_tps(struct as10x_bus_adapter_t *adap, struct as10x_tps *ptps) (uint8_t *) prsp, sizeof(prsp->body.get_tps.rsp) + HEADER_SIZE); - } else { - error = AS10X_CMD_ERROR; } if (error < 0) @@ -305,7 +295,7 @@ out: int as10x_cmd_get_demod_stats(struct as10x_bus_adapter_t *adap, struct as10x_demod_stats *pdemod_stats) { - int error; + int error = AS10X_CMD_ERROR; struct as10x_cmd_t *pcmd, *prsp; ENTER(); @@ -330,8 +320,6 @@ int as10x_cmd_get_demod_stats(struct as10x_bus_adapter_t *adap, (uint8_t *) prsp, sizeof(prsp->body.get_demod_stats.rsp) + HEADER_SIZE); - } else { - error = AS10X_CMD_ERROR; } if (error < 0) @@ -370,7 +358,7 @@ out: int as10x_cmd_get_impulse_resp(struct as10x_bus_adapter_t *adap, uint8_t *is_ready) { - int error; + int error = AS10X_CMD_ERROR; struct as10x_cmd_t *pcmd, *prsp; ENTER(); @@ -395,8 +383,6 @@ int as10x_cmd_get_impulse_resp(struct as10x_bus_adapter_t *adap, (uint8_t *) prsp, sizeof(prsp->body.get_impulse_rsp.rsp) + HEADER_SIZE); - } else { - error = AS10X_CMD_ERROR; } if (error < 0) -- cgit v1.2.3-18-g5258 From ab019fd41d993911ba32db0204bb1233682705ee Mon Sep 17 00:00:00 2001 From: Ezequiel García Date: Fri, 24 Feb 2012 11:24:14 -0300 Subject: [media] staging: easycap: Split device struct alloc and retrieval code When the device is probed a driver struct is either allocated or retrieved. This operation is logically splitted in several functions. Signed-off-by: Ezequiel Garcia Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/easycap/easycap_main.c | 384 +++++++++++++++------------ 1 file changed, 216 insertions(+), 168 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/easycap/easycap_main.c b/drivers/staging/media/easycap/easycap_main.c index d0fe34afc2e..c4198be6344 100644 --- a/drivers/staging/media/easycap/easycap_main.c +++ b/drivers/staging/media/easycap/easycap_main.c @@ -2842,6 +2842,209 @@ static void easycap_complete(struct urb *purb) return; } +static struct easycap *alloc_easycap(u8 bInterfaceNumber) +{ + struct easycap *peasycap; + int i; + + peasycap = kzalloc(sizeof(struct easycap), GFP_KERNEL); + if (!peasycap) { + SAY("ERROR: Could not allocate peasycap\n"); + return NULL; + } + + if (mutex_lock_interruptible(&mutex_dongle)) { + SAY("ERROR: cannot lock mutex_dongle\n"); + kfree(peasycap); + return NULL; + } + + /* Find a free dongle in easycapdc60_dongle array */ + for (i = 0; i < DONGLE_MANY; i++) { + + if ((!easycapdc60_dongle[i].peasycap) && + (!mutex_is_locked(&easycapdc60_dongle[i].mutex_video)) && + (!mutex_is_locked(&easycapdc60_dongle[i].mutex_audio))) { + + easycapdc60_dongle[i].peasycap = peasycap; + peasycap->isdongle = i; + JOM(8, "intf[%i]: peasycap-->easycap" + "_dongle[%i].peasycap\n", + bInterfaceNumber, i); + break; + } + } + + mutex_unlock(&mutex_dongle); + + if (i >= DONGLE_MANY) { + SAM("ERROR: too many dongles\n"); + kfree(peasycap); + return NULL; + } + + return peasycap; +} + +/* + * FIXME: Identify the appropriate pointer peasycap for interfaces + * 1 and 2. The address of peasycap->pusb_device is reluctantly used + * for this purpose. + */ +static struct easycap *get_easycap(struct usb_device *usbdev, + u8 bInterfaceNumber) +{ + int i; + struct easycap *peasycap; + + for (i = 0; i < DONGLE_MANY; i++) { + if (easycapdc60_dongle[i].peasycap->pusb_device == usbdev) { + peasycap = easycapdc60_dongle[i].peasycap; + JOT(8, "intf[%i]: dongle[%i].peasycap\n", + bInterfaceNumber, i); + break; + } + } + if (i >= DONGLE_MANY) { + SAY("ERROR: peasycap is unknown when probing interface %i\n", + bInterfaceNumber); + return NULL; + } + if (!peasycap) { + SAY("ERROR: peasycap is NULL when probing interface %i\n", + bInterfaceNumber); + return NULL; + } + + return peasycap; +} + +static void init_easycap(struct easycap *peasycap, + struct usb_device *usbdev, + struct usb_interface *intf, + u8 bInterfaceNumber) +{ + /* Save usb_device and usb_interface */ + peasycap->pusb_device = usbdev; + peasycap->pusb_interface = intf; + + peasycap->minor = -1; + kref_init(&peasycap->kref); + JOM(8, "intf[%i]: after kref_init(..._video) " + "%i=peasycap->kref.refcount.counter\n", + bInterfaceNumber, peasycap->kref.refcount.counter); + + /* module params */ + peasycap->gain = (s8)clamp(easycap_gain, 0, 31); + + init_waitqueue_head(&peasycap->wq_video); + init_waitqueue_head(&peasycap->wq_audio); + init_waitqueue_head(&peasycap->wq_trigger); + + peasycap->allocation_video_struct = sizeof(struct easycap); + + peasycap->microphone = false; + + peasycap->video_interface = -1; + peasycap->video_altsetting_on = -1; + peasycap->video_altsetting_off = -1; + peasycap->video_endpointnumber = -1; + peasycap->video_isoc_maxframesize = -1; + peasycap->video_isoc_buffer_size = -1; + + peasycap->audio_interface = -1; + peasycap->audio_altsetting_on = -1; + peasycap->audio_altsetting_off = -1; + peasycap->audio_endpointnumber = -1; + peasycap->audio_isoc_maxframesize = -1; + peasycap->audio_isoc_buffer_size = -1; + + peasycap->frame_buffer_many = FRAME_BUFFER_MANY; +} + +static int populate_inputset(struct easycap *peasycap) +{ + struct inputset *inputset; + struct easycap_format *peasycap_format; + struct v4l2_pix_format *pix; + int m, i, k, mask, fmtidx; + s32 value; + + inputset = peasycap->inputset; + + /* FIXME: peasycap->ntsc is not yet initialized */ + fmtidx = peasycap->ntsc ? NTSC_M : PAL_BGHIN; + + m = 0; + mask = 0; + for (i = 0; easycap_standard[i].mask != 0xffff; i++) { + if (fmtidx == easycap_standard[i].v4l2_standard.index) { + m++; + for (k = 0; k < INPUT_MANY; k++) + inputset[k].standard_offset = i; + mask = easycap_standard[i].mask; + } + } + + if (m != 1) { + SAM("ERROR: inputset->standard_offset unpopulated, %i=m\n", m); + return -ENOENT; + } + + peasycap_format = &easycap_format[0]; + m = 0; + for (i = 0; peasycap_format->v4l2_format.fmt.pix.width; i++) { + pix = &peasycap_format->v4l2_format.fmt.pix; + if (((peasycap_format->mask & 0x0F) == (mask & 0x0F)) + && pix->field == V4L2_FIELD_NONE + && pix->pixelformat == V4L2_PIX_FMT_UYVY + && pix->width == 640 && pix->height == 480) { + m++; + for (k = 0; k < INPUT_MANY; k++) + inputset[k].format_offset = i; + break; + } + peasycap_format++; + } + if (m != 1) { + SAM("ERROR: inputset[]->format_offset unpopulated\n"); + return -ENOENT; + } + + m = 0; + for (i = 0; easycap_control[i].id != 0xffffffff; i++) { + value = easycap_control[i].default_value; + if (V4L2_CID_BRIGHTNESS == easycap_control[i].id) { + m++; + for (k = 0; k < INPUT_MANY; k++) + inputset[k].brightness = value; + } else if (V4L2_CID_CONTRAST == easycap_control[i].id) { + m++; + for (k = 0; k < INPUT_MANY; k++) + inputset[k].contrast = value; + } else if (V4L2_CID_SATURATION == easycap_control[i].id) { + m++; + for (k = 0; k < INPUT_MANY; k++) + inputset[k].saturation = value; + } else if (V4L2_CID_HUE == easycap_control[i].id) { + m++; + for (k = 0; k < INPUT_MANY; k++) + inputset[k].hue = value; + } + } + + if (m != 4) { + SAM("ERROR: inputset[]->brightness underpopulated\n"); + return -ENOENT; + } + + for (k = 0; k < INPUT_MANY; k++) + inputset[k].input = k; + JOM(4, "populated inputset[]\n"); + + return 0; +} + static const struct v4l2_file_operations v4l2_fops = { .owner = THIS_MODULE, .open = easycap_open_noinode, @@ -2863,7 +3066,6 @@ static int easycap_usb_probe(struct usb_interface *intf, struct usb_interface_descriptor *interface; struct urb *purb; struct easycap *peasycap; - int ndong; struct data_urb *pdata_urb; int i, j, k, m, rc; u8 bInterfaceNumber; @@ -2874,11 +3076,6 @@ static int easycap_usb_probe(struct usb_interface *intf, int okepn[8]; int okmps[8]; int maxpacketsize; - u16 mask; - s32 value; - struct easycap_format *peasycap_format; - int fmtidx; - struct inputset *inputset; usbdev = interface_to_usbdev(intf); @@ -2916,76 +3113,16 @@ static int easycap_usb_probe(struct usb_interface *intf, * interfaces 1 and 2 are probed. */ if (0 == bInterfaceNumber) { - peasycap = kzalloc(sizeof(struct easycap), GFP_KERNEL); - if (!peasycap) { - SAY("ERROR: Could not allocate peasycap\n"); - return -ENOMEM; - } - - /* Perform urgent initializations */ - peasycap->minor = -1; - kref_init(&peasycap->kref); - JOM(8, "intf[%i]: after kref_init(..._video) " - "%i=peasycap->kref.refcount.counter\n", - bInterfaceNumber, peasycap->kref.refcount.counter); - - /* module params */ - peasycap->gain = (s8)clamp(easycap_gain, 0, 31); - - init_waitqueue_head(&peasycap->wq_video); - init_waitqueue_head(&peasycap->wq_audio); - init_waitqueue_head(&peasycap->wq_trigger); - - if (mutex_lock_interruptible(&mutex_dongle)) { - SAY("ERROR: cannot down mutex_dongle\n"); - return -ERESTARTSYS; - } - - for (ndong = 0; ndong < DONGLE_MANY; ndong++) { - if ((!easycapdc60_dongle[ndong].peasycap) && - (!mutex_is_locked(&easycapdc60_dongle - [ndong].mutex_video)) && - (!mutex_is_locked(&easycapdc60_dongle - [ndong].mutex_audio))) { - easycapdc60_dongle[ndong].peasycap = peasycap; - peasycap->isdongle = ndong; - JOM(8, "intf[%i]: peasycap-->easycap" - "_dongle[%i].peasycap\n", - bInterfaceNumber, ndong); - break; - } - } - - if (DONGLE_MANY <= ndong) { - SAM("ERROR: too many dongles\n"); - mutex_unlock(&mutex_dongle); + /* + * Alloc structure and save it in a free slot in + * easycapdc60_dongle array + */ + peasycap = alloc_easycap(bInterfaceNumber); + if (!peasycap) return -ENOMEM; - } - mutex_unlock(&mutex_dongle); - peasycap->allocation_video_struct = sizeof(struct easycap); - - /* and further initialize the structure */ - peasycap->pusb_device = usbdev; - peasycap->pusb_interface = intf; - - peasycap->microphone = false; - - peasycap->video_interface = -1; - peasycap->video_altsetting_on = -1; - peasycap->video_altsetting_off = -1; - peasycap->video_endpointnumber = -1; - peasycap->video_isoc_maxframesize = -1; - peasycap->video_isoc_buffer_size = -1; - - peasycap->audio_interface = -1; - peasycap->audio_altsetting_on = -1; - peasycap->audio_altsetting_off = -1; - peasycap->audio_endpointnumber = -1; - peasycap->audio_isoc_maxframesize = -1; - peasycap->audio_isoc_buffer_size = -1; - - peasycap->frame_buffer_many = FRAME_BUFFER_MANY; + /* Perform basic struct initialization */ + init_easycap(peasycap, usbdev, intf, bInterfaceNumber); /* Dynamically fill in the available formats */ rc = easycap_video_fillin_formats(); @@ -2996,103 +3133,14 @@ static int easycap_usb_probe(struct usb_interface *intf, JOM(4, "%i formats available\n", rc); /* Populate easycap.inputset[] */ - inputset = peasycap->inputset; - fmtidx = peasycap->ntsc ? NTSC_M : PAL_BGHIN; - m = 0; - mask = 0; - for (i = 0; 0xFFFF != easycap_standard[i].mask; i++) { - if (fmtidx == easycap_standard[i].v4l2_standard.index) { - m++; - for (k = 0; k < INPUT_MANY; k++) - inputset[k].standard_offset = i; - - mask = easycap_standard[i].mask; - } - } - if (1 != m) { - SAM("ERROR: " - "inputset->standard_offset unpopulated, %i=m\n", m); - return -ENOENT; - } - - peasycap_format = &easycap_format[0]; - m = 0; - for (i = 0; peasycap_format->v4l2_format.fmt.pix.width; i++) { - struct v4l2_pix_format *pix = - &peasycap_format->v4l2_format.fmt.pix; - if (((peasycap_format->mask & 0x0F) == (mask & 0x0F)) && - pix->field == V4L2_FIELD_NONE && - pix->pixelformat == V4L2_PIX_FMT_UYVY && - pix->width == 640 && pix->height == 480) { - m++; - for (k = 0; k < INPUT_MANY; k++) - inputset[k].format_offset = i; - break; - } - peasycap_format++; - } - if (1 != m) { - SAM("ERROR: inputset[]->format_offset unpopulated\n"); - return -ENOENT; - } - - m = 0; - for (i = 0; 0xFFFFFFFF != easycap_control[i].id; i++) { - value = easycap_control[i].default_value; - if (V4L2_CID_BRIGHTNESS == easycap_control[i].id) { - m++; - for (k = 0; k < INPUT_MANY; k++) - inputset[k].brightness = value; - } else if (V4L2_CID_CONTRAST == easycap_control[i].id) { - m++; - for (k = 0; k < INPUT_MANY; k++) - inputset[k].contrast = value; - } else if (V4L2_CID_SATURATION == easycap_control[i].id) { - m++; - for (k = 0; k < INPUT_MANY; k++) - inputset[k].saturation = value; - } else if (V4L2_CID_HUE == easycap_control[i].id) { - m++; - for (k = 0; k < INPUT_MANY; k++) - inputset[k].hue = value; - } - } - - if (4 != m) { - SAM("ERROR: inputset[]->brightness underpopulated\n"); - return -ENOENT; - } - for (k = 0; k < INPUT_MANY; k++) - inputset[k].input = k; - JOM(4, "populated inputset[]\n"); + rc = populate_inputset(peasycap); + if (rc < 0) + return rc; JOM(4, "finished initialization\n"); } else { - - /* - * FIXME: Identify the appropriate pointer - * peasycap for interfaces 1 and 2. - * The address of peasycap->pusb_device - * is reluctantly used for this purpose. - */ - for (ndong = 0; ndong < DONGLE_MANY; ndong++) { - if (usbdev == easycapdc60_dongle[ndong].peasycap-> - pusb_device) { - peasycap = easycapdc60_dongle[ndong].peasycap; - JOT(8, "intf[%i]: dongle[%i].peasycap\n", - bInterfaceNumber, ndong); - break; - } - } - if (DONGLE_MANY <= ndong) { - SAY("ERROR: peasycap is unknown when probing interface %i\n", - bInterfaceNumber); + peasycap = get_easycap(usbdev, bInterfaceNumber); + if (!peasycap) return -ENODEV; - } - if (!peasycap) { - SAY("ERROR: peasycap is NULL when probing interface %i\n", - bInterfaceNumber); - return -ENODEV; - } } if ((USB_CLASS_VIDEO == bInterfaceClass) || -- cgit v1.2.3-18-g5258 From 20c50af28aa9301b1f5bf0ba571068f663f7b0ac Mon Sep 17 00:00:00 2001 From: Ezequiel García Date: Fri, 24 Feb 2012 11:24:15 -0300 Subject: [media] staging: easycap: Split buffer and video urb allocation When the device is probed, this driver allocates frame buffers, field buffers, isoc buffers and urbs. This patch just split this into separate functions, which helps clearing the currently gigantic probe function. Signed-off-by: Ezequiel Garcia Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/easycap/easycap_main.c | 375 +++++++++++++++------------ 1 file changed, 211 insertions(+), 164 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/easycap/easycap_main.c b/drivers/staging/media/easycap/easycap_main.c index c4198be6344..6d7cdef5880 100644 --- a/drivers/staging/media/easycap/easycap_main.c +++ b/drivers/staging/media/easycap/easycap_main.c @@ -3045,6 +3045,203 @@ static int populate_inputset(struct easycap *peasycap) return 0; } +static int alloc_framebuffers(struct easycap *peasycap) +{ + int i, j; + void *pbuf; + + JOM(4, "allocating %i frame buffers of size %li\n", + FRAME_BUFFER_MANY, (long int)FRAME_BUFFER_SIZE); + JOM(4, ".... each scattered over %li pages\n", + FRAME_BUFFER_SIZE/PAGE_SIZE); + + for (i = 0; i < FRAME_BUFFER_MANY; i++) { + for (j = 0; j < FRAME_BUFFER_SIZE/PAGE_SIZE; j++) { + if (peasycap->frame_buffer[i][j].pgo) + SAM("attempting to reallocate framebuffers\n"); + else { + pbuf = (void *)__get_free_page(GFP_KERNEL); + if (!pbuf) { + SAM("ERROR: Could not allocate " + "framebuffer %i page %i\n", i, j); + return -ENOMEM; + } + peasycap->allocation_video_page += 1; + peasycap->frame_buffer[i][j].pgo = pbuf; + } + peasycap->frame_buffer[i][j].pto = + peasycap->frame_buffer[i][j].pgo; + } + } + + peasycap->frame_fill = 0; + peasycap->frame_read = 0; + JOM(4, "allocation of frame buffers done: %i pages\n", i*j); + + return 0; +} + +static int alloc_fieldbuffers(struct easycap *peasycap) +{ + int i, j; + void *pbuf; + + JOM(4, "allocating %i field buffers of size %li\n", + FIELD_BUFFER_MANY, (long int)FIELD_BUFFER_SIZE); + JOM(4, ".... each scattered over %li pages\n", + FIELD_BUFFER_SIZE/PAGE_SIZE); + + for (i = 0; i < FIELD_BUFFER_MANY; i++) { + for (j = 0; j < FIELD_BUFFER_SIZE/PAGE_SIZE; j++) { + if (peasycap->field_buffer[i][j].pgo) { + SAM("ERROR: attempting to reallocate " + "fieldbuffers\n"); + } else { + pbuf = (void *) __get_free_page(GFP_KERNEL); + if (!pbuf) { + SAM("ERROR: Could not allocate " + "fieldbuffer %i page %i\n", i, j); + return -ENOMEM; + } + peasycap->allocation_video_page += 1; + peasycap->field_buffer[i][j].pgo = pbuf; + } + peasycap->field_buffer[i][j].pto = + peasycap->field_buffer[i][j].pgo; + } + /* TODO: Hardcoded 0x0200 meaning? */ + peasycap->field_buffer[i][0].kount = 0x0200; + } + peasycap->field_fill = 0; + peasycap->field_page = 0; + peasycap->field_read = 0; + JOM(4, "allocation of field buffers done: %i pages\n", i*j); + + return 0; +} + +static int alloc_isocbuffers(struct easycap *peasycap) +{ + int i; + void *pbuf; + + JOM(4, "allocating %i isoc video buffers of size %i\n", + VIDEO_ISOC_BUFFER_MANY, + peasycap->video_isoc_buffer_size); + JOM(4, ".... each occupying contiguous memory pages\n"); + + for (i = 0; i < VIDEO_ISOC_BUFFER_MANY; i++) { + pbuf = (void *)__get_free_pages(GFP_KERNEL, + VIDEO_ISOC_ORDER); + if (!pbuf) { + SAM("ERROR: Could not allocate isoc " + "video buffer %i\n", i); + return -ENOMEM; + } + peasycap->allocation_video_page += BIT(VIDEO_ISOC_ORDER); + + peasycap->video_isoc_buffer[i].pgo = pbuf; + peasycap->video_isoc_buffer[i].pto = + pbuf + peasycap->video_isoc_buffer_size; + peasycap->video_isoc_buffer[i].kount = i; + } + JOM(4, "allocation of isoc video buffers done: %i pages\n", + i * (0x01 << VIDEO_ISOC_ORDER)); + return 0; +} + +static int create_video_urbs(struct easycap *peasycap) +{ + struct urb *purb; + struct data_urb *pdata_urb; + int i, j; + + JOM(4, "allocating %i struct urb.\n", VIDEO_ISOC_BUFFER_MANY); + JOM(4, "using %i=peasycap->video_isoc_framesperdesc\n", + peasycap->video_isoc_framesperdesc); + JOM(4, "using %i=peasycap->video_isoc_maxframesize\n", + peasycap->video_isoc_maxframesize); + JOM(4, "using %i=peasycap->video_isoc_buffer_sizen", + peasycap->video_isoc_buffer_size); + + for (i = 0; i < VIDEO_ISOC_BUFFER_MANY; i++) { + purb = usb_alloc_urb(peasycap->video_isoc_framesperdesc, + GFP_KERNEL); + if (!purb) { + SAM("ERROR: usb_alloc_urb returned NULL for buffer " + "%i\n", i); + return -ENOMEM; + } + + peasycap->allocation_video_urb += 1; + pdata_urb = kzalloc(sizeof(struct data_urb), GFP_KERNEL); + if (!pdata_urb) { + SAM("ERROR: Could not allocate struct data_urb.\n"); + return -ENOMEM; + } + + peasycap->allocation_video_struct += + sizeof(struct data_urb); + + pdata_urb->purb = purb; + pdata_urb->isbuf = i; + pdata_urb->length = 0; + list_add_tail(&(pdata_urb->list_head), + peasycap->purb_video_head); + + if (!i) { + JOM(4, "initializing video urbs thus:\n"); + JOM(4, " purb->interval = 1;\n"); + JOM(4, " purb->dev = peasycap->pusb_device;\n"); + JOM(4, " purb->pipe = usb_rcvisocpipe" + "(peasycap->pusb_device,%i);\n", + peasycap->video_endpointnumber); + JOM(4, " purb->transfer_flags = URB_ISO_ASAP;\n"); + JOM(4, " purb->transfer_buffer = peasycap->" + "video_isoc_buffer[.].pgo;\n"); + JOM(4, " purb->transfer_buffer_length = %i;\n", + peasycap->video_isoc_buffer_size); + JOM(4, " purb->complete = easycap_complete;\n"); + JOM(4, " purb->context = peasycap;\n"); + JOM(4, " purb->start_frame = 0;\n"); + JOM(4, " purb->number_of_packets = %i;\n", + peasycap->video_isoc_framesperdesc); + JOM(4, " for (j = 0; j < %i; j++)\n", + peasycap->video_isoc_framesperdesc); + JOM(4, " {\n"); + JOM(4, " purb->iso_frame_desc[j].offset = j*%i;\n", + peasycap->video_isoc_maxframesize); + JOM(4, " purb->iso_frame_desc[j].length = %i;\n", + peasycap->video_isoc_maxframesize); + JOM(4, " }\n"); + } + + purb->interval = 1; + purb->dev = peasycap->pusb_device; + purb->pipe = usb_rcvisocpipe(peasycap->pusb_device, + peasycap->video_endpointnumber); + + purb->transfer_flags = URB_ISO_ASAP; + purb->transfer_buffer = peasycap->video_isoc_buffer[i].pgo; + purb->transfer_buffer_length = + peasycap->video_isoc_buffer_size; + + purb->complete = easycap_complete; + purb->context = peasycap; + purb->start_frame = 0; + purb->number_of_packets = peasycap->video_isoc_framesperdesc; + + for (j = 0; j < peasycap->video_isoc_framesperdesc; j++) { + purb->iso_frame_desc[j].offset = + j * peasycap->video_isoc_maxframesize; + purb->iso_frame_desc[j].length = + peasycap->video_isoc_maxframesize; + } + } + JOM(4, "allocation of %i struct urb done.\n", i); + return 0; +} + static const struct v4l2_file_operations v4l2_fops = { .owner = THIS_MODULE, .open = easycap_open_noinode, @@ -3067,7 +3264,7 @@ static int easycap_usb_probe(struct usb_interface *intf, struct urb *purb; struct easycap *peasycap; struct data_urb *pdata_urb; - int i, j, k, m, rc; + int i, j, k, rc; u8 bInterfaceNumber; u8 bInterfaceClass; u8 bInterfaceSubClass; @@ -3416,173 +3613,23 @@ static int easycap_usb_probe(struct usb_interface *intf, */ INIT_LIST_HEAD(&(peasycap->urb_video_head)); peasycap->purb_video_head = &(peasycap->urb_video_head); - JOM(4, "allocating %i frame buffers of size %li\n", - FRAME_BUFFER_MANY, (long int)FRAME_BUFFER_SIZE); - JOM(4, ".... each scattered over %li pages\n", - FRAME_BUFFER_SIZE/PAGE_SIZE); - - for (k = 0; k < FRAME_BUFFER_MANY; k++) { - for (m = 0; m < FRAME_BUFFER_SIZE/PAGE_SIZE; m++) { - if (peasycap->frame_buffer[k][m].pgo) - SAM("attempting to reallocate frame " - " buffers\n"); - else { - pbuf = (void *)__get_free_page(GFP_KERNEL); - if (!pbuf) { - SAM("ERROR: Could not allocate frame " - "buffer %i page %i\n", k, m); - return -ENOMEM; - } - - peasycap->allocation_video_page += 1; - peasycap->frame_buffer[k][m].pgo = pbuf; - } - peasycap->frame_buffer[k][m].pto = - peasycap->frame_buffer[k][m].pgo; - } - } - peasycap->frame_fill = 0; - peasycap->frame_read = 0; - JOM(4, "allocation of frame buffers done: %i pages\n", k * - m); - JOM(4, "allocating %i field buffers of size %li\n", - FIELD_BUFFER_MANY, (long int)FIELD_BUFFER_SIZE); - JOM(4, ".... each scattered over %li pages\n", - FIELD_BUFFER_SIZE/PAGE_SIZE); - - for (k = 0; k < FIELD_BUFFER_MANY; k++) { - for (m = 0; m < FIELD_BUFFER_SIZE/PAGE_SIZE; m++) { - if (peasycap->field_buffer[k][m].pgo) { - SAM("ERROR: attempting to reallocate " - "field buffers\n"); - } else { - pbuf = (void *) __get_free_page(GFP_KERNEL); - if (!pbuf) { - SAM("ERROR: Could not allocate field" - " buffer %i page %i\n", k, m); - return -ENOMEM; - } - - peasycap->allocation_video_page += 1; - peasycap->field_buffer[k][m].pgo = pbuf; - } - peasycap->field_buffer[k][m].pto = - peasycap->field_buffer[k][m].pgo; - } - peasycap->field_buffer[k][0].kount = 0x0200; - } - peasycap->field_fill = 0; - peasycap->field_page = 0; - peasycap->field_read = 0; - JOM(4, "allocation of field buffers done: %i pages\n", k * - m); - JOM(4, "allocating %i isoc video buffers of size %i\n", - VIDEO_ISOC_BUFFER_MANY, - peasycap->video_isoc_buffer_size); - JOM(4, ".... each occupying contiguous memory pages\n"); - - for (k = 0; k < VIDEO_ISOC_BUFFER_MANY; k++) { - pbuf = (void *)__get_free_pages(GFP_KERNEL, - VIDEO_ISOC_ORDER); - if (!pbuf) { - SAM("ERROR: Could not allocate isoc video buffer " - "%i\n", k); - return -ENOMEM; - } - peasycap->allocation_video_page += - BIT(VIDEO_ISOC_ORDER); - - peasycap->video_isoc_buffer[k].pgo = pbuf; - peasycap->video_isoc_buffer[k].pto = - pbuf + peasycap->video_isoc_buffer_size; - peasycap->video_isoc_buffer[k].kount = k; - } - JOM(4, "allocation of isoc video buffers done: %i pages\n", - k * (0x01 << VIDEO_ISOC_ORDER)); - - /* Allocate and initialize multiple struct usb */ - JOM(4, "allocating %i struct urb.\n", VIDEO_ISOC_BUFFER_MANY); - JOM(4, "using %i=peasycap->video_isoc_framesperdesc\n", - peasycap->video_isoc_framesperdesc); - JOM(4, "using %i=peasycap->video_isoc_maxframesize\n", - peasycap->video_isoc_maxframesize); - JOM(4, "using %i=peasycap->video_isoc_buffer_sizen", - peasycap->video_isoc_buffer_size); - - for (k = 0; k < VIDEO_ISOC_BUFFER_MANY; k++) { - purb = usb_alloc_urb(peasycap->video_isoc_framesperdesc, - GFP_KERNEL); - if (!purb) { - SAM("ERROR: usb_alloc_urb returned NULL for buffer " - "%i\n", k); - return -ENOMEM; - } - - peasycap->allocation_video_urb += 1; - pdata_urb = kzalloc(sizeof(struct data_urb), GFP_KERNEL); - if (!pdata_urb) { - SAM("ERROR: Could not allocate struct data_urb.\n"); - return -ENOMEM; - } - - peasycap->allocation_video_struct += - sizeof(struct data_urb); + rc = alloc_framebuffers(peasycap); + if (rc < 0) + return rc; - pdata_urb->purb = purb; - pdata_urb->isbuf = k; - pdata_urb->length = 0; - list_add_tail(&(pdata_urb->list_head), - peasycap->purb_video_head); + rc = alloc_fieldbuffers(peasycap); + if (rc < 0) + return rc; - /* Initialize allocated urbs */ - if (!k) { - JOM(4, "initializing video urbs thus:\n"); - JOM(4, " purb->interval = 1;\n"); - JOM(4, " purb->dev = peasycap->pusb_device;\n"); - JOM(4, " purb->pipe = usb_rcvisocpipe" - "(peasycap->pusb_device,%i);\n", - peasycap->video_endpointnumber); - JOM(4, " purb->transfer_flags = URB_ISO_ASAP;\n"); - JOM(4, " purb->transfer_buffer = peasycap->" - "video_isoc_buffer[.].pgo;\n"); - JOM(4, " purb->transfer_buffer_length = %i;\n", - peasycap->video_isoc_buffer_size); - JOM(4, " purb->complete = easycap_complete;\n"); - JOM(4, " purb->context = peasycap;\n"); - JOM(4, " purb->start_frame = 0;\n"); - JOM(4, " purb->number_of_packets = %i;\n", - peasycap->video_isoc_framesperdesc); - JOM(4, " for (j = 0; j < %i; j++)\n", - peasycap->video_isoc_framesperdesc); - JOM(4, " {\n"); - JOM(4, " purb->iso_frame_desc[j].offset = j*%i;\n", - peasycap->video_isoc_maxframesize); - JOM(4, " purb->iso_frame_desc[j].length = %i;\n", - peasycap->video_isoc_maxframesize); - JOM(4, " }\n"); - } + rc = alloc_isocbuffers(peasycap); + if (rc < 0) + return rc; - purb->interval = 1; - purb->dev = peasycap->pusb_device; - purb->pipe = usb_rcvisocpipe(peasycap->pusb_device, - peasycap->video_endpointnumber); - purb->transfer_flags = URB_ISO_ASAP; - purb->transfer_buffer = peasycap->video_isoc_buffer[k].pgo; - purb->transfer_buffer_length = - peasycap->video_isoc_buffer_size; - purb->complete = easycap_complete; - purb->context = peasycap; - purb->start_frame = 0; - purb->number_of_packets = peasycap->video_isoc_framesperdesc; - for (j = 0; j < peasycap->video_isoc_framesperdesc; j++) { - purb->iso_frame_desc[j].offset = j * - peasycap->video_isoc_maxframesize; - purb->iso_frame_desc[j].length = - peasycap->video_isoc_maxframesize; - } - } - JOM(4, "allocation of %i struct urb done.\n", k); + /* Allocate and initialize video urbs */ + rc = create_video_urbs(peasycap); + if (rc < 0) + return rc; /* Save pointer peasycap in this interface */ usb_set_intfdata(intf, peasycap); -- cgit v1.2.3-18-g5258 From f9482d01985b03633e39e1c772bd7d365ab82dc6 Mon Sep 17 00:00:00 2001 From: Ezequiel García Date: Fri, 24 Feb 2012 11:24:16 -0300 Subject: [media] staging: easycap: Push bInterfaceNumber saving to config_easycap() Signed-off-by: Ezequiel Garcia Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/easycap/easycap_main.c | 72 ++++++++++++++++------------ 1 file changed, 41 insertions(+), 31 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/easycap/easycap_main.c b/drivers/staging/media/easycap/easycap_main.c index 6d7cdef5880..9d6dc09656b 100644 --- a/drivers/staging/media/easycap/easycap_main.c +++ b/drivers/staging/media/easycap/easycap_main.c @@ -3242,6 +3242,44 @@ static int create_video_urbs(struct easycap *peasycap) return 0; } +static void config_easycap(struct easycap *peasycap, + u8 bInterfaceNumber, + u8 bInterfaceClass, + u8 bInterfaceSubClass) +{ + if ((USB_CLASS_VIDEO == bInterfaceClass) || + (USB_CLASS_VENDOR_SPEC == bInterfaceClass)) { + if (-1 == peasycap->video_interface) { + peasycap->video_interface = bInterfaceNumber; + JOM(4, "setting peasycap->video_interface=%i\n", + peasycap->video_interface); + } else { + if (peasycap->video_interface != bInterfaceNumber) { + SAM("ERROR: attempting to reset " + "peasycap->video_interface\n"); + SAM("...... continuing with " + "%i=peasycap->video_interface\n", + peasycap->video_interface); + } + } + } else if ((USB_CLASS_AUDIO == bInterfaceClass) && + (USB_SUBCLASS_AUDIOSTREAMING == bInterfaceSubClass)) { + if (-1 == peasycap->audio_interface) { + peasycap->audio_interface = bInterfaceNumber; + JOM(4, "setting peasycap->audio_interface=%i\n", + peasycap->audio_interface); + } else { + if (peasycap->audio_interface != bInterfaceNumber) { + SAM("ERROR: attempting to reset " + "peasycap->audio_interface\n"); + SAM("...... continuing with " + "%i=peasycap->audio_interface\n", + peasycap->audio_interface); + } + } + } +} + static const struct v4l2_file_operations v4l2_fops = { .owner = THIS_MODULE, .open = easycap_open_noinode, @@ -3340,37 +3378,9 @@ static int easycap_usb_probe(struct usb_interface *intf, return -ENODEV; } - if ((USB_CLASS_VIDEO == bInterfaceClass) || - (USB_CLASS_VENDOR_SPEC == bInterfaceClass)) { - if (-1 == peasycap->video_interface) { - peasycap->video_interface = bInterfaceNumber; - JOM(4, "setting peasycap->video_interface=%i\n", - peasycap->video_interface); - } else { - if (peasycap->video_interface != bInterfaceNumber) { - SAM("ERROR: attempting to reset " - "peasycap->video_interface\n"); - SAM("...... continuing with " - "%i=peasycap->video_interface\n", - peasycap->video_interface); - } - } - } else if ((USB_CLASS_AUDIO == bInterfaceClass) && - (USB_SUBCLASS_AUDIOSTREAMING == bInterfaceSubClass)) { - if (-1 == peasycap->audio_interface) { - peasycap->audio_interface = bInterfaceNumber; - JOM(4, "setting peasycap->audio_interface=%i\n", - peasycap->audio_interface); - } else { - if (peasycap->audio_interface != bInterfaceNumber) { - SAM("ERROR: attempting to reset " - "peasycap->audio_interface\n"); - SAM("...... continuing with " - "%i=peasycap->audio_interface\n", - peasycap->audio_interface); - } - } - } + config_easycap(peasycap, bInterfaceNumber, + bInterfaceClass, + bInterfaceSubClass); /* * Investigate all altsettings. This is done in detail -- cgit v1.2.3-18-g5258 From 751869e6ef489e33c66a254fa004c92e76ef1a43 Mon Sep 17 00:00:00 2001 From: Ezequiel García Date: Fri, 24 Feb 2012 11:24:17 -0300 Subject: [media] staging: easycap: Initialize 'ntsc' parameter before usage This parameter is now initialized at init_easycap(), this way we assure it won't be used uninitialized. Signed-off-by: Ezequiel Garcia Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/easycap/easycap_main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/easycap/easycap_main.c b/drivers/staging/media/easycap/easycap_main.c index 9d6dc09656b..480164d8698 100644 --- a/drivers/staging/media/easycap/easycap_main.c +++ b/drivers/staging/media/easycap/easycap_main.c @@ -2960,6 +2960,10 @@ static void init_easycap(struct easycap *peasycap, peasycap->audio_isoc_buffer_size = -1; peasycap->frame_buffer_many = FRAME_BUFFER_MANY; + + peasycap->ntsc = easycap_ntsc; + JOM(8, "defaulting initially to %s\n", + easycap_ntsc ? "NTSC" : "PAL"); } static int populate_inputset(struct easycap *peasycap) @@ -2972,7 +2976,6 @@ static int populate_inputset(struct easycap *peasycap) inputset = peasycap->inputset; - /* FIXME: peasycap->ntsc is not yet initialized */ fmtidx = peasycap->ntsc ? NTSC_M : PAL_BGHIN; m = 0; @@ -3650,9 +3653,6 @@ static int easycap_usb_probe(struct usb_interface *intf, * because some udev rules triggers easycap_open() * immediately after registration, causing a clash. */ - peasycap->ntsc = easycap_ntsc; - JOM(8, "defaulting initially to %s\n", - easycap_ntsc ? "NTSC" : "PAL"); rc = reset(peasycap); if (rc) { SAM("ERROR: reset() rc = %i\n", rc); -- cgit v1.2.3-18-g5258 From 217d55f2ba0511a18f7427c4a0c10ea21c2eb7d0 Mon Sep 17 00:00:00 2001 From: Ezequiel García Date: Fri, 24 Feb 2012 11:24:18 -0300 Subject: [media] staging: easycap: Push video registration to easycap_register_video() Signed-off-by: Ezequiel Garcia Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/easycap/easycap_main.c | 58 ++++++++++++++++------------ 1 file changed, 33 insertions(+), 25 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/easycap/easycap_main.c b/drivers/staging/media/easycap/easycap_main.c index 480164d8698..68af1a2297b 100644 --- a/drivers/staging/media/easycap/easycap_main.c +++ b/drivers/staging/media/easycap/easycap_main.c @@ -3291,6 +3291,37 @@ static const struct v4l2_file_operations v4l2_fops = { .mmap = easycap_mmap, }; +static int easycap_register_video(struct easycap *peasycap) +{ + /* + * FIXME: This is believed to be harmless, + * but may well be unnecessary or wrong. + */ + peasycap->video_device.v4l2_dev = NULL; + + strcpy(&peasycap->video_device.name[0], "easycapdc60"); + peasycap->video_device.fops = &v4l2_fops; + peasycap->video_device.minor = -1; + peasycap->video_device.release = (void *)(&videodev_release); + + video_set_drvdata(&(peasycap->video_device), (void *)peasycap); + + if (0 != (video_register_device(&(peasycap->video_device), + VFL_TYPE_GRABBER, -1))) { + err("Not able to register with videodev"); + videodev_release(&(peasycap->video_device)); + return -ENODEV; + } + + peasycap->registered_video++; + + SAM("registered with videodev: %i=minor\n", + peasycap->video_device.minor); + peasycap->minor = peasycap->video_device.minor; + + return 0; +} + /* * When the device is plugged, this function is called three times, * one for each interface. @@ -3667,32 +3698,9 @@ static int easycap_usb_probe(struct usb_interface *intf, JOM(4, "registered device instance: %s\n", peasycap->v4l2_device.name); - /* - * FIXME: This is believed to be harmless, - * but may well be unnecessary or wrong. - */ - peasycap->video_device.v4l2_dev = NULL; - - - strcpy(&peasycap->video_device.name[0], "easycapdc60"); - peasycap->video_device.fops = &v4l2_fops; - peasycap->video_device.minor = -1; - peasycap->video_device.release = (void *)(&videodev_release); - - video_set_drvdata(&(peasycap->video_device), (void *)peasycap); - - if (0 != (video_register_device(&(peasycap->video_device), - VFL_TYPE_GRABBER, -1))) { - err("Not able to register with videodev"); - videodev_release(&(peasycap->video_device)); + rc = easycap_register_video(peasycap); + if (rc < 0) return -ENODEV; - } - - peasycap->registered_video++; - SAM("registered with videodev: %i=minor\n", - peasycap->video_device.minor); - peasycap->minor = peasycap->video_device.minor; - break; } /* 1: Audio control */ -- cgit v1.2.3-18-g5258 From de6ffc5e5a4ce0c4f078eaa2189bc906e8963d11 Mon Sep 17 00:00:00 2001 From: Ezequiel García Date: Fri, 24 Feb 2012 11:24:19 -0300 Subject: [media] staging: easycap: Split audio buffer and urb allocation When the device is probed, this driver allocates audio buffers, and audio urbs. This patch just split this into separate functions, which helps clearing the currently gigantic probe function. Signed-off-by: Ezequiel Garcia Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/easycap/easycap_main.c | 229 +++++++++++++++------------ 1 file changed, 124 insertions(+), 105 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/easycap/easycap_main.c b/drivers/staging/media/easycap/easycap_main.c index 68af1a2297b..6e1734d8d27 100644 --- a/drivers/staging/media/easycap/easycap_main.c +++ b/drivers/staging/media/easycap/easycap_main.c @@ -3245,6 +3245,123 @@ static int create_video_urbs(struct easycap *peasycap) return 0; } +static int alloc_audio_buffers(struct easycap *peasycap) +{ + void *pbuf; + int k; + + JOM(4, "allocating %i isoc audio buffers of size %i\n", + AUDIO_ISOC_BUFFER_MANY, + peasycap->audio_isoc_buffer_size); + JOM(4, ".... each occupying contiguous memory pages\n"); + + for (k = 0; k < AUDIO_ISOC_BUFFER_MANY; k++) { + pbuf = (void *)__get_free_pages(GFP_KERNEL, AUDIO_ISOC_ORDER); + if (!pbuf) { + SAM("ERROR: Could not allocate isoc audio buffer %i\n", + k); + return -ENOMEM; + } + peasycap->allocation_audio_page += BIT(AUDIO_ISOC_ORDER); + + peasycap->audio_isoc_buffer[k].pgo = pbuf; + peasycap->audio_isoc_buffer[k].pto = + pbuf + peasycap->audio_isoc_buffer_size; + peasycap->audio_isoc_buffer[k].kount = k; + } + + JOM(4, "allocation of isoc audio buffers done.\n"); + return 0; +} + +static int create_audio_urbs(struct easycap *peasycap) +{ + struct urb *purb; + struct data_urb *pdata_urb; + int k, j; + + JOM(4, "allocating %i struct urb.\n", AUDIO_ISOC_BUFFER_MANY); + JOM(4, "using %i=peasycap->audio_isoc_framesperdesc\n", + peasycap->audio_isoc_framesperdesc); + JOM(4, "using %i=peasycap->audio_isoc_maxframesize\n", + peasycap->audio_isoc_maxframesize); + JOM(4, "using %i=peasycap->audio_isoc_buffer_size\n", + peasycap->audio_isoc_buffer_size); + + for (k = 0; k < AUDIO_ISOC_BUFFER_MANY; k++) { + purb = usb_alloc_urb(peasycap->audio_isoc_framesperdesc, + GFP_KERNEL); + if (!purb) { + SAM("ERROR: usb_alloc_urb returned NULL for buffer " + "%i\n", k); + return -ENOMEM; + } + peasycap->allocation_audio_urb += 1 ; + pdata_urb = kzalloc(sizeof(struct data_urb), GFP_KERNEL); + if (!pdata_urb) { + usb_free_urb(purb); + SAM("ERROR: Could not allocate struct data_urb.\n"); + return -ENOMEM; + } + peasycap->allocation_audio_struct += + sizeof(struct data_urb); + + pdata_urb->purb = purb; + pdata_urb->isbuf = k; + pdata_urb->length = 0; + list_add_tail(&(pdata_urb->list_head), + peasycap->purb_audio_head); + + if (!k) { + JOM(4, "initializing audio urbs thus:\n"); + JOM(4, " purb->interval = 1;\n"); + JOM(4, " purb->dev = peasycap->pusb_device;\n"); + JOM(4, " purb->pipe = usb_rcvisocpipe(peasycap->" + "pusb_device,%i);\n", + peasycap->audio_endpointnumber); + JOM(4, " purb->transfer_flags = URB_ISO_ASAP;\n"); + JOM(4, " purb->transfer_buffer = " + "peasycap->audio_isoc_buffer[.].pgo;\n"); + JOM(4, " purb->transfer_buffer_length = %i;\n", + peasycap->audio_isoc_buffer_size); + JOM(4, " purb->complete = easycap_alsa_complete;\n"); + JOM(4, " purb->context = peasycap;\n"); + JOM(4, " purb->start_frame = 0;\n"); + JOM(4, " purb->number_of_packets = %i;\n", + peasycap->audio_isoc_framesperdesc); + JOM(4, " for (j = 0; j < %i; j++)\n", + peasycap->audio_isoc_framesperdesc); + JOM(4, " {\n"); + JOM(4, " purb->iso_frame_desc[j].offset = j*%i;\n", + peasycap->audio_isoc_maxframesize); + JOM(4, " purb->iso_frame_desc[j].length = %i;\n", + peasycap->audio_isoc_maxframesize); + JOM(4, " }\n"); + } + + purb->interval = 1; + purb->dev = peasycap->pusb_device; + purb->pipe = usb_rcvisocpipe(peasycap->pusb_device, + peasycap->audio_endpointnumber); + purb->transfer_flags = URB_ISO_ASAP; + purb->transfer_buffer = peasycap->audio_isoc_buffer[k].pgo; + purb->transfer_buffer_length = + peasycap->audio_isoc_buffer_size; + purb->complete = easycap_alsa_complete; + purb->context = peasycap; + purb->start_frame = 0; + purb->number_of_packets = peasycap->audio_isoc_framesperdesc; + for (j = 0; j < peasycap->audio_isoc_framesperdesc; j++) { + purb->iso_frame_desc[j].offset = + j * peasycap->audio_isoc_maxframesize; + purb->iso_frame_desc[j].length = + peasycap->audio_isoc_maxframesize; + } + } + JOM(4, "allocation of %i struct urb done.\n", k); + return 0; +} + static void config_easycap(struct easycap *peasycap, u8 bInterfaceNumber, u8 bInterfaceClass, @@ -3333,14 +3450,11 @@ static int easycap_usb_probe(struct usb_interface *intf, struct usb_host_interface *alt; struct usb_endpoint_descriptor *ep; struct usb_interface_descriptor *interface; - struct urb *purb; struct easycap *peasycap; - struct data_urb *pdata_urb; - int i, j, k, rc; + int i, j, rc; u8 bInterfaceNumber; u8 bInterfaceClass; u8 bInterfaceSubClass; - void *pbuf; int okalt[8], isokalt; int okepn[8]; int okmps[8]; @@ -3823,109 +3937,14 @@ static int easycap_usb_probe(struct usb_interface *intf, INIT_LIST_HEAD(&(peasycap->urb_audio_head)); peasycap->purb_audio_head = &(peasycap->urb_audio_head); - JOM(4, "allocating %i isoc audio buffers of size %i\n", - AUDIO_ISOC_BUFFER_MANY, - peasycap->audio_isoc_buffer_size); - JOM(4, ".... each occupying contiguous memory pages\n"); - - for (k = 0; k < AUDIO_ISOC_BUFFER_MANY; k++) { - pbuf = (void *)__get_free_pages(GFP_KERNEL, - AUDIO_ISOC_ORDER); - if (!pbuf) { - SAM("ERROR: Could not allocate isoc audio buffer " - "%i\n", k); - return -ENOMEM; - } - peasycap->allocation_audio_page += - BIT(AUDIO_ISOC_ORDER); - - peasycap->audio_isoc_buffer[k].pgo = pbuf; - peasycap->audio_isoc_buffer[k].pto = pbuf + - peasycap->audio_isoc_buffer_size; - peasycap->audio_isoc_buffer[k].kount = k; - } - JOM(4, "allocation of isoc audio buffers done.\n"); + alloc_audio_buffers(peasycap); + if (rc < 0) + return rc; /* Allocate and initialize urbs */ - JOM(4, "allocating %i struct urb.\n", AUDIO_ISOC_BUFFER_MANY); - JOM(4, "using %i=peasycap->audio_isoc_framesperdesc\n", - peasycap->audio_isoc_framesperdesc); - JOM(4, "using %i=peasycap->audio_isoc_maxframesize\n", - peasycap->audio_isoc_maxframesize); - JOM(4, "using %i=peasycap->audio_isoc_buffer_size\n", - peasycap->audio_isoc_buffer_size); - - for (k = 0; k < AUDIO_ISOC_BUFFER_MANY; k++) { - purb = usb_alloc_urb(peasycap->audio_isoc_framesperdesc, - GFP_KERNEL); - if (!purb) { - SAM("ERROR: usb_alloc_urb returned NULL for buffer " - "%i\n", k); - return -ENOMEM; - } - peasycap->allocation_audio_urb += 1 ; - pdata_urb = kzalloc(sizeof(struct data_urb), GFP_KERNEL); - if (!pdata_urb) { - usb_free_urb(purb); - SAM("ERROR: Could not allocate struct data_urb.\n"); - return -ENOMEM; - } - peasycap->allocation_audio_struct += - sizeof(struct data_urb); - - pdata_urb->purb = purb; - pdata_urb->isbuf = k; - pdata_urb->length = 0; - list_add_tail(&(pdata_urb->list_head), - peasycap->purb_audio_head); - - if (!k) { - JOM(4, "initializing audio urbs thus:\n"); - JOM(4, " purb->interval = 1;\n"); - JOM(4, " purb->dev = peasycap->pusb_device;\n"); - JOM(4, " purb->pipe = usb_rcvisocpipe(peasycap->" - "pusb_device,%i);\n", - peasycap->audio_endpointnumber); - JOM(4, " purb->transfer_flags = URB_ISO_ASAP;\n"); - JOM(4, " purb->transfer_buffer = " - "peasycap->audio_isoc_buffer[.].pgo;\n"); - JOM(4, " purb->transfer_buffer_length = %i;\n", - peasycap->audio_isoc_buffer_size); - JOM(4, " purb->complete = easycap_alsa_complete;\n"); - JOM(4, " purb->context = peasycap;\n"); - JOM(4, " purb->start_frame = 0;\n"); - JOM(4, " purb->number_of_packets = %i;\n", - peasycap->audio_isoc_framesperdesc); - JOM(4, " for (j = 0; j < %i; j++)\n", - peasycap->audio_isoc_framesperdesc); - JOM(4, " {\n"); - JOM(4, " purb->iso_frame_desc[j].offset = j*%i;\n", - peasycap->audio_isoc_maxframesize); - JOM(4, " purb->iso_frame_desc[j].length = %i;\n", - peasycap->audio_isoc_maxframesize); - JOM(4, " }\n"); - } - - purb->interval = 1; - purb->dev = peasycap->pusb_device; - purb->pipe = usb_rcvisocpipe(peasycap->pusb_device, - peasycap->audio_endpointnumber); - purb->transfer_flags = URB_ISO_ASAP; - purb->transfer_buffer = peasycap->audio_isoc_buffer[k].pgo; - purb->transfer_buffer_length = - peasycap->audio_isoc_buffer_size; - purb->complete = easycap_alsa_complete; - purb->context = peasycap; - purb->start_frame = 0; - purb->number_of_packets = peasycap->audio_isoc_framesperdesc; - for (j = 0; j < peasycap->audio_isoc_framesperdesc; j++) { - purb->iso_frame_desc[j].offset = j * - peasycap->audio_isoc_maxframesize; - purb->iso_frame_desc[j].length = - peasycap->audio_isoc_maxframesize; - } - } - JOM(4, "allocation of %i struct urb done.\n", k); + rc = create_audio_urbs(peasycap); + if (rc < 0) + return rc; /* Save pointer peasycap in this interface */ usb_set_intfdata(intf, peasycap); -- cgit v1.2.3-18-g5258 From cf32b65d0589cdbe9bc4cc7081f13ebbae11308c Mon Sep 17 00:00:00 2001 From: Ezequiel García Date: Fri, 24 Feb 2012 11:24:20 -0300 Subject: [media] staging: easycap: Clean comment style in easycap_usb_disconnect() Signed-off-by: Ezequiel Garcia Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/easycap/easycap_main.c | 64 +++++++++++----------------- 1 file changed, 24 insertions(+), 40 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/easycap/easycap_main.c b/drivers/staging/media/easycap/easycap_main.c index 6e1734d8d27..de53ed825f2 100644 --- a/drivers/staging/media/easycap/easycap_main.c +++ b/drivers/staging/media/easycap/easycap_main.c @@ -3973,15 +3973,13 @@ static int easycap_usb_probe(struct usb_interface *intf, SAM("ends successfully for interface %i\n", bInterfaceNumber); return 0; } -/*************************