Merge branch 'master' of ssh://master.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb

* 'master' of ssh://master.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb:
V4L/DVB (5880): wm8775/wm8739: Fix memory leak when unloading module
V4L/DVB (5877): radio-gemtek-pci: remove unused structure member
V4L/DVB (5871): Conexant 2388x: check for kthread_run
V4L/DVB (5869): Add check for valid control ID to v4l2_ctrl_next.
V4L/DVB (5867): videodev2.h: add missing <sys/time.h> for userspace
V4L/DVB (5866): ivtv: fix DMA timeout when capturing VBI + another stream
V4L/DVB (5865): Remove usage of HZ on ivtv driver, replacing by msecs_to_jiffies
V4L/DVB (5861): Use msecs_to_jiffies instead of HZ on bttv, cx88 and saa7134
V4L/DVB (5860): Use msecs_to_jiffies instead of HZ on some webcam drivers
V4L/DVB (5859): use msecs_to_jiffies on InfraRed RC5 timeout
V4L/DVB (5858): Use msecs_to_jiffies instead of HZ on media/video I2C drivers
V4L/DVB (5857): Use msecs_to_jiffies instead of HZ on radio drivers
V4L/DVB (5855): ivtv: fix Kconfig typo and refer to the driver homepage.
V4L/DVB (5854): ivtv: cleanup of driver messages
V4L/DVB (5853): ivtv: add support to suppress high volume i2c debug messages.
V4L/DVB (5852): ivtv: don't recompile needlessly
V4L/DVB (5851): ivtv: fix missing I2C_ALGOBIT config option
V4L/DVB (5850): ivtv: improve API command debugging
V4L/DVB (5848): Av7110: fix typo

