From f41ced8f108cc80f16509b907cd7ac93944459bc Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Tue, 6 Jan 2009 14:40:40 -0800 Subject: Check fops_get() return value Several subsystem open handlers dereference the fops_get() return value without checking it for nullness. This opens a race condition between the open handler and module unloading. A module can be marked as being unloaded (MODULE_STATE_GOING) before its exit function is called and gets the chance to unregister the driver. During that window open handlers can still be called, and fops_get() will fail in try_module_get() and return a NULL pointer. This change checks the fops_get() return value and returns -ENODEV if NULL. Reported-by: Alan Jenkins Signed-off-by: Laurent Pinchart Acked-by: Takashi Iwai Cc: Al Viro Cc: Dave Airlie Acked-by: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/dvb/dvb-core/dvbdev.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'drivers/media') diff --git a/drivers/media/dvb/dvb-core/dvbdev.c b/drivers/media/dvb/dvb-core/dvbdev.c index 65d69665f1f..6a32680dbb1 100644 --- a/drivers/media/dvb/dvb-core/dvbdev.c +++ b/drivers/media/dvb/dvb-core/dvbdev.c @@ -79,6 +79,10 @@ static int dvb_device_open(struct inode *inode, struct file *file) file->private_data = dvbdev; old_fops = file->f_op; file->f_op = fops_get(dvbdev->fops); + if (file->f_op == NULL) { + file->f_op = old_fops; + goto fail; + } if(file->f_op->open) err = file->f_op->open(inode,file); if (err) { @@ -90,6 +94,7 @@ static int dvb_device_open(struct inode *inode, struct file *file) unlock_kernel(); return err; } +fail: up_read(&minor_rwsem); unlock_kernel(); return -ENODEV; -- cgit v1.2.3 From 5f820f648c92a5ecc771a96b3c29aa6e90013bba Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Tue, 6 Jan 2009 14:40:59 -0800 Subject: poll: allow f_op->poll to sleep f_op->poll is the only vfs operation which is not allowed to sleep. It's because poll and select implementation used task state to synchronize against wake ups, which doesn't have to be the case anymore as wait/wake interface can now use custom wake up functions. The non-sleep restriction can be a bit tricky because ->poll is not called from an atomic context and the result of accidentally sleeping in ->poll only shows up as temporary busy looping when the timing is right or rather wrong. This patch converts poll/select to use custom wake up function and use separate triggered variable to synchronize against wake up events. The only added overhead is an extra function call during wake up and negligible. This patch removes the one non-sleep exception from vfs locking rules and is beneficial to userland filesystem implementations like FUSE, 9p or peculiar fs like spufs as it's very difficult for those to implement non-sleeping poll method. While at it, make the following cosmetic changes to make poll.h and select.c checkpatch friendly. * s/type * symbol/type *symbol/ : three places in poll.h * remove blank line before EXPORT_SYMBOL() : two places in select.c Oleg: spotted missing barrier in poll_schedule_timeout() Davide: spotted missing write barrier in pollwake() Signed-off-by: Tejun Heo Cc: Eric Van Hensbergen Cc: Ron Minnich Cc: Ingo Molnar Cc: Christoph Hellwig Signed-off-by: Miklos Szeredi Cc: Davide Libenzi Cc: Brad Boyer Cc: Al Viro Cc: Roland McGrath Cc: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Cc: Davide Libenzi Cc: Oleg Nesterov Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/v4l1-compat.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers/media') diff --git a/drivers/media/video/v4l1-compat.c b/drivers/media/video/v4l1-compat.c index d450cab20be..b617bf05e2d 100644 --- a/drivers/media/video/v4l1-compat.c +++ b/drivers/media/video/v4l1-compat.c @@ -203,7 +203,6 @@ static int poll_one(struct file *file, struct poll_wqueues *pwq) table = &pwq->pt; for (;;) { int mask; - set_current_state(TASK_INTERRUPTIBLE); mask = file->f_op->poll(file, table); if (mask & POLLIN) break; @@ -212,9 +211,8 @@ static int poll_one(struct file *file, struct poll_wqueues *pwq) retval = -ERESTARTSYS; break; } - schedule(); + poll_schedule(pwq, TASK_INTERRUPTIBLE); } - set_current_state(TASK_RUNNING); poll_freewait(pwq); return retval; } -- cgit v1.2.3 From b305271861219f0ce162eb565f0f28f4c781299d Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 7 Jan 2009 14:29:17 +0100 Subject: i2c: Drop I2C_CLASS_CAM_DIGITAL There are a number of drivers which set their i2c bus class to I2C_CLASS_CAM_DIGITAL, however no chip driver actually checks for this flag, so we might as well drop it now. Signed-off-by: Jean Delvare --- drivers/media/video/cafe_ccic.c | 1 - drivers/media/video/ov7670.c | 1 - drivers/media/video/ovcamchip/ovcamchip_core.c | 1 - drivers/media/video/w9968cf.c | 1 - 4 files changed, 4 deletions(-) (limited to 'drivers/media') diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c index 34a39d2e470..46fd573a4f1 100644 --- a/drivers/media/video/cafe_ccic.c +++ b/drivers/media/video/cafe_ccic.c @@ -569,7 +569,6 @@ static int cafe_smbus_setup(struct cafe_camera *cam) cafe_smbus_enable_irq(cam); adap->id = I2C_HW_SMBUS_CAFE; - adap->class = I2C_CLASS_CAM_DIGITAL; adap->owner = THIS_MODULE; adap->client_register = cafe_smbus_attach; adap->client_unregister = cafe_smbus_detach; diff --git a/drivers/media/video/ov7670.c b/drivers/media/video/ov7670.c index ca26b0c50cf..05c14a29375 100644 --- a/drivers/media/video/ov7670.c +++ b/drivers/media/video/ov7670.c @@ -1347,7 +1347,6 @@ static struct i2c_driver ov7670_driver = { .name = "ov7670", }, .id = I2C_DRIVERID_OV7670, - .class = I2C_CLASS_CAM_DIGITAL, .attach_adapter = ov7670_attach, .detach_client = ov7670_detach, .command = ov7670_command, diff --git a/drivers/media/video/ovcamchip/ovcamchip_core.c b/drivers/media/video/ovcamchip/ovcamchip_core.c index 2c4acbf5a4f..c841f4e4fbe 100644 --- a/drivers/media/video/ovcamchip/ovcamchip_core.c +++ b/drivers/media/video/ovcamchip/ovcamchip_core.c @@ -405,7 +405,6 @@ static struct i2c_driver driver = { .name = "ovcamchip", }, .id = I2C_DRIVERID_OVCAMCHIP, - .class = I2C_CLASS_CAM_DIGITAL, .attach_adapter = ovcamchip_attach, .detach_client = ovcamchip_detach, .command = ovcamchip_command, diff --git a/drivers/media/video/w9968cf.c b/drivers/media/video/w9968cf.c index a3997b7d436..105a832531f 100644 --- a/drivers/media/video/w9968cf.c +++ b/drivers/media/video/w9968cf.c @@ -1553,7 +1553,6 @@ static int w9968cf_i2c_init(struct w9968cf_device* cam) static struct i2c_adapter adap = { .id = I2C_HW_SMBUS_W9968CF, - .class = I2C_CLASS_CAM_DIGITAL, .owner = THIS_MODULE, .client_register = w9968cf_i2c_attach_inform, .client_unregister = w9968cf_i2c_detach_inform, -- cgit v1.2.3 From 011b15df465745474e3ec85482633685933ed5a7 Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Tue, 4 Nov 2008 11:29:27 -0500 Subject: USB: change interface to usb_lock_device_for_reset() This patch (as1161) changes the interface to usb_lock_device_for_reset(). The existing interface is apparently not very clear, judging from the fact that several of its callers don't use it correctly. The new interface always returns 0 for success and it always requires the caller to unlock the device afterward. The new routine will not return immediately if it is called while the driver's probe method is running. Instead it will wait until the probe is over and the device has been unlocked. This shouldn't cause any problems; I don't know of any cases where drivers call usb_lock_device_for_reset() during probe. Signed-off-by: Alan Stern Cc: Pete Zaitcev Signed-off-by: Greg Kroah-Hartman --- drivers/media/video/pvrusb2/pvrusb2-hdw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/media') diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c index 8fb92ac78c7..fa304e5f252 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c @@ -3655,7 +3655,7 @@ void pvr2_hdw_device_reset(struct pvr2_hdw *hdw) int ret; pvr2_trace(PVR2_TRACE_INIT,"Performing a device reset..."); ret = usb_lock_device_for_reset(hdw->usb_dev,NULL); - if (ret == 1) { + if (ret == 0) { ret = usb_reset_device(hdw->usb_dev); usb_unlock_device(hdw->usb_dev); } else { -- cgit v1.2.3 From 9b4778f680aa79d838ae2be6ab958938f744ce5f Mon Sep 17 00:00:00 2001 From: Harvey Harrison Date: Wed, 7 Jan 2009 14:42:41 -0800 Subject: trivial: replace last usages of __FUNCTION__ in kernel __FUNCTION__ is gcc-specific, use __func__ Signed-off-by: Harvey Harrison Acked-by: Mauro Carvalho Chehab Signed-off-by: Linus Torvalds --- drivers/media/dvb/frontends/lgdt3304.c | 10 +++++----- drivers/media/dvb/frontends/s921_module.c | 2 +- drivers/media/dvb/ttpci/budget-ci.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'drivers/media') diff --git a/drivers/media/dvb/frontends/lgdt3304.c b/drivers/media/dvb/frontends/lgdt3304.c index 469ace5692c..3bb0c4394f8 100644 --- a/drivers/media/dvb/frontends/lgdt3304.c +++ b/drivers/media/dvb/frontends/lgdt3304.c @@ -42,7 +42,7 @@ static int i2c_write_demod_bytes (struct dvb_frontend *fe, __u8 *buf, int len) for (i=0; ii2c, &i2cmsgs, 1))<0) { - printk("%s i2c_transfer error %d\n", __FUNCTION__, err); + printk("%s i2c_transfer error %d\n", __func__, err); if (err < 0) return err; else @@ -73,7 +73,7 @@ static int lgdt3304_i2c_read_reg(struct dvb_frontend *fe, unsigned int reg) i2cmsgs[1].buf = &buf; if((ret = i2c_transfer(state->i2c, i2cmsgs, 2))<0) { - printk("%s i2c_transfer error %d\n", __FUNCTION__, ret); + printk("%s i2c_transfer error %d\n", __func__, ret); return ret; } @@ -94,7 +94,7 @@ static int lgdt3304_i2c_write_reg(struct dvb_frontend *fe, int reg, int val) }; ret = i2c_transfer(state->i2c, &i2cmsgs, 1); if (ret != 1) { - printk("%s i2c_transfer error %d\n", __FUNCTION__, ret); + printk("%s i2c_transfer error %d\n", __func__, ret); return ret; } @@ -238,7 +238,7 @@ static int lgdt3304_set_parameters(struct dvb_frontend *fe, struct dvb_frontend_ } if (err) { - printk("%s error setting modulation\n", __FUNCTION__); + printk("%s error setting modulation\n", __func__); } else { state->current_modulation = param->u.vsb.modulation; } @@ -305,7 +305,7 @@ static int lgdt3304_read_status(struct dvb_frontend *fe, fe_status_t *status) } break; default: - printk("%s unhandled modulation\n", __FUNCTION__); + printk("%s unhandled modulation\n", __func__); } diff --git a/drivers/media/dvb/frontends/s921_module.c b/drivers/media/dvb/frontends/s921_module.c index 3cbb9cb2cf4..892af8c9ed5 100644 --- a/drivers/media/dvb/frontends/s921_module.c +++ b/drivers/media/dvb/frontends/s921_module.c @@ -136,7 +136,7 @@ static int s921_write(void *dev, u8 reg, u8 val) { }; if((err = i2c_transfer(state->i2c, &i2cmsgs, 1))<0) { - printk("%s i2c_transfer error %d\n", __FUNCTION__, err); + printk("%s i2c_transfer error %d\n", __func__, err); if (err < 0) return err; else diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c index 3507463fdac..4d2a5cf27c3 100644 --- a/drivers/media/dvb/ttpci/budget-ci.c +++ b/drivers/media/dvb/ttpci/budget-ci.c @@ -1450,7 +1450,7 @@ static void frontend_init(struct budget_ci *budget_ci) if (budget_ci->budget.dvb_frontend) { if (dvb_attach(stb6100_attach, budget_ci->budget.dvb_frontend, &tt3200_stb6100_config, &budget_ci->budget.i2c_adap)) { if (!dvb_attach(lnbp21_attach, budget_ci->budget.dvb_frontend, &budget_ci->budget.i2c_adap, 0, 0)) { - printk("%s: No LNBP21 found!\n", __FUNCTION__); + printk("%s: No LNBP21 found!\n", __func__); dvb_frontend_detach(budget_ci->budget.dvb_frontend); budget_ci->budget.dvb_frontend = NULL; } -- cgit v1.2.3 From c0cd5010e54e52931c321ee66d81d10a8e2a9ff6 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Sat, 3 Jan 2009 18:20:04 -0300 Subject: V4L/DVB (10176a): Switch remaining clear_user_page users over to clear_user_highpage Not all architectures provide clear_user_page(), but clear_user_highpage() is available everywhere at least via the compatibility inline function. Is this the "trivial patch" that's required for these two drivers? Signed-off-by: Guennadi Liakhovetski Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/videobuf-dma-sg.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/media') diff --git a/drivers/media/video/videobuf-dma-sg.c b/drivers/media/video/videobuf-dma-sg.c index bc6d5aba0fe..da1790e57a8 100644 --- a/drivers/media/video/videobuf-dma-sg.c +++ b/drivers/media/video/videobuf-dma-sg.c @@ -388,8 +388,7 @@ videobuf_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf) page = alloc_page(GFP_USER | __GFP_DMA32); if (!page) return VM_FAULT_OOM; - clear_user_page(page_address(page), (unsigned long)vmf->virtual_address, - page); + clear_user_highpage(page, (unsigned long)vmf->virtual_address); vmf->page = page; return 0; } -- cgit v1.2.3 From cfbaf4dfe765ae33e1a26b3eb0eda64ff00fc481 Mon Sep 17 00:00:00 2001 From: Eric Miao Date: Fri, 2 Jan 2009 12:16:02 -0300 Subject: V4L/DVB (10176b): pxa-camera: fix redefinition warnings and missing DMA definitions 1. now pxa_camera.c uses ioremap() for register access, pxa_camera.h is totally useless. Remove it. 2. does no longer include , include the latter file explicitly delete mode 100644 drivers/media/video/pxa_camera.h Signed-off-by: Eric Miao Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/pxa_camera.c | 4 +- drivers/media/video/pxa_camera.h | 95 ---------------------------------------- 2 files changed, 1 insertion(+), 98 deletions(-) delete mode 100644 drivers/media/video/pxa_camera.h (limited to 'drivers/media') diff --git a/drivers/media/video/pxa_camera.c b/drivers/media/video/pxa_camera.c index 9d33de22cc4..a1d6008efcb 100644 --- a/drivers/media/video/pxa_camera.c +++ b/drivers/media/video/pxa_camera.c @@ -34,12 +34,10 @@ #include -#include +#include #include #include -#include "pxa_camera.h" - #define PXA_CAM_VERSION_CODE KERNEL_VERSION(0, 0, 5) #define PXA_CAM_DRV_NAME "pxa27x-camera" diff --git a/drivers/media/video/pxa_camera.h b/drivers/media/video/pxa_camera.h deleted file mode 100644 index 89cbfc9a35c..00000000000 --- a/drivers/media/video/pxa_camera.h +++ /dev/null @@ -1,95 +0,0 @@ -/* Camera Interface */ -#define CICR0 __REG(0x50000000) -#define CICR1 __REG(0x50000004) -#define CICR2 __REG(0x50000008) -#define CICR3 __REG(0x5000000C) -#define CICR4 __REG(0x50000010) -#define CISR __REG(0x50000014) -#define CIFR __REG(0x50000018) -#define CITOR __REG(0x5000001C) -#define CIBR0 __REG(0x50000028) -#define CIBR1 __REG(0x50000030) -#define CIBR2 __REG(0x50000038) - -#define CICR0_DMAEN (1 << 31) /* DMA request enable */ -#define CICR0_PAR_EN (1 << 30) /* Parity enable */ -#define CICR0_SL_CAP_EN (1 << 29) /* Capture enable for slave mode */ -#define CICR0_ENB (1 << 28) /* Camera interface enable */ -#define CICR0_DIS (1 << 27) /* Camera interface disable */ -#define CICR0_SIM (0x7 << 24) /* Sensor interface mode mask */ -#define CICR0_TOM (1 << 9) /* Time-out mask */ -#define CICR0_RDAVM (1 << 8) /* Receive-data-available mask */ -#define CICR0_FEM (1 << 7) /* FIFO-empty mask */ -#define CICR0_EOLM (1 << 6) /* End-of-line mask */ -#define CICR0_PERRM (1 << 5) /* Parity-error mask */ -#define CICR0_QDM (1 << 4) /* Quick-disable mask */ -#define CICR0_CDM (1 << 3) /* Disable-done mask */ -#define CICR0_SOFM (1 << 2) /* Start-of-frame mask */ -#define CICR0_EOFM (1 << 1) /* End-of-frame mask */ -#define CICR0_FOM (1 << 0) /* FIFO-overrun mask */ - -#define CICR1_TBIT (1 << 31) /* Transparency bit */ -#define CICR1_RGBT_CONV (0x3 << 29) /* RGBT conversion mask */ -#define CICR1_PPL (0x7ff << 15) /* Pixels per line mask */ -#define CICR1_RGB_CONV (0x7 << 12) /* RGB conversion mask */ -#define CICR1_RGB_F (1 << 11) /* RGB format */ -#define CICR1_YCBCR_F (1 << 10) /* YCbCr format */ -#define CICR1_RGB_BPP (0x7 << 7) /* RGB bis per pixel mask */ -#define CICR1_RAW_BPP (0x3 << 5) /* Raw bis per pixel mask */ -#define CICR1_COLOR_SP (0x3 << 3) /* Color space mask */ -#define CICR1_DW (0x7 << 0) /* Data width mask */ - -#define CICR2_BLW (0xff << 24) /* Beginning-of-line pixel clock - wait count mask */ -#define CICR2_ELW (0xff << 16) /* End-of-line pixel clock - wait count mask */ -#define CICR2_HSW (0x3f << 10) /* Horizontal sync pulse width mask */ -#define CICR2_BFPW (0x3f << 3) /* Beginning-of-frame pixel clock - wait count mask */ -#define CICR2_FSW (0x7 << 0) /* Frame stabilization - wait count mask */ - -#define CICR3_BFW (0xff << 24) /* Beginning-of-frame line clock - wait count mask */ -#define CICR3_EFW (0xff << 16) /* End-of-frame line clock - wait count mask */ -#define CICR3_VSW (0x3f << 10) /* Vertical sync pulse width mask */ -#define CICR3_BFPW (0x3f << 3) /* Beginning-of-frame pixel clock - wait count mask */ -#define CICR3_LPF (0x7ff << 0) /* Lines per frame mask */ - -#define CICR4_MCLK_DLY (0x3 << 24) /* MCLK Data Capture Delay mask */ -#define CICR4_PCLK_EN (1 << 23) /* Pixel clock enable */ -#define CICR4_PCP (1 << 22) /* Pixel clock polarity */ -#define CICR4_HSP (1 << 21) /* Horizontal sync polarity */ -#define CICR4_VSP (1 << 20) /* Vertical sync polarity */ -#define CICR4_MCLK_EN (1 << 19) /* MCLK enable */ -#define CICR4_FR_RATE (0x7 << 8) /* Frame rate mask */ -#define CICR4_DIV (0xff << 0) /* Clock divisor mask */ - -#define CISR_FTO (1 << 15) /* FIFO time-out */ -#define CISR_RDAV_2 (1 << 14) /* Channel 2 receive data available */ -#define CISR_RDAV_1 (1 << 13) /* Channel 1 receive data available */ -#define CISR_RDAV_0 (1 << 12) /* Channel 0 receive data available */ -#define CISR_FEMPTY_2 (1 << 11) /* Channel 2 FIFO empty */ -#define CISR_FEMPTY_1 (1 << 10) /* Channel 1 FIFO empty */ -#define CISR_FEMPTY_0 (1 << 9) /* Channel 0 FIFO empty */ -#define CISR_EOL (1 << 8) /* End of line */ -#define CISR_PAR_ERR (1 << 7) /* Parity error */ -#define CISR_CQD (1 << 6) /* Camera interface quick disable */ -#define CISR_CDD (1 << 5) /* Camera interface disable done */ -#define CISR_SOF (1 << 4) /* Start of frame */ -#define CISR_EOF (1 << 3) /* End of frame */ -#define CISR_IFO_2 (1 << 2) /* FIFO overrun for Channel 2 */ -#define CISR_IFO_1 (1 << 1) /* FIFO overrun for Channel 1 */ -#define CISR_IFO_0 (1 << 0) /* FIFO overrun for Channel 0 */ - -#define CIFR_FLVL2 (0x7f << 23) /* FIFO 2 level mask */ -#define CIFR_FLVL1 (0x7f << 16) /* FIFO 1 level mask */ -#define CIFR_FLVL0 (0xff << 8) /* FIFO 0 level mask */ -#define CIFR_THL_0 (0x3 << 4) /* Threshold Level for Channel 0 FIFO */ -#define CIFR_RESET_F (1 << 3) /* Reset input FIFOs */ -#define CIFR_FEN2 (1 << 2) /* FIFO enable for channel 2 */ -#define CIFR_FEN1 (1 << 1) /* FIFO enable for channel 1 */ -#define CIFR_FEN0 (1 << 0) /* FIFO enable for channel 0 */ - -- cgit v1.2.3 From 26cdc76b2c0b24f7a9c33ab226ca6e4bbae3dbbb Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 5 Jan 2009 01:00:40 -0300 Subject: V4L/DVB (10177): Fix sparse warnings on em28xx /home/v4l/master/v4l/em28xx-core.c:396:25: warning: symbol 'outputs' was not declared. Should it be static? /home/v4l/master/v4l/em28xx-input.c:324:6: warning: symbol 'em28xx_ir_start' was not declared. Should it be static? /home/v4l/master/v4l/em28xx-cards.c:1925:5: warning: symbol 'em28xx_init_dev' was not declared. Should it be static? Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/em28xx/em28xx-cards.c | 2 +- drivers/media/video/em28xx/em28xx-core.c | 2 +- drivers/media/video/em28xx/em28xx-input.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/media') diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index e776699b62f..6d2e4a6f8b2 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c @@ -1842,7 +1842,7 @@ void em28xx_release_resources(struct em28xx *dev) * em28xx_init_dev() * allocates and inits the device structs, registers i2c bus and v4l device */ -int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, +static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, int minor) { struct em28xx *dev = *devhandle; diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index 819cceaa6ef..eb5fb05fab2 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c @@ -393,7 +393,7 @@ static int em28xx_set_audio_source(struct em28xx *dev) return ret; } -struct em28xx_vol_table outputs[] = { +static const struct em28xx_vol_table outputs[] = { { EM28XX_AOUT_MASTER, AC97_MASTER_VOL }, { EM28XX_AOUT_LINE, AC97_LINE_LEVEL_VOL }, { EM28XX_AOUT_MONO, AC97_MASTER_MONO_VOL }, diff --git a/drivers/media/video/em28xx/em28xx-input.c b/drivers/media/video/em28xx/em28xx-input.c index 42bbaf64ace..0443afe09ff 100644 --- a/drivers/media/video/em28xx/em28xx-input.c +++ b/drivers/media/video/em28xx/em28xx-input.c @@ -307,7 +307,7 @@ static void em28xx_ir_work(struct work_struct *work) mod_timer(&ir->timer, jiffies + msecs_to_jiffies(ir->polling)); } -void em28xx_ir_start(struct em28xx_IR *ir) +static void em28xx_ir_start(struct em28xx_IR *ir) { setup_timer(&ir->timer, ir_timer, (unsigned long)ir); INIT_WORK(&ir->work, em28xx_ir_work); -- cgit v1.2.3 From 072ce0c50983033d35c63314e2be849568f116c2 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 5 Jan 2009 01:19:06 -0300 Subject: V4L/DVB (10178): dvb_frontend: Fix some sparse warnings due to static symbols /home/v4l/master/v4l/dvb_frontend.c:838:19: warning: symbol 'dtv_cmds' was not declared. Should it be static? /home/v4l/master/v4l/dvb_frontend.c:1035:6: warning: symbol 'dtv_property_dump' was not declared. Should it be static? /home/v4l/master/v4l/dvb_frontend.c:1066:5: warning: symbol 'is_legacy_delivery_system' was not declared. Should it be static? /home/v4l/master/v4l/dvb_frontend.c:1080:6: warning: symbol 'dtv_property_cache_sync' was not declared. Should it be static? /home/v4l/master/v4l/dvb_frontend.c:1132:6: warning: symbol 'dtv_property_legacy_params_sync' was not declared. Should it be static? /home/v4l/master/v4l/dvb_frontend.c:1187:6: warning: symbol 'dtv_property_adv_params_sync' was not declared. Should it be static? /home/v4l/master/v4l/dvb_frontend.c:1222:6: warning: symbol 'dtv_property_cache_submit' was not declared. Should it be static? /home/v4l/master/v4l/dvb_frontend.c:1253:5: warning: symbol 'dtv_property_process_get' was not declared. Should it be static? /home/v4l/master/v4l/dvb_frontend.c:1362:5: warning: symbol 'dtv_property_process_set' was not declared. Should it be static? Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-core/dvb_frontend.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'drivers/media') diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c index 171f9ca124f..84340778508 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c @@ -824,7 +824,7 @@ static int dvb_frontend_check_parameters(struct dvb_frontend *fe, return 0; } -struct dtv_cmds_h dtv_cmds[] = { +static struct dtv_cmds_h dtv_cmds[] = { [DTV_TUNE] = { .name = "DTV_TUNE", .cmd = DTV_TUNE, @@ -962,7 +962,7 @@ struct dtv_cmds_h dtv_cmds[] = { }, }; -void dtv_property_dump(struct dtv_property *tvp) +static void dtv_property_dump(struct dtv_property *tvp) { int i; @@ -993,7 +993,7 @@ void dtv_property_dump(struct dtv_property *tvp) dprintk("%s() tvp.u.data = 0x%08x\n", __func__, tvp->u.data); } -int is_legacy_delivery_system(fe_delivery_system_t s) +static int is_legacy_delivery_system(fe_delivery_system_t s) { if((s == SYS_UNDEFINED) || (s == SYS_DVBC_ANNEX_AC) || (s == SYS_DVBC_ANNEX_B) || (s == SYS_DVBT) || (s == SYS_DVBS) || @@ -1007,7 +1007,8 @@ int is_legacy_delivery_system(fe_delivery_system_t s) * drivers can use a single set_frontend tuning function, regardless of whether * it's being used for the legacy or new API, reducing code and complexity. */ -void dtv_property_cache_sync(struct dvb_frontend *fe, struct dvb_frontend_parameters *p) +static void dtv_property_cache_sync(struct dvb_frontend *fe, + struct dvb_frontend_parameters *p) { struct dtv_frontend_properties *c = &fe->dtv_property_cache; @@ -1059,7 +1060,7 @@ void dtv_property_cache_sync(struct dvb_frontend *fe, struct dvb_frontend_parame /* Ensure the cached values are set correctly in the frontend * legacy tuning structures, for the advanced tuning API. */ -void dtv_property_legacy_params_sync(struct dvb_frontend *fe) +static void dtv_property_legacy_params_sync(struct dvb_frontend *fe) { struct dtv_frontend_properties *c = &fe->dtv_property_cache; struct dvb_frontend_private *fepriv = fe->frontend_priv; @@ -1114,7 +1115,7 @@ void dtv_property_legacy_params_sync(struct dvb_frontend *fe) /* Ensure the cached values are set correctly in the frontend * legacy tuning structures, for the legacy tuning API. */ -void dtv_property_adv_params_sync(struct dvb_frontend *fe) +static void dtv_property_adv_params_sync(struct dvb_frontend *fe) { struct dtv_frontend_properties *c = &fe->dtv_property_cache; struct dvb_frontend_private *fepriv = fe->frontend_priv; @@ -1149,7 +1150,7 @@ void dtv_property_adv_params_sync(struct dvb_frontend *fe) } } -void dtv_property_cache_submit(struct dvb_frontend *fe) +static void dtv_property_cache_submit(struct dvb_frontend *fe) { struct dtv_frontend_properties *c = &fe->dtv_property_cache; @@ -1180,8 +1181,9 @@ static int dvb_frontend_ioctl_legacy(struct inode *inode, struct file *file, static int dvb_frontend_ioctl_properties(struct inode *inode, struct file *file, unsigned int cmd, void *parg); -int dtv_property_process_get(struct dvb_frontend *fe, struct dtv_property *tvp, - struct inode *inode, struct file *file) +static int dtv_property_process_get(struct dvb_frontend *fe, + struct dtv_property *tvp, + struct inode *inode, struct file *file) { int r = 0; @@ -1253,8 +1255,10 @@ int dtv_property_process_get(struct dvb_frontend *fe, struct dtv_property *tvp, return r; } -int dtv_property_process_set(struct dvb_frontend *fe, struct dtv_property *tvp, - struct inode *inode, struct file *file) +static int dtv_property_process_set(struct dvb_frontend *fe, + struct dtv_property *tvp, + struct inode *inode, + struct file *file) { int r = 0; struct dvb_frontend_private *fepriv = fe->frontend_priv; -- cgit v1.2.3 From 4c27f1a4da4902c70b84a8bce66f8fe909fb829b Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 5 Jan 2009 01:23:50 -0300 Subject: V4L/DVB (10179): tda8290: Fix two sparse warnings /home/v4l/master/v4l/tda8290.c:233:7: warning: symbol 'i' shadows an earlier one /home/v4l/master/v4l/tda8290.c:178:3: warning: symbol 'fm_mode' was not declared. Should it be static? Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/tda8290.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/media') diff --git a/drivers/media/common/tuners/tda8290.c b/drivers/media/common/tuners/tda8290.c index 0ee79fd7c7a..0e7f77f93e0 100644 --- a/drivers/media/common/tuners/tda8290.c +++ b/drivers/media/common/tuners/tda8290.c @@ -150,7 +150,7 @@ static void set_audio(struct dvb_frontend *fe, } } -struct { +static struct { unsigned char seq[2]; } fm_mode[] = { { { 0x01, 0x81} }, /* Put device into expert mode */ @@ -207,7 +207,6 @@ static void tda8290_set_params(struct dvb_frontend *fe, msleep(1); if (params->mode == V4L2_TUNER_RADIO) { - int i; unsigned char deemphasis[] = { 0x13, 1 }; /* FIXME: allow using a different deemphasis */ -- cgit v1.2.3 From ffbc5f88148ff77039a4269e3f945e8471b2e0bb Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 5 Jan 2009 01:34:20 -0300 Subject: V4L/DVB (10180): drivers/media: Fix a number of sparse warnings anysee.c:44:5: warning: symbol 'dvb_usb_anysee_delsys' was not declared. Should it be static? cx24116.c:378:3: warning: symbol 'CX24116_MODFEC_MODES' was not declared. Should it be static? stb0899_algo.c:57:5: warning: symbol 'stb0899_get_srate' was not declared. Should it be static? stb0899_algo.c:766:6: warning: symbol 'Log2Int' was not declared. Should it be static? stb0899_drv.c:137:20: warning: symbol 'stb0899_quant_tab' was not declared. Should it be static? stb0899_drv.c:180:20: warning: symbol 'stb0899_est_tab' was not declared. Should it be static? stb0899_drv.c:220:5: warning: symbol '_stb0899_read_reg' was not declared. Should it be static? budget-ci.c:1348:23: warning: symbol 'tt3200_stb6100_config' was not declared. Should it be static? /home/v4l/master/v4l/cx25840-core.c:190:6: warning: symbol 'cx25840_work_handler' was not declared. Should it be static? /home/v4l/master/v4l/m5602_s5k83a.c:116:6: warning: symbol 's5k83a_dump_registers' was not declared. Should it be static? Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-usb/anysee.c | 2 +- drivers/media/dvb/frontends/cx24116.c | 2 +- drivers/media/dvb/frontends/stb0899_algo.c | 4 ++-- drivers/media/dvb/frontends/stb0899_drv.c | 6 +++--- drivers/media/dvb/ttpci/budget-ci.c | 2 +- drivers/media/video/gspca/m5602/m5602_s5k83a.c | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) (limited to 'drivers/media') diff --git a/drivers/media/dvb/dvb-usb/anysee.c b/drivers/media/dvb/dvb-usb/anysee.c index 5017f08b14a..c6e7b4215d6 100644 --- a/drivers/media/dvb/dvb-usb/anysee.c +++ b/drivers/media/dvb/dvb-usb/anysee.c @@ -41,7 +41,7 @@ static int dvb_usb_anysee_debug; module_param_named(debug, dvb_usb_anysee_debug, int, 0644); MODULE_PARM_DESC(debug, "set debugging level" DVB_USB_DEBUG_STATUS); -int dvb_usb_anysee_delsys; +static int dvb_usb_anysee_delsys; module_param_named(delsys, dvb_usb_anysee_delsys, int, 0644); MODULE_PARM_DESC(delsys, "select delivery mode (0=DVB-C, 1=DVB-T)"); DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); diff --git a/drivers/media/dvb/frontends/cx24116.c b/drivers/media/dvb/frontends/cx24116.c index 4f514d39b98..28ad609e73f 100644 --- a/drivers/media/dvb/frontends/cx24116.c +++ b/drivers/media/dvb/frontends/cx24116.c @@ -369,7 +369,7 @@ static int cx24116_set_inversion(struct cx24116_state *state, * Not all S2 mmodulation schemes are support and not all rates with * a scheme are support. Especially, no auto detect when in S2 mode. */ -struct cx24116_modfec { +static struct cx24116_modfec { fe_delivery_system_t delivery_system; fe_modulation_t modulation; fe_code_rate_t fec; diff --git a/drivers/media/dvb/frontends/stb0899_algo.c b/drivers/media/dvb/frontends/stb0899_algo.c index ced9b7ae7d5..83dc7e12d5f 100644 --- a/drivers/media/dvb/frontends/stb0899_algo.c +++ b/drivers/media/dvb/frontends/stb0899_algo.c @@ -54,7 +54,7 @@ static u32 stb0899_calc_srate(u32 master_clk, u8 *sfr) * stb0899_get_srate * Get the current symbol rate */ -u32 stb0899_get_srate(struct stb0899_state *state) +static u32 stb0899_get_srate(struct stb0899_state *state) { struct stb0899_internal *internal = &state->internal; u8 sfr[3]; @@ -763,7 +763,7 @@ static void stb0899_dvbs2_config_csm_auto(struct stb0899_state *state) stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_CSM_CNTRL1, STB0899_OFF0_CSM_CNTRL1, reg); } -long Log2Int(int number) +static long Log2Int(int number) { int i; diff --git a/drivers/media/dvb/frontends/stb0899_drv.c b/drivers/media/dvb/frontends/stb0899_drv.c index bee28f77b93..10613acf18f 100644 --- a/drivers/media/dvb/frontends/stb0899_drv.c +++ b/drivers/media/dvb/frontends/stb0899_drv.c @@ -134,7 +134,7 @@ static const struct stb0899_tab stb0899_dvbs2rf_tab[] = { }; /* DVB-S2 Es/N0 quant in dB/100 vs read value * 100*/ -struct stb0899_tab stb0899_quant_tab[] = { +static struct stb0899_tab stb0899_quant_tab[] = { { 0, 0 }, { 0, 100 }, { 600, 200 }, @@ -177,7 +177,7 @@ struct stb0899_tab stb0899_quant_tab[] = { }; /* DVB-S2 Es/N0 estimate in dB/100 vs read value */ -struct stb0899_tab stb0899_est_tab[] = { +static struct stb0899_tab stb0899_est_tab[] = { { 0, 0 }, { 0, 1 }, { 301, 2 }, @@ -217,7 +217,7 @@ struct stb0899_tab stb0899_est_tab[] = { { 5721, 526017 }, }; -int _stb0899_read_reg(struct stb0899_state *state, unsigned int reg) +static int _stb0899_read_reg(struct stb0899_state *state, unsigned int reg) { int ret; diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c index 3507463fdac..16ef35afd33 100644 --- a/drivers/media/dvb/ttpci/budget-ci.c +++ b/drivers/media/dvb/ttpci/budget-ci.c @@ -1337,7 +1337,7 @@ static struct stb0899_config tt3200_config = { .tuner_set_rfsiggain = NULL }; -struct stb6100_config tt3200_stb6100_config = { +static struct stb6100_config tt3200_stb6100_config = { .tuner_address = 0x60, .refclock = 27000000, }; diff --git a/drivers/media/video/gspca/m5602/m5602_s5k83a.c b/drivers/media/video/gspca/m5602/m5602_s5k83a.c index af3f2dc2c70..ccea4a75846 100644 --- a/drivers/media/video/gspca/m5602/m5602_s5k83a.c +++ b/drivers/media/video/gspca/m5602/m5602_s5k83a.c @@ -113,7 +113,7 @@ int s5k83a_power_down(struct sd *sd) return 0; } -void s5k83a_dump_registers(struct sd *sd) +static void s5k83a_dump_registers(struct sd *sd) { int address; u8 page, old_page; -- cgit v1.2.3 From 432663375b04ed9700ea7d3c8e737432d1be6490 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 5 Jan 2009 01:42:38 -0300 Subject: V4L/DVB (10181): v4l2-device: Fix some sparse warnings /home/v4l/master/v4l/v4l2-device.c:32:2: warning: Using plain integer as NULL pointer /home/v4l/master/v4l/v4l2-device.c:64:2: warning: Using plain integer as NULL pointer Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/v4l2-device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/media') diff --git a/drivers/media/video/v4l2-device.c b/drivers/media/video/v4l2-device.c index 9eefde03159..cf9d4c7f571 100644 --- a/drivers/media/video/v4l2-device.c +++ b/drivers/media/video/v4l2-device.c @@ -29,7 +29,7 @@ int v4l2_device_register(struct device *dev, struct v4l2_device *v4l2_dev) if (dev == NULL || v4l2_dev == NULL) return -EINVAL; /* Warn if we apparently re-register a device */ - WARN_ON(dev_get_drvdata(dev)); + WARN_ON(dev_get_drvdata(dev) != NULL); INIT_LIST_HEAD(&v4l2_dev->subdevs); spin_lock_init(&v4l2_dev->lock); v4l2_dev->dev = dev; @@ -61,7 +61,7 @@ int v4l2_device_register_subdev(struct v4l2_device *dev, struct v4l2_subdev *sd) if (dev == NULL || sd == NULL || !sd->name[0]) return -EINVAL; /* Warn if we apparently re-register a subdev */ - WARN_ON(sd->dev); + WARN_ON(sd->dev != NULL); if (!try_module_get(sd->owner)) return -ENODEV; sd->dev = dev; -- cgit v1.2.3 From 439b72b69e4992e9ec34b74304f0fa95623934eb Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Mon, 5 Jan 2009 18:25:04 -0300 Subject: V4L/DVB (10182): tda8290: fix TDA8290 + TDA18271 initialization Don't call tda8290_init_tuner unless we have either a TDA8275 or TDA8275A present. Calling this function will cause a TDA18271 to get sick, so we should only call it when needed. Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/tda8290.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/media') diff --git a/drivers/media/common/tuners/tda8290.c b/drivers/media/common/tuners/tda8290.c index 0e7f77f93e0..4b8662edb7c 100644 --- a/drivers/media/common/tuners/tda8290.c +++ b/drivers/media/common/tuners/tda8290.c @@ -766,7 +766,8 @@ struct dvb_frontend *tda829x_attach(struct dvb_frontend *fe, fe->ops.analog_ops.info.name = name; if (priv->ver & TDA8290) { - tda8290_init_tuner(fe); + if (priv->ver & (TDA8275 | TDA8275A)) + tda8290_init_tuner(fe); tda8290_init_if(fe); } else if (priv->ver & TDA8295) tda8295_init_if(fe); -- cgit v1.2.3 From 2230c3c803a5f3a84f7c3bd86b8159a551edc8ca Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sat, 3 Jan 2009 16:53:10 -0300 Subject: V4L/DVB (10185): Use negated usb_endpoint_xfer_control, etc This patch extends 134179823b3ca9c8b98e0631906459dbb022ff9b by using usb_endpoint_xfer_control, usb_endpoint_xfer_isoc, usb_endpoint_xfer_bulk, and usb_endpoint_xfer_int in the negated case as well. The semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // @@ struct usb_endpoint_descriptor *epd; @@ - (usb_endpoint_type(epd) != \(USB_ENDPOINT_XFER_CONTROL\|0\)) + !usb_endpoint_xfer_control(epd) @@ struct usb_endpoint_descriptor *epd; @@ - (usb_endpoint_type(epd) != \(USB_ENDPOINT_XFER_ISOC\|1\)) + !usb_endpoint_xfer_isoc(epd) @@ struct usb_endpoint_descriptor *epd; @@ - (usb_endpoint_type(epd) != \(USB_ENDPOINT_XFER_BULK\|2\)) + !usb_endpoint_xfer_bulk(epd) @@ struct usb_endpoint_descriptor *epd; @@ - (usb_endpoint_type(epd) != \(USB_ENDPOINT_XFER_INT\|3\)) + !usb_endpoint_xfer_int(epd) // Signed-off-by: Julia Lawall Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/em28xx/em28xx-cards.c | 3 +-- drivers/media/video/usbvideo/ibmcam.c | 2 +- drivers/media/video/usbvideo/konicawc.c | 2 +- drivers/media/video/usbvideo/ultracam.c | 2 +- drivers/media/video/usbvision/usbvision-video.c | 3 +-- 5 files changed, 5 insertions(+), 7 deletions(-) (limited to 'drivers/media') diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index 6d2e4a6f8b2..ef9bf008a92 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c @@ -1990,8 +1990,7 @@ static int em28xx_usb_probe(struct usb_interface *interface, int check_interface = 1; isoc_pipe = 1; endpoint = &interface->cur_altsetting->endpoint[1].desc; - if (usb_endpoint_type(endpoint) != - USB_ENDPOINT_XFER_ISOC) + if (!usb_endpoint_xfer_isoc(endpoint)) check_interface = 0; if (usb_endpoint_dir_out(endpoint)) diff --git a/drivers/media/video/usbvideo/ibmcam.c b/drivers/media/video/usbvideo/ibmcam.c index f8d85ddb480..b0854966178 100644 --- a/drivers/media/video/usbvideo/ibmcam.c +++ b/drivers/media/video/usbvideo/ibmcam.c @@ -3779,7 +3779,7 @@ static int ibmcam_probe(struct usb_interface *intf, const struct usb_device_id * err("Alternate settings have different endpoint addresses!"); return -ENODEV; } - if (usb_endpoint_type(endpoint) != USB_ENDPOINT_XFER_ISOC) { + if (!usb_endpoint_xfer_isoc(endpoint)) { err("Interface %d. has non-ISO endpoint!", ifnum); return -ENODEV; } diff --git a/drivers/media/video/usbvideo/konicawc.c b/drivers/media/video/usbvideo/konicawc.c index 90f0ce6a26b..900ec2129ca 100644 --- a/drivers/media/video/usbvideo/konicawc.c +++ b/drivers/media/video/usbvideo/konicawc.c @@ -823,7 +823,7 @@ static int konicawc_probe(struct usb_interface *intf, const struct usb_device_id err("Alternate settings have different endpoint addresses!"); return -ENODEV; } - if (usb_endpoint_type(endpoint) != USB_ENDPOINT_XFER_ISOC) { + if (!usb_endpoint_xfer_isoc(endpoint)) { err("Interface %d. has non-ISO endpoint!", interface->desc.bInterfaceNumber); return -ENODEV; diff --git a/drivers/media/video/usbvideo/ultracam.c b/drivers/media/video/usbvideo/ultracam.c index 839a08240c2..fbd1b639229 100644 --- a/drivers/media/video/usbvideo/ultracam.c +++ b/drivers/media/video/usbvideo/ultracam.c @@ -556,7 +556,7 @@ static int ultracam_probe(struct usb_interface *intf, const struct usb_device_id err("Alternate settings have different endpoint addresses!"); return -ENODEV; } - if (usb_endpoint_type(endpoint) != USB_ENDPOINT_XFER_ISOC) { + if (!usb_endpoint_xfer_isoc(endpoint)) { err("Interface %d. has non-ISO endpoint!", interface->desc.bInterfaceNumber); return -ENODEV; diff --git a/drivers/media/video/usbvision/usbvision-video.c b/drivers/media/video/usbvision/usbvision-video.c index 2be5e47ed08..2622de003a4 100644 --- a/drivers/media/video/usbvision/usbvision-video.c +++ b/drivers/media/video/usbvision/usbvision-video.c @@ -1674,8 +1674,7 @@ static int __devinit usbvision_probe(struct usb_interface *intf, interface = &dev->actconfig->interface[ifnum]->altsetting[0]; } endpoint = &interface->endpoint[1].desc; - if (usb_endpoint_type(endpoint) != - USB_ENDPOINT_XFER_ISOC) { + if (!usb_endpoint_xfer_isoc(endpoint)) { err("%s: interface %d. has non-ISO endpoint!", __func__, ifnum); err("%s: Endpoint attributes %d", -- cgit v1.2.3 From 571d864c68d429a82fd61e97404a2de210ffc72d Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 6 Jan 2009 08:33:46 -0300 Subject: V4L/DVB (10189): dm1105: Fix build with INPUT=m and DVB_DM1105=y As reported by Randy Dunlap : With CONFIG_INPUT=m and CONFIG_DVB_DM1105=y: drivers/built-in.o: In function `input_sync': dm1105.c:(.text+0x120c33): undefined reference to `input_event' drivers/built-in.o: In function `dm1105_emit_key': dm1105.c:(.text+0x120c6c): undefined reference to `input_event' dm1105.c:(.text+0x120c82): undefined reference to `input_event' dm1105.c:(.text+0x120cb2): undefined reference to `input_event' dm1105.c:(.text+0x120cd1): undefined reference to `input_event' drivers/built-in.o: In function `dm1105_ir_init': (.devinit.text+0xd8ae): undefined reference to `input_allocate_device' drivers/built-in.o: In function `dm1105_ir_init': (.devinit.text+0xd9f6): undefined reference to `input_register_device' drivers/built-in.o: In function `dm1105_ir_init': (.devinit.text+0xda09): undefined reference to `input_free_device' drivers/built-in.o: In function `dm1105_ir_exit': (.devexit.text+0xcde): undefined reference to `input_unregister_device' This is due to the lack of a dependency between dm1105 and CONFIG_INPUT Cc: Igor M. Liplianin Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dm1105/Kconfig | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/media') diff --git a/drivers/media/dvb/dm1105/Kconfig b/drivers/media/dvb/dm1105/Kconfig index 1332301ef3a..43f4d44edca 100644 --- a/drivers/media/dvb/dm1105/Kconfig +++ b/drivers/media/dvb/dm1105/Kconfig @@ -1,6 +1,7 @@ config DVB_DM1105 tristate "SDMC DM1105 based PCI cards" depends on DVB_CORE && PCI && I2C + depends on INPUT select DVB_PLL if !DVB_FE_CUSTOMISE select DVB_STV0299 if !DVB_FE_CUSTOMISE select DVB_STV0288 if !DVB_FE_CUSTOMISE -- cgit v1.2.3 From e32fadc4c2e5975a8e40541e2ba72a7032ed4cf4 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 6 Jan 2009 16:06:07 -0300 Subject: V4L/DVB (10190): cx88: Fix some Kbuild troubles As Randy Dunlap reported, cx88 has some compilation issues: drivers/built-in.o: In function `cx88_call_i2c_clients': (.text+0x20af17): undefined reference to `videobuf_dvb_get_frontend' drivers/built-in.o: In function `cx8802_probe': cx88-mpeg.c:(.devinit.text+0x268c4): undefined reference to `videobuf_dvb_alloc_frontend' cx88-mpeg.c:(.devinit.text+0x268ea): undefined reference to `videobuf_dvb_dealloc_frontends' With those configs: CONFIG_VIDEO_CX88=y CONFIG_VIDEO_CX88_BLACKBIRD=y CONFIG_VIDEO_CX88_DVB=m CONFIG_DVB_CORE=m After carefully examining the code, with the current code, several cx88 drivers (cx8800, cx8802, cx88_dvb and cx88_blackbird) should be compiled as a module, if one of them is marked as such. Just fixing Kconfig could create a very complex set of rules. Also, this hides a problem with the current approach where the dvb functionality weren't confined inside dvb module. What happens is that: - cx88-i2c (part of cx8800) has some special rules if DVB; - cx88-mpeg (cx8802 module) has also part of DVB init code; - cx88-dvb has the rest of the dvb code; - cx88-blackbird can be used with cx88-mpeg, having cx88-dvb or not. So, instead of doing some tricks at Kconfig and wait for a next breakage, this patch moves the dvb code inside cx88-i2c and cx88-mpeg into cx88-dvb. Another problem is that cx8802 were being compiled, even without cx88-dvb and cx88-blackbird modules. While on this code, let's fix also a reported problem: http://www.linuxtv.org/pipermail/linux-dvb/2009-January/031225.html A solution for the issue were proposed here: http://www.mail-archive.com/linux-media@vger.kernel.org/msg00021.html Thanks to Randy, Andy, Gregoire and Thomas for helping us to detect and solve the issues. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/cx88/Kconfig | 5 ++++ drivers/media/video/cx88/Makefile | 3 ++- drivers/media/video/cx88/cx88-dvb.c | 46 ++++++++++++++++++++++++++++++++++++ drivers/media/video/cx88/cx88-i2c.c | 24 ++++--------------- drivers/media/video/cx88/cx88-mpeg.c | 30 ++++------------------- drivers/media/video/cx88/cx88.h | 4 +++- 6 files changed, 65 insertions(+), 47 deletions(-) (limited to 'drivers/media') diff --git a/drivers/media/video/cx88/Kconfig b/drivers/media/video/cx88/Kconfig index b0f837588e0..2d250a2a7bc 100644 --- a/drivers/media/video/cx88/Kconfig +++ b/drivers/media/video/cx88/Kconfig @@ -69,6 +69,11 @@ config VIDEO_CX88_DVB To compile this driver as a module, choose M here: the module will be called cx88-dvb. +config VIDEO_CX88_MPEG + tristate + depends on VIDEO_CX88_DVB || VIDEO_CX88_BLACKBIRD + default y + config VIDEO_CX88_VP3054 tristate "VP-3054 Secondary I2C Bus Support" default m diff --git a/drivers/media/video/cx88/Makefile b/drivers/media/video/cx88/Makefile index 6ec30f24257..b06b1275a9e 100644 --- a/drivers/media/video/cx88/Makefile +++ b/drivers/media/video/cx88/Makefile @@ -3,7 +3,8 @@ cx88xx-objs := cx88-cards.o cx88-core.o cx88-i2c.o cx88-tvaudio.o \ cx8800-objs := cx88-video.o cx88-vbi.o cx8802-objs := cx88-mpeg.o -obj-$(CONFIG_VIDEO_CX88) += cx88xx.o cx8800.o cx8802.o +obj-$(CONFIG_VIDEO_CX88) += cx88xx.o cx8800.o +obj-$(CONFIG_VIDEO_CX88_MPEG) += cx8802.o obj-$(CONFIG_VIDEO_CX88_ALSA) += cx88-alsa.o obj-$(CONFIG_VIDEO_CX88_BLACKBIRD) += cx88-blackbird.o obj-$(CONFIG_VIDEO_CX88_DVB) += cx88-dvb.o diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c index da4dd4913d9..613dfea4ff3 100644 --- a/drivers/media/video/cx88/cx88-dvb.c +++ b/drivers/media/video/cx88/cx88-dvb.c @@ -138,6 +138,28 @@ static int cx88_dvb_bus_ctrl(struct dvb_frontend* fe, int acquire) return ret; } +static void cx88_dvb_gate_ctrl(struct cx88_core *core, int open) +{ + struct videobuf_dvb_frontends *f; + struct videobuf_dvb_frontend *fe; + + if (!core->dvbdev) + return; + + f = &core->dvbdev->frontends; + + if (!f) + return; + + if (f->gate <= 1) /* undefined or fe0 */ + fe = videobuf_dvb_get_frontend(f, 1); + else + fe = videobuf_dvb_get_frontend(f, f->gate); + + if (fe && fe->dvb.frontend && fe->dvb.frontend->ops.i2c_gate_ctrl) + fe->dvb.frontend->ops.i2c_gate_ctrl(fe->dvb.frontend, open); +} + /* ------------------------------------------------------------------ */ static int dvico_fusionhdtv_demod_init(struct dvb_frontend* fe) @@ -597,12 +619,30 @@ static int dvb_register(struct cx8802_dev *dev) struct cx88_core *core = dev->core; struct videobuf_dvb_frontend *fe0, *fe1 = NULL; int mfe_shared = 0; /* bus not shared by default */ + int i; if (0 != core->i2c_rc) { printk(KERN_ERR "%s/2: no i2c-bus available, cannot attach dvb drivers\n", core->name); goto frontend_detach; } + if (!core->board.num_frontends) + return -EINVAL; + + mutex_init(&dev->frontends.lock); + INIT_LIST_HEAD(&dev->frontends.felist); + + printk(KERN_INFO "%s() allocating %d frontend(s)\n", __func__, + core->board.num_frontends); + for (i = 1; i <= core->board.num_frontends; i++) { + fe0 = videobuf_dvb_alloc_frontend(&dev->frontends, i); + if (!fe0) { + printk(KERN_ERR "%s() failed to alloc\n", __func__); + videobuf_dvb_dealloc_frontends(&dev->frontends); + goto frontend_detach; + } + } + /* Get the first frontend */ fe0 = videobuf_dvb_get_frontend(&dev->frontends, 1); if (!fe0) @@ -611,6 +651,9 @@ static int dvb_register(struct cx8802_dev *dev) /* multi-frontend gate control is undefined or defaults to fe0 */ dev->frontends.gate = 0; + /* Sets the gate control callback to be used by i2c command calls */ + core->gate_ctrl = cx88_dvb_gate_ctrl; + /* init frontend(s) */ switch (core->boardnr) { case CX88_BOARD_HAUPPAUGE_DVB_T1: @@ -1109,6 +1152,7 @@ static int dvb_register(struct cx8802_dev *dev) &dev->pci->dev, adapter_nr, mfe_shared); frontend_detach: + core->gate_ctrl = NULL; videobuf_dvb_dealloc_frontends(&dev->frontends); return -EINVAL; } @@ -1270,6 +1314,8 @@ static int cx8802_dvb_remove(struct cx8802_driver *drv) vp3054_i2c_remove(dev); + core->gate_ctrl = NULL; + return 0; } diff --git a/drivers/media/video/cx88/cx88-i2c.c b/drivers/media/video/cx88/cx88-i2c.c index 1ab691d2069..c0ff2305d80 100644 --- a/drivers/media/video/cx88/cx88-i2c.c +++ b/drivers/media/video/cx88/cx88-i2c.c @@ -116,30 +116,16 @@ static int detach_inform(struct i2c_client *client) void cx88_call_i2c_clients(struct cx88_core *core, unsigned int cmd, void *arg) { -#if defined(CONFIG_VIDEO_CX88_DVB) || defined(CONFIG_VIDEO_CX88_DVB_MODULE) - struct videobuf_dvb_frontends *f = &core->dvbdev->frontends; - struct videobuf_dvb_frontend *fe = NULL; -#endif if (0 != core->i2c_rc) return; -#if defined(CONFIG_VIDEO_CX88_DVB) || defined(CONFIG_VIDEO_CX88_DVB_MODULE) - if (core->dvbdev && f) { - if(f->gate <= 1) /* undefined or fe0 */ - fe = videobuf_dvb_get_frontend(f, 1); - else - fe = videobuf_dvb_get_frontend(f, f->gate); + if (core->gate_ctrl) + core->gate_ctrl(core, 1); - if (fe && fe->dvb.frontend && fe->dvb.frontend->ops.i2c_gate_ctrl) - fe->dvb.frontend->ops.i2c_gate_ctrl(fe->dvb.frontend, 1); + i2c_clients_command(&core->i2c_adap, cmd, arg); - i2c_clients_command(&core->i2c_adap, cmd, arg); - - if (fe && fe->dvb.frontend && fe->dvb.frontend->ops.i2c_gate_ctrl) - fe->dvb.frontend->ops.i2c_gate_ctrl(fe->dvb.frontend, 0); - } else -#endif - i2c_clients_command(&core->i2c_adap, cmd, arg); + if (core->gate_ctrl) + core->gate_ctrl(core, 0); } static const struct i2c_algo_bit_data cx8800_i2c_algo_template = { diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c index 59164fc94f5..b295b76737e 100644 --- a/drivers/media/video/cx88/cx88-mpeg.c +++ b/drivers/media/video/cx88/cx88-mpeg.c @@ -787,6 +787,9 @@ static int __devinit cx8802_probe(struct pci_dev *pci_dev, dev->pci = pci_dev; dev->core = core; + /* Maintain a reference so cx88-video can query the 8802 device. */ + core->dvbdev = dev; + err = cx8802_init_common(dev); if (err != 0) goto fail_free; @@ -794,32 +797,6 @@ static int __devinit cx8802_probe(struct pci_dev *pci_dev, INIT_LIST_HEAD(&dev->drvlist); list_add_tail(&dev->devlist,&cx8802_devlist); -#if defined(CONFIG_VIDEO_CX88_DVB) || defined(CONFIG_VIDEO_CX88_DVB_MODULE) - mutex_init(&dev->frontends.lock); - INIT_LIST_HEAD(&dev->frontends.felist); - - if (core->board.num_frontends) { - struct videobuf_dvb_frontend *fe; - int i; - - printk(KERN_INFO "%s() allocating %d frontend(s)\n", __func__, - core->board.num_frontends); - for (i = 1; i <= core->board.num_frontends; i++) { - fe = videobuf_dvb_alloc_frontend(&dev->frontends, i); - if(fe == NULL) { - printk(KERN_ERR "%s() failed to alloc\n", - __func__); - videobuf_dvb_dealloc_frontends(&dev->frontends); - err = -ENOMEM; - goto fail_free; - } - } - } -#endif - - /* Maintain a reference so cx88-video can query the 8802 device. */ - core->dvbdev = dev; - /* now autoload cx88-dvb or cx88-blackbird */ request_modules(dev); return 0; @@ -827,6 +804,7 @@ static int __devinit cx8802_probe(struct pci_dev *pci_dev, fail_free: kfree(dev); fail_core: + core->dvbdev = NULL; cx88_core_put(core,pci_dev); return err; } diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h index eb9ce30dc5e..60a8b3187f1 100644 --- a/drivers/media/video/cx88/cx88.h +++ b/drivers/media/video/cx88/cx88.h @@ -302,6 +302,7 @@ struct cx88_dmaqueue { struct btcx_riscmem stopper; u32 count; }; +struct cx88_core; struct cx88_core { struct list_head devlist; @@ -334,7 +335,8 @@ struct cx88_core { /* config info -- dvb */ #if defined(CONFIG_VIDEO_CX88_DVB) || defined(CONFIG_VIDEO_CX88_DVB_MODULE) - int (*prev_set_voltage)(struct dvb_frontend* fe, fe_sec_voltage_t voltage); + int (*prev_set_voltage)(struct dvb_frontend *fe, fe_sec_voltage_t voltage); + void (*gate_ctrl)(struct cx88_core *core, int open); #endif /* state info */ -- cgit v1.2.3