+134 -108
+2 -2
drivers/media/common/ir-functions.c
··· 345 345 } 346 346 347 347 /* Set/reset key-up timer */ 348 - timeout = current_jiffies + (500 + ir->rc5_key_timeout 349 - * HZ) / 1000; 348 + timeout = current_jiffies + 349 + msecs_to_jiffies(ir->rc5_key_timeout); 350 350 mod_timer(&ir->timer_keyup, timeout); 351 351 352 352 /* Save code for repeat test */
+1 -1
drivers/media/dvb/ttpci/av7110.c
··· 2267 2267 FE_FUNC_OVERRIDE(av7110->fe->ops.diseqc_send_master_cmd, av7110->fe_diseqc_send_master_cmd, av7110_fe_diseqc_send_master_cmd); 2268 2268 FE_FUNC_OVERRIDE(av7110->fe->ops.diseqc_send_burst, av7110->fe_diseqc_send_burst, av7110_fe_diseqc_send_burst); 2269 2269 FE_FUNC_OVERRIDE(av7110->fe->ops.set_tone, av7110->fe_set_tone, av7110_fe_set_tone); 2270 - FE_FUNC_OVERRIDE(av7110->fe->ops.set_voltage, av7110->fe_set_voltage, av7110_fe_set_voltage;) 2270 + FE_FUNC_OVERRIDE(av7110->fe->ops.set_voltage, av7110->fe_set_voltage, av7110_fe_set_voltage); 2271 2271 FE_FUNC_OVERRIDE(av7110->fe->ops.dishnetwork_send_legacy_command, av7110->fe_dishnetwork_send_legacy_command, av7110_fe_dishnetwork_send_legacy_command); 2272 2272 FE_FUNC_OVERRIDE(av7110->fe->ops.set_frontend, av7110->fe_set_frontend, av7110_fe_set_frontend); 2273 2273
+1 -1
drivers/media/radio/radio-aimslab.c
··· 63 63 static void sleep_delay(long n) 64 64 { 65 65 /* Sleep nicely for 'n' uS */ 66 - int d=n/(1000000/HZ); 66 + int d=n/msecs_to_jiffies(1000); 67 67 if(!d) 68 68 udelay(n); 69 69 else
+2 -2
drivers/media/radio/radio-cadet.c
··· 329 329 init_timer(&readtimer); 330 330 readtimer.function=cadet_handler; 331 331 readtimer.data=(unsigned long)0; 332 - readtimer.expires=jiffies+(HZ/20); 332 + readtimer.expires=jiffies+msecs_to_jiffies(50); 333 333 add_timer(&readtimer); 334 334 } 335 335 ··· 349 349 init_timer(&readtimer); 350 350 readtimer.function=cadet_handler; 351 351 readtimer.data=(unsigned long)0; 352 - readtimer.expires=jiffies+(HZ/20); 352 + readtimer.expires=jiffies+msecs_to_jiffies(50); 353 353 add_timer(&readtimer); 354 354 } 355 355 if(rdsin==rdsout) {
-3
drivers/media/radio/radio-gemtek-pci.c
··· 94 94 95 95 u32 iobase; 96 96 u32 length; 97 - u16 model; 98 97 99 98 u32 current_frequency; 100 99 u8 mute; ··· 411 412 printk( KERN_ERR "gemtek_pci: i/o port already in use\n" ); 412 413 goto err_pci; 413 414 } 414 - 415 - pci_read_config_word( pci_dev, PCI_SUBSYSTEM_ID, &card->model ); 416 415 417 416 pci_set_drvdata( pci_dev, card ); 418 417
+1 -1
drivers/media/video/bt866.c
··· 257 257 printk(KERN_WARNING "%s: I/O error #%d " 258 258 "(write 0x%02x/0x%02x)\n", 259 259 encoder->i2c->name, err, encoder->addr, subaddr); 260 - schedule_timeout_interruptible(HZ/10); 260 + schedule_timeout_interruptible(msecs_to_jiffies(100)); 261 261 } 262 262 if (err == 3) { 263 263 printk(KERN_WARNING "%s: giving up\n",
+1 -1
drivers/media/video/bt8xx/bttv-cards.c
··· 4209 4209 bus_low(btv,btv->mbox_clk); 4210 4210 4211 4211 udelay(10); 4212 - timeout= jiffies + HZ; 4212 + timeout= jiffies + msecs_to_jiffies(1000); 4213 4213 4214 4214 /* wait for DATA line to go low; error if it doesn't */ 4215 4215 while (bus_in(btv,btv->mbox_data) && time_before(jiffies, timeout))
+1 -1
drivers/media/video/bt8xx/bttv-input.c
··· 153 153 { 154 154 if (ir->polling) { 155 155 setup_timer(&ir->timer, bttv_input_timer, (unsigned long)btv); 156 - ir->timer.expires = jiffies + HZ; 156 + ir->timer.expires = jiffies + msecs_to_jiffies(1000); 157 157 add_timer(&ir->timer); 158 158 } else if (ir->rc5_gpio) { 159 159 /* set timer_end for code completion */
+2 -2
drivers/media/video/bt8xx/bttvp.h
··· 284 284 #define d2printk if (bttv_debug >= 2) printk 285 285 286 286 #define BTTV_MAX_FBUF 0x208000 287 - #define BTTV_TIMEOUT (HZ/2) /* 0.5 seconds */ 288 - #define BTTV_FREE_IDLE (HZ) /* one second */ 287 + #define BTTV_TIMEOUT msecs_to_jiffies(500) /* 0.5 seconds */ 288 + #define BTTV_FREE_IDLE msecs_to_jiffies(1000) /* one second */ 289 289 290 290 291 291 struct bttv_pll_info {
+2 -2
drivers/media/video/c-qcam.c
··· 95 95 unsigned long oldjiffies = jiffies; 96 96 unsigned int i; 97 97 98 - for (oldjiffies = jiffies; (jiffies - oldjiffies) < (HZ/25); ) 98 + for (oldjiffies = jiffies; (jiffies - oldjiffies) < msecs_to_jiffies(40); ) 99 99 if (qcam_ready1(qcam) == value) 100 100 return 0; 101 101 ··· 120 120 unsigned long oldjiffies = jiffies; 121 121 unsigned int i; 122 122 123 - for (oldjiffies = jiffies; (jiffies - oldjiffies) < (HZ/25); ) 123 + for (oldjiffies = jiffies; (jiffies - oldjiffies) < msecs_to_jiffies(40); ) 124 124 if (qcam_ready2(qcam) == value) 125 125 return 0; 126 126
+7 -1
drivers/media/video/cx88/cx88-video.c
··· 1881 1881 mutex_unlock(&core->lock); 1882 1882 1883 1883 /* start tvaudio thread */ 1884 - if (core->tuner_type != TUNER_ABSENT) 1884 + if (core->tuner_type != TUNER_ABSENT) { 1885 1885 core->kthread = kthread_run(cx88_audio_thread, core, "cx88 tvaudio"); 1886 + if (IS_ERR(core->kthread)) { 1887 + err = PTR_ERR(core->kthread); 1888 + printk(KERN_ERR "Failed to create cx88 audio thread, err=%d\n", 1889 + err); 1890 + } 1891 + } 1886 1892 return 0; 1887 1893 1888 1894 fail_unreg:
+1 -1
drivers/media/video/cx88/cx88.h
··· 259 259 #define RESOURCE_VIDEO 2 260 260 #define RESOURCE_VBI 4 261 261 262 - #define BUFFER_TIMEOUT (HZ/2) /* 0.5 seconds */ 262 + #define BUFFER_TIMEOUT msecs_to_jiffies(500) /* 0.5 seconds */ 263 263 264 264 /* buffer for one video frame */ 265 265 struct cx88_buffer {
+3 -2
drivers/media/video/ivtv/Kconfig
··· 1 1 config VIDEO_IVTV 2 2 tristate "Conexant cx23416/cx23415 MPEG encoder/decoder support" 3 3 depends on VIDEO_V4L1 && VIDEO_V4L2 && PCI && I2C && EXPERIMENTAL 4 + select I2C_ALGOBIT 4 5 select FW_LOADER 5 6 select VIDEO_TUNER 6 7 select VIDEO_TVEEPROM ··· 17 16 select VIDEO_UPD64031A 18 17 select VIDEO_UPD64083 19 18 ---help--- 20 - This is a video4linux driver for Conexant cx23416 or cx23416 based 19 + This is a video4linux driver for Conexant cx23416 or cx23415 based 21 20 PCI personal video recorder devices. 22 21 23 22 This is used in devices such as the Hauppauge PVR-150/250/350/500 24 - cards. 23 + cards. There is a driver homepage at <http://www.ivtvdriver.org>. 25 24 26 25 To compile this driver as a module, choose M here: the 27 26 module will be called ivtv.
+20 -23
drivers/media/video/ivtv/ivtv-driver.c
··· 56 56 #include "ivtv-gpio.h" 57 57 #include "ivtv-yuv.h" 58 58 59 - #include <linux/vermagic.h> 60 59 #include <media/tveeprom.h> 61 60 #include <media/v4l2-chip-ident.h> 62 61 ··· 275 276 } 276 277 277 278 /* Generic utility functions */ 278 - int ivtv_sleep_timeout(int timeout, int intr) 279 + int ivtv_msleep_timeout(unsigned int msecs, int intr) 279 280 { 280 281 int ret; 282 + int timeout = msecs_to_jiffies(msecs); 281 283 282 284 do { 283 285 set_current_state(intr ? TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE); ··· 427 427 if (itv->options.newi2c == -1 && tv.has_ir != -1 && tv.has_ir != 2) { 428 428 itv->options.newi2c = (tv.has_ir & 2) ? 1 : 0; 429 429 if (itv->options.newi2c) { 430 - IVTV_INFO("reopen i2c bus for IR-blaster support\n"); 430 + IVTV_INFO("Reopen i2c bus for IR-blaster support\n"); 431 431 exit_ivtv_i2c(itv); 432 432 init_ivtv_i2c(itv); 433 433 } ··· 951 951 952 952 /* Make sure we've got a place for this card */ 953 953 if (ivtv_cards_active == IVTV_MAX_CARDS) { 954 - printk(KERN_ERR "ivtv: Maximum number of cards detected (%d).\n", 954 + printk(KERN_ERR "ivtv: Maximum number of cards detected (%d)\n", 955 955 ivtv_cards_active); 956 956 spin_unlock(&ivtv_cards_lock); 957 957 return -ENOMEM; ··· 966 966 itv->dev = dev; 967 967 itv->num = ivtv_cards_active++; 968 968 snprintf(itv->name, sizeof(itv->name) - 1, "ivtv%d", itv->num); 969 - if (itv->num) { 970 - printk(KERN_INFO "ivtv: ====================== NEXT CARD ======================\n"); 971 - } 969 + IVTV_INFO("Initializing card #%d\n", itv->num); 972 970 973 971 spin_unlock(&ivtv_cards_lock); 974 972 ··· 1213 1215 if (itv->has_cx23415) 1214 1216 ivtv_set_osd_alpha(itv); 1215 1217 1216 - IVTV_INFO("Initialized %s, card #%d\n", itv->card_name, itv->num); 1218 + IVTV_INFO("Initialized card #%d: %s\n", itv->num, itv->card_name); 1217 1219 1218 1220 return 0; 1219 1221 ··· 1246 1248 { 1247 1249 struct ivtv *itv = pci_get_drvdata(pci_dev); 1248 1250 1249 - IVTV_DEBUG_INFO("Removing Card #%d.\n", itv->num); 1251 + IVTV_DEBUG_INFO("Removing Card #%d\n", itv->num); 1250 1252 1251 1253 /* Stop all captures */ 1252 - IVTV_DEBUG_INFO(" Stopping all streams.\n"); 1254 + IVTV_DEBUG_INFO("Stopping all streams\n"); 1253 1255 if (atomic_read(&itv->capturing) > 0) 1254 1256 ivtv_stop_all_captures(itv); 1255 1257 1256 1258 /* Stop all decoding */ 1257 - IVTV_DEBUG_INFO(" Stopping decoding.\n"); 1259 + IVTV_DEBUG_INFO("Stopping decoding\n"); 1258 1260 if (atomic_read(&itv->decoding) > 0) { 1259 1261 int type; 1260 1262 ··· 1267 1269 } 1268 1270 1269 1271 /* Interrupts */ 1270 - IVTV_DEBUG_INFO(" Disabling interrupts.\n"); 1272 + IVTV_DEBUG_INFO("Disabling interrupts\n"); 1271 1273 ivtv_set_irq_mask(itv, 0xffffffff); 1272 1274 del_timer_sync(&itv->dma_timer); 1273 1275 1274 1276 /* Stop all Work Queues */ 1275 - IVTV_DEBUG_INFO(" Stop Work Queues.\n"); 1277 + IVTV_DEBUG_INFO("Stop Work Queues\n"); 1276 1278 flush_workqueue(itv->irq_work_queues); 1277 1279 destroy_workqueue(itv->irq_work_queues); 1278 1280 1279 - IVTV_DEBUG_INFO(" Stopping Firmware.\n"); 1281 + IVTV_DEBUG_INFO("Stopping Firmware\n"); 1280 1282 ivtv_halt_firmware(itv); 1281 1283 1282 - IVTV_DEBUG_INFO(" Unregistering v4l devices.\n"); 1284 + IVTV_DEBUG_INFO("Unregistering v4l devices\n"); 1283 1285 ivtv_streams_cleanup(itv); 1284 - IVTV_DEBUG_INFO(" Freeing dma resources.\n"); 1286 + IVTV_DEBUG_INFO("Freeing dma resources\n"); 1285 1287 ivtv_udma_free(itv); 1286 1288 1287 1289 exit_ivtv_i2c(itv); 1288 1290 1289 - IVTV_DEBUG_INFO(" Releasing irq.\n"); 1291 + IVTV_DEBUG_INFO(" Releasing irq\n"); 1290 1292 free_irq(itv->dev->irq, (void *)itv); 1291 1293 ivtv_iounmap(itv); 1292 1294 1293 - IVTV_DEBUG_INFO(" Releasing mem.\n"); 1295 + IVTV_DEBUG_INFO(" Releasing mem\n"); 1294 1296 release_mem_region(itv->base_addr, IVTV_ENCODER_SIZE); 1295 1297 release_mem_region(itv->base_addr + IVTV_REG_OFFSET, IVTV_REG_SIZE); 1296 1298 if (itv->has_cx23415) ··· 1311 1313 1312 1314 static int module_start(void) 1313 1315 { 1314 - printk(KERN_INFO "ivtv: ==================== START INIT IVTV ====================\n"); 1315 - printk(KERN_INFO "ivtv: version %s (" VERMAGIC_STRING ") loading\n", IVTV_VERSION); 1316 + printk(KERN_INFO "ivtv: Start initialization, version %s\n", IVTV_VERSION); 1316 1317 1317 1318 memset(ivtv_cards, 0, sizeof(ivtv_cards)); 1318 1319 1319 1320 /* Validate parameters */ 1320 1321 if (ivtv_first_minor < 0 || ivtv_first_minor >= IVTV_MAX_CARDS) { 1321 - printk(KERN_ERR "ivtv: ivtv_first_minor must be between 0 and %d. Exiting...\n", 1322 + printk(KERN_ERR "ivtv: Exiting, ivtv_first_minor must be between 0 and %d\n", 1322 1323 IVTV_MAX_CARDS - 1); 1323 1324 return -1; 1324 1325 } 1325 1326 1326 1327 if (ivtv_debug < 0 || ivtv_debug > 1023) { 1327 1328 ivtv_debug = 0; 1328 - printk(KERN_INFO "ivtv: debug value must be >= 0 and <= 1023!\n"); 1329 + printk(KERN_INFO "ivtv: Debug value must be >= 0 and <= 1023\n"); 1329 1330 } 1330 1331 1331 1332 if (pci_register_driver(&ivtv_pci_driver)) { 1332 1333 printk(KERN_ERR "ivtv: Error detecting PCI card\n"); 1333 1334 return -ENODEV; 1334 1335 } 1335 - printk(KERN_INFO "ivtv: ==================== END INIT IVTV ====================\n"); 1336 + printk(KERN_INFO "ivtv: End initialization\n"); 1336 1337 return 0; 1337 1338 } 1338 1339
+1 -1
drivers/media/video/ivtv/ivtv-driver.h
··· 848 848 struct ivtv_stream *ivtv_get_output_stream(struct ivtv *itv); 849 849 850 850 /* Return non-zero if a signal is pending */ 851 - int ivtv_sleep_timeout(int timeout, int intr); 851 + int ivtv_msleep_timeout(unsigned int msecs, int intr); 852 852 853 853 /* Wait on queue, returns -EINTR if interrupted */ 854 854 int ivtv_waitq(wait_queue_head_t *waitq);
+3 -3
drivers/media/video/ivtv/ivtv-fileops.c
··· 218 218 /* Process pending program info updates and pending VBI data */ 219 219 ivtv_update_pgm_info(itv); 220 220 221 - if (jiffies - itv->dualwatch_jiffies > HZ) { 221 + if (jiffies - itv->dualwatch_jiffies > msecs_to_jiffies(1000)) { 222 222 itv->dualwatch_jiffies = jiffies; 223 223 ivtv_dualwatch(itv); 224 224 } ··· 832 832 if (itv == NULL) { 833 833 /* Couldn't find a device registered 834 834 on that minor, shouldn't happen! */ 835 - printk(KERN_WARNING "ivtv: no ivtv device found on minor %d\n", minor); 835 + printk(KERN_WARNING "ivtv: No ivtv device found on minor %d\n", minor); 836 836 return -ENXIO; 837 837 } 838 838 ··· 924 924 if (atomic_read(&itv->capturing) == 0) 925 925 ivtv_vapi(itv, CX2341X_ENC_INITIALIZE_INPUT, 0); 926 926 927 - ivtv_sleep_timeout(HZ / 10, 0); 927 + ivtv_msleep_timeout(100, 0); 928 928 929 929 if (atomic_read(&itv->capturing)) { 930 930 ivtv_vapi(itv, CX2341X_ENC_MISC, 1, 12);
+12 -13
drivers/media/video/ivtv/ivtv-firmware.c
··· 36 36 #define IVTV_CMD_SPU_STOP 0x00000001 37 37 #define IVTV_CMD_SDRAM_PRECHARGE_INIT 0x0000001A 38 38 #define IVTV_CMD_SDRAM_REFRESH_INIT 0x80000640 39 - #define IVTV_SDRAM_SLEEPTIME (60 * HZ / 100) /* 600 ms */ 39 + #define IVTV_SDRAM_SLEEPTIME 600 40 40 41 41 #define IVTV_DECODE_INIT_MPEG_FILENAME "v4l-cx2341x-init.mpg" 42 42 #define IVTV_DECODE_INIT_MPEG_SIZE (152*1024) ··· 61 61 the wrong file was sometimes loaded. So we check filesizes to 62 62 see if at least the right-sized file was loaded. If not, then we 63 63 retry. */ 64 - IVTV_INFO("retry: file loaded was not %s (expected size %ld, got %zd)\n", fn, size, fw->size); 64 + IVTV_INFO("Retry: file loaded was not %s (expected size %ld, got %zd)\n", fn, size, fw->size); 65 65 release_firmware(fw); 66 66 retries--; 67 67 goto retry; ··· 73 73 src++; 74 74 } 75 75 release_firmware(fw); 76 - IVTV_INFO("loaded %s firmware (%zd bytes)\n", fn, fw->size); 76 + IVTV_INFO("Loaded %s firmware (%zd bytes)\n", fn, fw->size); 77 77 return size; 78 78 } 79 - IVTV_ERR("unable to open firmware %s (must be %ld bytes)\n", fn, size); 80 - IVTV_ERR("did you put the firmware in the hotplug firmware directory?\n"); 79 + IVTV_ERR("Unable to open firmware %s (must be %ld bytes)\n", fn, size); 80 + IVTV_ERR("Did you put the firmware in the hotplug firmware directory?\n"); 81 81 return -ENOMEM; 82 82 } 83 83 ··· 89 89 if (itv->enc_mbox.mbox) 90 90 ivtv_vapi(itv, CX2341X_ENC_HALT_FW, 0); 91 91 92 - ivtv_sleep_timeout(HZ / 100, 0); 92 + ivtv_msleep_timeout(10, 0); 93 93 itv->enc_mbox.mbox = itv->dec_mbox.mbox = NULL; 94 94 95 95 IVTV_DEBUG_INFO("Stopping VDM\n"); ··· 113 113 IVTV_DEBUG_INFO("Stopping SPU\n"); 114 114 write_reg(IVTV_CMD_SPU_STOP, IVTV_REG_SPU); 115 115 116 - ivtv_sleep_timeout(HZ / 100, 0); 116 + ivtv_msleep_timeout(10, 0); 117 117 118 118 IVTV_DEBUG_INFO("init Encoder SDRAM pre-charge\n"); 119 119 write_reg(IVTV_CMD_SDRAM_PRECHARGE_INIT, IVTV_REG_ENC_SDRAM_PRECHARGE); ··· 129 129 write_reg(IVTV_CMD_SDRAM_REFRESH_INIT, IVTV_REG_DEC_SDRAM_REFRESH); 130 130 } 131 131 132 - IVTV_DEBUG_INFO("Sleeping for %dms (600 recommended)\n", 133 - (int)(IVTV_SDRAM_SLEEPTIME * 1000 / HZ)); 134 - ivtv_sleep_timeout(IVTV_SDRAM_SLEEPTIME, 0); 132 + IVTV_DEBUG_INFO("Sleeping for %dms\n", IVTV_SDRAM_SLEEPTIME); 133 + ivtv_msleep_timeout(IVTV_SDRAM_SLEEPTIME, 0); 135 134 } 136 135 137 136 void ivtv_firmware_versions(struct ivtv *itv) ··· 203 204 204 205 /* start firmware */ 205 206 write_reg(read_reg(IVTV_REG_SPU) & IVTV_MASK_SPU_ENABLE, IVTV_REG_SPU); 206 - ivtv_sleep_timeout(HZ / 10, 0); 207 + ivtv_msleep_timeout(100, 0); 207 208 if (itv->has_cx23415) 208 209 write_reg(read_reg(IVTV_REG_VPU) & IVTV_MASK_VPU_ENABLE15, IVTV_REG_VPU); 209 210 else 210 211 write_reg(read_reg(IVTV_REG_VPU) & IVTV_MASK_VPU_ENABLE16, IVTV_REG_VPU); 211 - ivtv_sleep_timeout(HZ / 10, 0); 212 + ivtv_msleep_timeout(100, 0); 212 213 213 214 /* find mailboxes and ping firmware */ 214 215 itv->enc_mbox.mbox = ivtv_search_mailbox(itv->enc_mem, IVTV_ENCODER_SIZE); ··· 263 264 IVTV_DECODE_INIT_MPEG_FILENAME); 264 265 } else { 265 266 ivtv_vapi(itv, CX2341X_DEC_SCHED_DMA_FROM_HOST, 3, 0, readbytes, 0); 266 - ivtv_sleep_timeout(HZ / 10, 0); 267 + ivtv_msleep_timeout(100, 0); 267 268 } 268 269 ivtv_vapi(itv, CX2341X_DEC_STOP_PLAYBACK, 4, 0, 0, 0, 1); 269 270 }
+1 -1
drivers/media/video/ivtv/ivtv-gpio.c
··· 130 130 131 131 if (itv->card->type != IVTV_CARD_PG600V2 || itv->options.tuner != TUNER_XCEIVE_XC3028) 132 132 return -EINVAL; 133 - IVTV_INFO("Resetting tuner.\n"); 133 + IVTV_INFO("Resetting tuner\n"); 134 134 curout = read_reg(IVTV_REG_GPIO_OUT); 135 135 curdir = read_reg(IVTV_REG_GPIO_DIR); 136 136 curdir |= (1 << 12); /* GPIO bit 12 */
+10 -10
drivers/media/video/ivtv/ivtv-i2c.c
··· 144 144 } 145 145 } 146 146 if (i == I2C_CLIENTS_MAX) { 147 - IVTV_ERR("insufficient room for new I2C client!\n"); 147 + IVTV_ERR("Insufficient room for new I2C client\n"); 148 148 } 149 149 return 0; 150 150 } ··· 236 236 int ret = 0; 237 237 238 238 if (ivtv_getscl(itv) == 1) { 239 - IVTV_DEBUG_I2C("SCL was high starting an ack\n"); 239 + IVTV_DEBUG_HI_I2C("SCL was high starting an ack\n"); 240 240 ivtv_setscl(itv, 0); 241 241 if (!ivtv_waitscl(itv, 0)) { 242 242 IVTV_DEBUG_I2C("Could not set SCL low starting an ack\n"); ··· 263 263 { 264 264 int i, bit; 265 265 266 - IVTV_DEBUG_I2C("write %x\n",byte); 266 + IVTV_DEBUG_HI_I2C("write %x\n",byte); 267 267 for (i = 0; i < 8; ++i, byte<<=1) { 268 268 ivtv_setscl(itv, 0); 269 269 if (!ivtv_waitscl(itv, 0)) { ··· 318 318 ivtv_scldelay(itv); 319 319 ivtv_setscl(itv, 0); 320 320 ivtv_scldelay(itv); 321 - IVTV_DEBUG_I2C("read %x\n",*byte); 321 + IVTV_DEBUG_HI_I2C("read %x\n",*byte); 322 322 return 0; 323 323 } 324 324 ··· 330 330 331 331 sda = ivtv_getsda(itv); 332 332 if (sda != 1) { 333 - IVTV_DEBUG_I2C("SDA was low at start\n"); 333 + IVTV_DEBUG_HI_I2C("SDA was low at start\n"); 334 334 ivtv_setsda(itv, 1); 335 335 if (!ivtv_waitsda(itv, 1)) { 336 336 IVTV_DEBUG_I2C("SDA stuck low\n"); ··· 355 355 int i; 356 356 357 357 if (ivtv_getscl(itv) != 0) { 358 - IVTV_DEBUG_I2C("SCL not low when stopping\n"); 358 + IVTV_DEBUG_HI_I2C("SCL not low when stopping\n"); 359 359 ivtv_setscl(itv, 0); 360 360 if (!ivtv_waitscl(itv, 0)) { 361 361 IVTV_DEBUG_I2C("SCL could not be set low\n"); ··· 569 569 } 570 570 } 571 571 if (cmd != VIDIOC_G_CHIP_IDENT) 572 - IVTV_ERR("i2c addr 0x%02x not found for command 0x%x!\n", addr, cmd); 572 + IVTV_ERR("i2c addr 0x%02x not found for command 0x%x\n", addr, cmd); 573 573 return -ENODEV; 574 574 } 575 575 ··· 640 640 641 641 addr = ivtv_i2c_hw_addr(itv, hw); 642 642 if (addr < 0) { 643 - IVTV_ERR("i2c hardware 0x%08x (%s) not found for command 0x%x!\n", 643 + IVTV_ERR("i2c hardware 0x%08x (%s) not found for command 0x%x\n", 644 644 hw, ivtv_i2c_hw_name(hw), cmd); 645 645 return addr; 646 646 } ··· 655 655 addr = ivtv_i2c_id_addr(itv, id); 656 656 if (addr < 0) { 657 657 if (cmd != VIDIOC_G_CHIP_IDENT) 658 - IVTV_ERR("i2c ID 0x%08x (%s) not found for command 0x%x!\n", 658 + IVTV_ERR("i2c ID 0x%08x (%s) not found for command 0x%x\n", 659 659 id, ivtv_i2c_id_name(id), cmd); 660 660 return addr; 661 661 } ··· 696 696 void ivtv_call_i2c_clients(struct ivtv *itv, unsigned int cmd, void *arg) 697 697 { 698 698 if (itv->i2c_adap.algo == NULL) { 699 - IVTV_ERR("adapter is not set"); 699 + IVTV_ERR("Adapter is not set"); 700 700 return; 701 701 } 702 702 i2c_clients_command(&itv->i2c_adap, cmd, arg);
+7 -4
drivers/media/video/ivtv/ivtv-irq.c
··· 403 403 /* Mark last buffer size for Interrupt flag */ 404 404 s->SGarray[s->SG_length - 1].size |= cpu_to_le32(0x80000000); 405 405 406 + if (s->type == IVTV_ENC_STREAM_TYPE_VBI) 407 + set_bit(IVTV_F_I_ENC_VBI, &itv->i_flags); 408 + else 409 + clear_bit(IVTV_F_I_ENC_VBI, &itv->i_flags); 410 + 406 411 if (ivtv_use_pio(s)) { 407 412 for (i = 0; i < s->SG_length; i++) { 408 413 s->PIOarray[i].src = le32_to_cpu(s->SGarray[i].src); ··· 425 420 write_reg_sync(read_reg(IVTV_REG_DMAXFER) | 0x02, IVTV_REG_DMAXFER); 426 421 set_bit(IVTV_F_I_DMA, &itv->i_flags); 427 422 itv->cur_dma_stream = s->type; 428 - itv->dma_timer.expires = jiffies + HZ / 10; 423 + itv->dma_timer.expires = jiffies + msecs_to_jiffies(100); 429 424 add_timer(&itv->dma_timer); 430 425 } 431 426 } ··· 442 437 write_reg_sync(read_reg(IVTV_REG_DMAXFER) | 0x01, IVTV_REG_DMAXFER); 443 438 set_bit(IVTV_F_I_DMA, &itv->i_flags); 444 439 itv->cur_dma_stream = s->type; 445 - itv->dma_timer.expires = jiffies + HZ / 10; 440 + itv->dma_timer.expires = jiffies + msecs_to_jiffies(100); 446 441 add_timer(&itv->dma_timer); 447 442 } 448 443 ··· 602 597 data[0], data[1], data[2]); 603 598 return; 604 599 } 605 - clear_bit(IVTV_F_I_ENC_VBI, &itv->i_flags); 606 600 s = &itv->streams[ivtv_stream_map[data[0]]]; 607 601 if (!stream_enc_dma_append(s, data)) { 608 602 set_bit(ivtv_use_pio(s) ? IVTV_F_S_PIO_PENDING : IVTV_F_S_DMA_PENDING, &s->s_flags); ··· 638 634 then start a DMA request for just the VBI data. */ 639 635 if (!stream_enc_dma_append(s, data) && 640 636 !test_bit(IVTV_F_S_STREAMING, &s_mpg->s_flags)) { 641 - set_bit(IVTV_F_I_ENC_VBI, &itv->i_flags); 642 637 set_bit(ivtv_use_pio(s) ? IVTV_F_S_PIO_PENDING : IVTV_F_S_DMA_PENDING, &s->s_flags); 643 638 } 644 639 }
+20 -13
drivers/media/video/ivtv/ivtv-mailbox.c
··· 37 37 #define API_RESULT (1 << 1) /* Allow 1 second for this cmd to end */ 38 38 #define API_FAST_RESULT (3 << 1) /* Allow 0.1 second for this cmd to end */ 39 39 #define API_DMA (1 << 3) /* DMA mailbox, has special handling */ 40 + #define API_HIGH_VOL (1 << 5) /* High volume command (i.e. called during encoding or decoding) */ 40 41 #define API_NO_WAIT_MB (1 << 4) /* Command may not wait for a free mailbox */ 41 42 #define API_NO_WAIT_RES (1 << 5) /* Command may not wait for the result */ 42 43 ··· 78 77 API_ENTRY(CX2341X_ENC_SET_DMA_BLOCK_SIZE, API_CACHE), 79 78 API_ENTRY(CX2341X_ENC_GET_PREV_DMA_INFO_MB_10, API_FAST_RESULT), 80 79 API_ENTRY(CX2341X_ENC_GET_PREV_DMA_INFO_MB_9, API_FAST_RESULT), 81 - API_ENTRY(CX2341X_ENC_SCHED_DMA_TO_HOST, API_DMA), 80 + API_ENTRY(CX2341X_ENC_SCHED_DMA_TO_HOST, API_DMA | API_HIGH_VOL), 82 81 API_ENTRY(CX2341X_ENC_INITIALIZE_INPUT, API_RESULT), 83 82 API_ENTRY(CX2341X_ENC_SET_FRAME_DROP_RATE, API_CACHE), 84 83 API_ENTRY(CX2341X_ENC_PAUSE_ENCODER, API_RESULT), 85 - API_ENTRY(CX2341X_ENC_REFRESH_INPUT, API_NO_WAIT_MB), 84 + API_ENTRY(CX2341X_ENC_REFRESH_INPUT, API_NO_WAIT_MB | API_HIGH_VOL), 86 85 API_ENTRY(CX2341X_ENC_SET_COPYRIGHT, API_CACHE), 87 86 API_ENTRY(CX2341X_ENC_SET_EVENT_NOTIFICATION, API_RESULT), 88 87 API_ENTRY(CX2341X_ENC_SET_NUM_VSYNC_LINES, API_CACHE), ··· 103 102 API_ENTRY(CX2341X_DEC_SET_DMA_BLOCK_SIZE, API_CACHE), 104 103 API_ENTRY(CX2341X_DEC_GET_XFER_INFO, API_FAST_RESULT), 105 104 API_ENTRY(CX2341X_DEC_GET_DMA_STATUS, API_FAST_RESULT), 106 - API_ENTRY(CX2341X_DEC_SCHED_DMA_FROM_HOST, API_DMA), 105 + API_ENTRY(CX2341X_DEC_SCHED_DMA_FROM_HOST, API_DMA | API_HIGH_VOL), 107 106 API_ENTRY(CX2341X_DEC_PAUSE_PLAYBACK, API_RESULT), 108 107 API_ENTRY(CX2341X_DEC_HALT_FW, API_FAST_RESULT), 109 108 API_ENTRY(CX2341X_DEC_SET_STANDARD, API_CACHE), ··· 176 175 177 176 /* Sleep before a retry, if not atomic */ 178 177 if (!(flags & API_NO_WAIT_MB)) { 179 - if (jiffies - then > retries * HZ / 100) 178 + if (jiffies - then > msecs_to_jiffies(10*retries)) 180 179 break; 181 - ivtv_sleep_timeout(HZ / 100, 0); 180 + ivtv_msleep_timeout(10, 0); 182 181 } 183 182 } 184 183 return -ENODEV; ··· 213 212 { 214 213 struct ivtv_mailbox_data *mbdata = (cmd >= 128) ? &itv->enc_mbox : &itv->dec_mbox; 215 214 volatile struct ivtv_mailbox __iomem *mbox; 216 - int api_timeout = HZ; 215 + int api_timeout = msecs_to_jiffies(1000); 217 216 int flags, mb, i; 218 217 unsigned long then; 219 218 ··· 228 227 return -EINVAL; 229 228 } 230 229 231 - IVTV_DEBUG_API("API Call: %s\n", api_info[cmd].name); 230 + if (api_info[cmd].flags & API_HIGH_VOL) { 231 + IVTV_DEBUG_HI_API("API Call: %s\n", api_info[cmd].name); 232 + } 233 + else { 234 + IVTV_DEBUG_API("API Call: %s\n", api_info[cmd].name); 235 + } 232 236 233 237 /* clear possibly uninitialized part of data array */ 234 238 for (i = args; i < CX2341X_MBOX_MAX_DATA; i++) ··· 243 237 data, then just return 0 as there is no need to issue this command again. 244 238 Just an optimization to prevent unnecessary use of mailboxes. */ 245 239 if (itv->api_cache[cmd].last_jiffies && 246 - jiffies - itv->api_cache[cmd].last_jiffies < HZ * 1800 && 240 + jiffies - itv->api_cache[cmd].last_jiffies < msecs_to_jiffies(1800000) && 247 241 !memcmp(data, itv->api_cache[cmd].data, sizeof(itv->api_cache[cmd].data))) { 248 242 itv->api_cache[cmd].last_jiffies = jiffies; 249 243 return 0; ··· 268 262 } 269 263 270 264 if ((flags & API_FAST_RESULT) == API_FAST_RESULT) 271 - api_timeout = HZ / 10; 265 + api_timeout = msecs_to_jiffies(100); 272 266 273 267 mb = get_mailbox(itv, mbdata, flags); 274 268 if (mb < 0) { ··· 301 295 if (flags & API_NO_WAIT_RES) 302 296 mdelay(1); 303 297 else 304 - ivtv_sleep_timeout(HZ / 100, 0); 298 + ivtv_msleep_timeout(10, 0); 305 299 } 306 - if (jiffies - then > HZ / 10) 307 - IVTV_DEBUG_WARN("%s took %lu jiffies (%d per HZ)\n", 308 - api_info[cmd].name, jiffies - then, HZ); 300 + if (jiffies - then > msecs_to_jiffies(100)) 301 + IVTV_DEBUG_WARN("%s took %u jiffies\n", 302 + api_info[cmd].name, 303 + jiffies_to_msecs(jiffies - then)); 309 304 310 305 for (i = 0; i < CX2341X_MBOX_MAX_DATA; i++) 311 306 data[i] = readl(&mbox->data[i]);
+7 -5
drivers/media/video/ivtv/ivtv-streams.c
··· 565 565 /* Initialize Digitizer for Capture */ 566 566 ivtv_vapi(itv, CX2341X_ENC_INITIALIZE_INPUT, 0); 567 567 568 - ivtv_sleep_timeout(HZ / 10, 0); 568 + ivtv_msleep_timeout(100, 0); 569 569 } 570 570 571 571 /* begin_capture */ ··· 781 781 set_current_state(TASK_INTERRUPTIBLE); 782 782 783 783 /* wait 2s for EOS interrupt */ 784 - while (!test_bit(IVTV_F_I_EOS, &itv->i_flags) && jiffies < then + 2 * HZ) { 785 - schedule_timeout(HZ / 100); 784 + while (!test_bit(IVTV_F_I_EOS, &itv->i_flags) && 785 + jiffies < then + msecs_to_jiffies (2000)) { 786 + schedule_timeout(msecs_to_jiffies(10)); 786 787 } 787 788 788 789 /* To convert jiffies to ms, we must multiply by 1000 ··· 822 821 } else if (read_reg(IVTV_REG_DMASTATUS) & 0x02) { 823 822 break; 824 823 } 825 - } while (!ivtv_sleep_timeout(HZ / 100, 1) && then + HZ * 2 > jiffies); 824 + } while (!ivtv_msleep_timeout(10, 1) && 825 + then + msecs_to_jiffies(2000) > jiffies); 826 826 827 827 set_current_state(TASK_RUNNING); 828 828 remove_wait_queue(&s->waitq, &wait); ··· 894 892 break; 895 893 tmp = data[3]; 896 894 } 897 - if (ivtv_sleep_timeout(HZ/10, 1)) 895 + if (ivtv_msleep_timeout(100, 1)) 898 896 break; 899 897 } 900 898 }
+4 -4
drivers/media/video/saa5249.c
··· 86 86 87 87 88 88 89 - #define PAGE_WAIT (300*HZ/1000) /* Time between requesting page and */ 89 + #define PAGE_WAIT msecs_to_jiffies(300) /* Time between requesting page and */ 90 90 /* checking status bits */ 91 - #define PGBUF_EXPIRE (15*HZ) /* Time to wait before retransmitting */ 91 + #define PGBUF_EXPIRE msecs_to_jiffies(15000) /* Time to wait before retransmitting */ 92 92 /* page regardless of infobits */ 93 93 typedef struct { 94 94 u8 pgbuf[VTX_VIRTUALSIZE]; /* Page-buffer */ ··· 115 115 #define CCTWR 34 /* I�C write/read-address of vtx-chip */ 116 116 #define CCTRD 35 117 117 #define NOACK_REPEAT 10 /* Retry access this many times on failure */ 118 - #define CLEAR_DELAY (HZ/20) /* Time required to clear a page */ 119 - #define READY_TIMEOUT (30*HZ/1000) /* Time to wait for ready signal of I�C-bus interface */ 118 + #define CLEAR_DELAY msecs_to_jiffies(50) /* Time required to clear a page */ 119 + #define READY_TIMEOUT msecs_to_jiffies(30) /* Time to wait for ready signal of I2C-bus interface */ 120 120 #define INIT_DELAY 500 /* Time in usec to wait at initialization of CEA interface */ 121 121 #define START_DELAY 10 /* Time in usec to wait before starting write-cycle (CEA) */ 122 122
+2 -2
drivers/media/video/saa7110.c
··· 208 208 saa7110_write_block(client, initseq, sizeof(initseq)); 209 209 saa7110_selmux(client, decoder->input); 210 210 prepare_to_wait(&decoder->wq, &wait, TASK_UNINTERRUPTIBLE); 211 - schedule_timeout(HZ/4); 211 + schedule_timeout(msecs_to_jiffies(250)); 212 212 finish_wait(&decoder->wq, &wait); 213 213 status = saa7110_read(client); 214 214 if (status & 0x40) { ··· 249 249 //saa7110_write(client,0x2E,0x9A); 250 250 251 251 prepare_to_wait(&decoder->wq, &wait, TASK_UNINTERRUPTIBLE); 252 - schedule_timeout(HZ/4); 252 + schedule_timeout(msecs_to_jiffies(250)); 253 253 finish_wait(&decoder->wq, &wait); 254 254 255 255 status = saa7110_read(client);
+1 -1
drivers/media/video/saa7134/saa7134.h
··· 314 314 #define INTERLACE_ON 1 315 315 #define INTERLACE_OFF 2 316 316 317 - #define BUFFER_TIMEOUT (HZ/2) /* 0.5 seconds */ 317 + #define BUFFER_TIMEOUT msecs_to_jiffies(500) /* 0.5 seconds */ 318 318 319 319 struct saa7134_dev; 320 320 struct saa7134_dma;
+2 -2
drivers/media/video/tvaudio.c
··· 290 290 desc->checkmode(chip); 291 291 292 292 /* schedule next check */ 293 - mod_timer(&chip->wt, jiffies+2*HZ); 293 + mod_timer(&chip->wt, jiffies+msecs_to_jiffies(2000)); 294 294 } 295 295 296 296 v4l_dbg(1, debug, &chip->c, "%s: thread exiting\n", chip->c.name); ··· 1770 1770 desc->setmode(chip,VIDEO_SOUND_MONO); 1771 1771 if (chip->prevmode != VIDEO_SOUND_MONO) 1772 1772 chip->prevmode = -1; /* reset previous mode */ 1773 - mod_timer(&chip->wt, jiffies+2*HZ); 1773 + mod_timer(&chip->wt, jiffies+msecs_to_jiffies(2000)); 1774 1774 /* the thread will call checkmode() later */ 1775 1775 } 1776 1776 break;
+14 -5
drivers/media/video/v4l2-common.c
··· 939 939 When no more controls are available 0 is returned. */ 940 940 u32 v4l2_ctrl_next(const u32 * const * ctrl_classes, u32 id) 941 941 { 942 - u32 ctrl_class; 942 + u32 ctrl_class = V4L2_CTRL_ID2CLASS(id); 943 943 const u32 *pctrl; 944 944 945 - /* if no query is desired, then just return the control ID */ 946 - if ((id & V4L2_CTRL_FLAG_NEXT_CTRL) == 0) 947 - return id; 948 945 if (ctrl_classes == NULL) 949 946 return 0; 947 + 948 + /* if no query is desired, then check if the ID is part of ctrl_classes */ 949 + if ((id & V4L2_CTRL_FLAG_NEXT_CTRL) == 0) { 950 + /* find class */ 951 + while (*ctrl_classes && V4L2_CTRL_ID2CLASS(**ctrl_classes) != ctrl_class) 952 + ctrl_classes++; 953 + if (*ctrl_classes == NULL) 954 + return 0; 955 + pctrl = *ctrl_classes; 956 + /* find control ID */ 957 + while (*pctrl && *pctrl != id) pctrl++; 958 + return *pctrl ? id : 0; 959 + } 950 960 id &= V4L2_CTRL_ID_MASK; 951 - ctrl_class = V4L2_CTRL_ID2CLASS(id); 952 961 id++; /* select next control */ 953 962 /* find first class that matches (or is greater than) the class of 954 963 the ID */
+1 -1
drivers/media/video/vino.c
··· 2080 2080 2081 2081 /* to ensure that schedule_timeout will return immediately 2082 2082 * if VINO interrupt was triggered meanwhile */ 2083 - schedule_timeout_interruptible(HZ / 10); 2083 + schedule_timeout_interruptible(msecs_to_jiffies(100)); 2084 2084 2085 2085 if (signal_pending(current)) 2086 2086 err = -EINTR;
+2
drivers/media/video/wm8739.c
··· 321 321 322 322 static int wm8739_detach(struct i2c_client *client) 323 323 { 324 + struct wm8739_state *state = i2c_get_clientdata(client); 324 325 int err; 325 326 326 327 err = i2c_detach_client(client); 327 328 if (err) 328 329 return err; 329 330 331 + kfree(state); 330 332 kfree(client); 331 333 return 0; 332 334 }
+2
drivers/media/video/wm8775.c
··· 222 222 223 223 static int wm8775_detach(struct i2c_client *client) 224 224 { 225 + struct wm8775_state *state = i2c_get_clientdata(client); 225 226 int err; 226 227 227 228 err = i2c_detach_client(client); 228 229 if (err) { 229 230 return err; 230 231 } 232 + kfree(state); 231 233 kfree(client); 232 234 233 235 return 0;
+1
include/linux/videodev2.h
··· 60 60 #include <linux/compiler.h> /* need __user */ 61 61 #else 62 62 #define __user 63 + #include <sys/time.h> 63 64 #endif 64 65 #include <linux/types.h> 65 66