Merge master.kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb

+1612 -1303
+1
Documentation/video4linux/CARDLIST.bttv
··· 142 142 141 -> Asound Skyeye PCTV 143 143 142 -> Sabrent TV-FM (bttv version) 144 144 143 -> Hauppauge ImpactVCB (bt878) [0070:13eb] 145 + 144 -> MagicTV
+1 -1
Documentation/video4linux/CARDLIST.cx88
··· 19 19 18 -> Hauppauge Nova-T DVB-T [0070:9002,0070:9001] 20 20 19 -> Conexant DVB-T reference design [14f1:0187] 21 21 20 -> Provideo PV259 [1540:2580] 22 - 21 -> DViCO FusionHDTV DVB-T Plus [18ac:db10] 22 + 21 -> DViCO FusionHDTV DVB-T Plus [18ac:db10,18ac:db11] 23 23 22 -> pcHDTV HD3000 HDTV [7063:3000] 24 24 23 -> digitalnow DNTV Live! DVB-T [17de:a8a6] 25 25 24 -> Hauppauge WinTV 28xxx (Roslyn) models [0070:2801]
+3 -6
drivers/media/common/saa7146_core.c
··· 109 109 struct page *pg; 110 110 int i; 111 111 112 - sglist = kmalloc(sizeof(struct scatterlist)*nr_pages, GFP_KERNEL); 112 + sglist = kcalloc(nr_pages, sizeof(struct scatterlist), GFP_KERNEL); 113 113 if (NULL == sglist) 114 114 return NULL; 115 - memset(sglist,0,sizeof(struct scatterlist)*nr_pages); 116 115 for (i = 0; i < nr_pages; i++, virt += PAGE_SIZE) { 117 116 pg = vmalloc_to_page(virt); 118 117 if (NULL == pg) ··· 305 306 struct saa7146_dev *dev; 306 307 int err = -ENOMEM; 307 308 308 - dev = kmalloc(sizeof(struct saa7146_dev), GFP_KERNEL); 309 + /* clear out mem for sure */ 310 + dev = kzalloc(sizeof(struct saa7146_dev), GFP_KERNEL); 309 311 if (!dev) { 310 312 ERR(("out of memory.\n")); 311 313 goto out; 312 314 } 313 - 314 - /* clear out mem for sure */ 315 - memset(dev, 0x0, sizeof(struct saa7146_dev)); 316 315 317 316 DEB_EE(("pci:%p\n",pci)); 318 317
+2 -4
drivers/media/common/saa7146_fops.c
··· 239 239 } 240 240 241 241 /* allocate per open data */ 242 - fh = kmalloc(sizeof(*fh),GFP_KERNEL); 242 + fh = kzalloc(sizeof(*fh),GFP_KERNEL); 243 243 if (NULL == fh) { 244 244 DEB_S(("cannot allocate memory for per open data.\n")); 245 245 result = -ENOMEM; 246 246 goto out; 247 247 } 248 - memset(fh,0,sizeof(*fh)); 249 248 250 249 file->private_data = fh; 251 250 fh->dev = dev; ··· 463 464 464 465 int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv) 465 466 { 466 - struct saa7146_vv *vv = kmalloc (sizeof(struct saa7146_vv),GFP_KERNEL); 467 + struct saa7146_vv *vv = kzalloc (sizeof(struct saa7146_vv),GFP_KERNEL); 467 468 if( NULL == vv ) { 468 469 ERR(("out of memory. aborting.\n")); 469 470 return -1; 470 471 } 471 - memset(vv, 0x0, sizeof(*vv)); 472 472 473 473 DEB_EE(("dev:%p\n",dev)); 474 474
+2 -4
drivers/media/dvb/b2c2/flexcop.c
··· 220 220 struct flexcop_device *flexcop_device_kmalloc(size_t bus_specific_len) 221 221 { 222 222 void *bus; 223 - struct flexcop_device *fc = kmalloc(sizeof(struct flexcop_device), GFP_KERNEL); 223 + struct flexcop_device *fc = kzalloc(sizeof(struct flexcop_device), GFP_KERNEL); 224 224 if (!fc) { 225 225 err("no memory"); 226 226 return NULL; 227 227 } 228 - memset(fc, 0, sizeof(struct flexcop_device)); 229 228 230 - bus = kmalloc(bus_specific_len, GFP_KERNEL); 229 + bus = kzalloc(bus_specific_len, GFP_KERNEL); 231 230 if (!bus) { 232 231 err("no memory"); 233 232 kfree(fc); 234 233 return NULL; 235 234 } 236 - memset(bus, 0, bus_specific_len); 237 235 238 236 fc->bus_specific = bus; 239 237
+1 -2
drivers/media/dvb/bt8xx/dvb-bt8xx.c
··· 786 786 struct pci_dev* bttv_pci_dev; 787 787 int ret; 788 788 789 - if (!(card = kmalloc(sizeof(struct dvb_bt8xx_card), GFP_KERNEL))) 789 + if (!(card = kzalloc(sizeof(struct dvb_bt8xx_card), GFP_KERNEL))) 790 790 return -ENOMEM; 791 791 792 - memset(card, 0, sizeof(*card)); 793 792 init_MUTEX(&card->lock); 794 793 card->bttv_nr = sub->core->nr; 795 794 strncpy(card->card_name, sub->core->name, sizeof(sub->core->name));
+2 -6
drivers/media/dvb/dvb-core/dvb_ca_en50221.c
··· 1649 1649 return -EINVAL; 1650 1650 1651 1651 /* initialise the system data */ 1652 - if ((ca = 1653 - (struct dvb_ca_private *) kmalloc(sizeof(struct dvb_ca_private), 1654 - GFP_KERNEL)) == NULL) { 1652 + if ((ca = kzalloc(sizeof(struct dvb_ca_private), GFP_KERNEL)) == NULL) { 1655 1653 ret = -ENOMEM; 1656 1654 goto error; 1657 1655 } 1658 - memset(ca, 0, sizeof(struct dvb_ca_private)); 1659 1656 ca->pub = pubca; 1660 1657 ca->flags = flags; 1661 1658 ca->slot_count = slot_count; 1662 - if ((ca->slot_info = kmalloc(sizeof(struct dvb_ca_slot) * slot_count, GFP_KERNEL)) == NULL) { 1659 + if ((ca->slot_info = kcalloc(slot_count, sizeof(struct dvb_ca_slot), GFP_KERNEL)) == NULL) { 1663 1660 ret = -ENOMEM; 1664 1661 goto error; 1665 1662 } 1666 - memset(ca->slot_info, 0, sizeof(struct dvb_ca_slot) * slot_count); 1667 1663 init_waitqueue_head(&ca->wait_queue); 1668 1664 ca->thread_pid = 0; 1669 1665 init_waitqueue_head(&ca->thread_queue);
+1 -2
drivers/media/dvb/dvb-core/dvb_frontend.c
··· 1024 1024 if (down_interruptible (&frontend_mutex)) 1025 1025 return -ERESTARTSYS; 1026 1026 1027 - fe->frontend_priv = kmalloc(sizeof(struct dvb_frontend_private), GFP_KERNEL); 1027 + fe->frontend_priv = kzalloc(sizeof(struct dvb_frontend_private), GFP_KERNEL); 1028 1028 if (fe->frontend_priv == NULL) { 1029 1029 up(&frontend_mutex); 1030 1030 return -ENOMEM; 1031 1031 } 1032 1032 fepriv = fe->frontend_priv; 1033 - memset(fe->frontend_priv, 0, sizeof(struct dvb_frontend_private)); 1034 1033 1035 1034 init_MUTEX (&fepriv->sem); 1036 1035 init_waitqueue_head (&fepriv->wait_queue);
+150 -2
drivers/media/dvb/dvb-usb/cxusb.c
··· 253 253 return 0; 254 254 } 255 255 256 + static int cxusb_mt352_demod_init(struct dvb_frontend* fe) 257 + { /* used in both lgz201 and th7579 */ 258 + static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x39 }; 259 + static u8 reset [] = { RESET, 0x80 }; 260 + static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 }; 261 + static u8 agc_cfg [] = { AGC_TARGET, 0x24, 0x20 }; 262 + static u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 }; 263 + static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 }; 264 + 265 + mt352_write(fe, clock_config, sizeof(clock_config)); 266 + udelay(200); 267 + mt352_write(fe, reset, sizeof(reset)); 268 + mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg)); 269 + 270 + mt352_write(fe, agc_cfg, sizeof(agc_cfg)); 271 + mt352_write(fe, gpp_ctl_cfg, sizeof(gpp_ctl_cfg)); 272 + mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg)); 273 + return 0; 274 + } 275 + 256 276 struct cx22702_config cxusb_cx22702_config = { 257 277 .demod_address = 0x63, 258 278 ··· 291 271 struct mt352_config cxusb_dee1601_config = { 292 272 .demod_address = 0x0f, 293 273 .demod_init = cxusb_dee1601_demod_init, 274 + .pll_set = dvb_usb_pll_set, 275 + }; 276 + 277 + struct mt352_config cxusb_mt352_config = { 278 + /* used in both lgz201 and th7579 */ 279 + .demod_address = 0x0f, 280 + .demod_init = cxusb_mt352_demod_init, 294 281 .pll_set = dvb_usb_pll_set, 295 282 }; 296 283 ··· 329 302 return 0; 330 303 } 331 304 305 + static int cxusb_lgz201_tuner_attach(struct dvb_usb_device *d) 306 + { 307 + d->pll_addr = 0x61; 308 + d->pll_desc = &dvb_pll_lg_z201; 309 + return 0; 310 + } 311 + 312 + static int cxusb_dtt7579_tuner_attach(struct dvb_usb_device *d) 313 + { 314 + d->pll_addr = 0x60; 315 + d->pll_desc = &dvb_pll_thomson_dtt7579; 316 + return 0; 317 + } 318 + 332 319 static int cxusb_cx22702_frontend_attach(struct dvb_usb_device *d) 333 320 { 334 321 u8 b; ··· 365 324 cxusb_ctrl_msg(d,CMD_DIGITAL, NULL, 0, NULL, 0); 366 325 367 326 if ((d->fe = lgdt330x_attach(&cxusb_lgdt330x_config, &d->i2c_adap)) != NULL) 327 + return 0; 328 + 329 + return -EIO; 330 + } 331 + 332 + static int cxusb_mt352_frontend_attach(struct dvb_usb_device *d) 333 + { /* used in both lgz201 and th7579 */ 334 + if (usb_set_interface(d->udev,0,0) < 0) 335 + err("set interface failed"); 336 + 337 + cxusb_ctrl_msg(d,CMD_DIGITAL, NULL, 0, NULL, 0); 338 + 339 + if ((d->fe = mt352_attach(&cxusb_mt352_config, &d->i2c_adap)) != NULL) 368 340 return 0; 369 341 370 342 return -EIO; ··· 424 370 static struct dvb_usb_properties cxusb_medion_properties; 425 371 static struct dvb_usb_properties cxusb_bluebird_lgh064f_properties; 426 372 static struct dvb_usb_properties cxusb_bluebird_dee1601_properties; 373 + static struct dvb_usb_properties cxusb_bluebird_lgz201_properties; 374 + static struct dvb_usb_properties cxusb_bluebird_dtt7579_properties; 427 375 428 376 static int cxusb_probe(struct usb_interface *intf, 429 377 const struct usb_device_id *id) 430 378 { 431 379 if (dvb_usb_device_init(intf,&cxusb_medion_properties,THIS_MODULE,NULL) == 0 || 432 380 dvb_usb_device_init(intf,&cxusb_bluebird_lgh064f_properties,THIS_MODULE,NULL) == 0 || 433 - dvb_usb_device_init(intf,&cxusb_bluebird_dee1601_properties,THIS_MODULE,NULL) == 0) { 381 + dvb_usb_device_init(intf,&cxusb_bluebird_dee1601_properties,THIS_MODULE,NULL) == 0 || 382 + dvb_usb_device_init(intf,&cxusb_bluebird_lgz201_properties,THIS_MODULE,NULL) == 0 || 383 + dvb_usb_device_init(intf,&cxusb_bluebird_dtt7579_properties,THIS_MODULE,NULL) == 0) { 434 384 return 0; 435 385 } 436 386 ··· 447 389 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_WARM) }, 448 390 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DEE1601_COLD) }, 449 391 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DEE1601_WARM) }, 392 + { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_COLD) }, 393 + { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_WARM) }, 394 + { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_COLD) }, 395 + { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_WARM) }, 396 + { USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DEE1601_COLD) }, 397 + { USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DEE1601_WARM) }, 450 398 {} /* Terminating entry */ 451 399 }; 452 400 MODULE_DEVICE_TABLE (usb, cxusb_table); ··· 569 505 } 570 506 }, 571 507 572 - .num_device_descs = 1, 508 + .num_device_descs = 2, 573 509 .devices = { 574 510 { "DViCO FusionHDTV DVB-T Dual USB", 575 511 { &cxusb_table[3], NULL }, 576 512 { &cxusb_table[4], NULL }, 513 + }, 514 + { "DigitalNow DVB-T Dual USB", 515 + { &cxusb_table[9], NULL }, 516 + { &cxusb_table[10], NULL }, 517 + }, 518 + } 519 + }; 520 + 521 + static struct dvb_usb_properties cxusb_bluebird_lgz201_properties = { 522 + .caps = DVB_USB_IS_AN_I2C_ADAPTER, 523 + 524 + .usb_ctrl = DEVICE_SPECIFIC, 525 + .firmware = "dvb-usb-bluebird-01.fw", 526 + .download_firmware = bluebird_patch_dvico_firmware_download, 527 + /* use usb alt setting 0 for EP4 transfer (dvb-t), 528 + use usb alt setting 7 for EP2 transfer (atsc) */ 529 + 530 + .size_of_priv = sizeof(struct cxusb_state), 531 + 532 + .streaming_ctrl = cxusb_streaming_ctrl, 533 + .power_ctrl = cxusb_power_ctrl, 534 + .frontend_attach = cxusb_mt352_frontend_attach, 535 + .tuner_attach = cxusb_lgz201_tuner_attach, 536 + 537 + .i2c_algo = &cxusb_i2c_algo, 538 + 539 + .generic_bulk_ctrl_endpoint = 0x01, 540 + /* parameter for the MPEG2-data transfer */ 541 + .urb = { 542 + .type = DVB_USB_BULK, 543 + .count = 5, 544 + .endpoint = 0x04, 545 + .u = { 546 + .bulk = { 547 + .buffersize = 8192, 548 + } 549 + } 550 + }, 551 + 552 + .num_device_descs = 1, 553 + .devices = { 554 + { "DViCO FusionHDTV DVB-T USB (LGZ201)", 555 + { &cxusb_table[5], NULL }, 556 + { &cxusb_table[6], NULL }, 557 + }, 558 + } 559 + }; 560 + 561 + static struct dvb_usb_properties cxusb_bluebird_dtt7579_properties = { 562 + .caps = DVB_USB_IS_AN_I2C_ADAPTER, 563 + 564 + .usb_ctrl = DEVICE_SPECIFIC, 565 + .firmware = "dvb-usb-bluebird-01.fw", 566 + .download_firmware = bluebird_patch_dvico_firmware_download, 567 + /* use usb alt setting 0 for EP4 transfer (dvb-t), 568 + use usb alt setting 7 for EP2 transfer (atsc) */ 569 + 570 + .size_of_priv = sizeof(struct cxusb_state), 571 + 572 + .streaming_ctrl = cxusb_streaming_ctrl, 573 + .power_ctrl = cxusb_power_ctrl, 574 + .frontend_attach = cxusb_mt352_frontend_attach, 575 + .tuner_attach = cxusb_dtt7579_tuner_attach, 576 + 577 + .i2c_algo = &cxusb_i2c_algo, 578 + 579 + .generic_bulk_ctrl_endpoint = 0x01, 580 + /* parameter for the MPEG2-data transfer */ 581 + .urb = { 582 + .type = DVB_USB_BULK, 583 + .count = 5, 584 + .endpoint = 0x04, 585 + .u = { 586 + .bulk = { 587 + .buffersize = 8192, 588 + } 589 + } 590 + }, 591 + 592 + .num_device_descs = 1, 593 + .devices = { 594 + { "DViCO FusionHDTV DVB-T USB (TH7579)", 595 + { &cxusb_table[7], NULL }, 596 + { &cxusb_table[8], NULL }, 577 597 }, 578 598 } 579 599 };
+1 -2
drivers/media/dvb/dvb-usb/dtt200u-fe.c
··· 156 156 struct dtt200u_fe_state* state = NULL; 157 157 158 158 /* allocate memory for the internal state */ 159 - state = (struct dtt200u_fe_state*) kmalloc(sizeof(struct dtt200u_fe_state), GFP_KERNEL); 159 + state = kzalloc(sizeof(struct dtt200u_fe_state), GFP_KERNEL); 160 160 if (state == NULL) 161 161 goto error; 162 - memset(state,0,sizeof(struct dtt200u_fe_state)); 163 162 164 163 deb_info("attaching frontend dtt200u\n"); 165 164
+2
drivers/media/dvb/dvb-usb/dvb-usb-ids.h
··· 95 95 #define USB_PID_DVICO_BLUEBIRD_TH7579_WARM 0xdb11 96 96 #define USB_PID_DVICO_BLUEBIRD_DEE1601_COLD 0xdb50 97 97 #define USB_PID_DVICO_BLUEBIRD_DEE1601_WARM 0xdb51 98 + #define USB_PID_DIGITALNOW_BLUEBIRD_DEE1601_COLD 0xdb54 99 + #define USB_PID_DIGITALNOW_BLUEBIRD_DEE1601_WARM 0xdb55 98 100 #define USB_PID_MEDION_MD95700 0x0932 99 101 #define USB_PID_KYE_DVB_T_COLD 0x701e 100 102 #define USB_PID_KYE_DVB_T_WARM 0x701f
+2 -4
drivers/media/dvb/dvb-usb/dvb-usb-init.c
··· 154 154 } 155 155 156 156 info("found a '%s' in warm state.",desc->name); 157 - d = kmalloc(sizeof(struct dvb_usb_device),GFP_KERNEL); 157 + d = kzalloc(sizeof(struct dvb_usb_device),GFP_KERNEL); 158 158 if (d == NULL) { 159 159 err("no memory for 'struct dvb_usb_device'"); 160 160 return ret; 161 161 } 162 - memset(d,0,sizeof(struct dvb_usb_device)); 163 162 164 163 d->udev = udev; 165 164 memcpy(&d->props,props,sizeof(struct dvb_usb_properties)); ··· 166 167 d->owner = owner; 167 168 168 169 if (d->props.size_of_priv > 0) { 169 - d->priv = kmalloc(d->props.size_of_priv,GFP_KERNEL); 170 + d->priv = kzalloc(d->props.size_of_priv,GFP_KERNEL); 170 171 if (d->priv == NULL) { 171 172 err("no memory for priv in 'struct dvb_usb_device'"); 172 173 kfree(d); 173 174 return -ENOMEM; 174 175 } 175 - memset(d->priv,0,d->props.size_of_priv); 176 176 } 177 177 178 178 usb_set_intfdata(intf, d);
+3 -6
drivers/media/dvb/dvb-usb/dvb-usb-urb.c
··· 175 175 176 176 deb_mem("all in all I will use %lu bytes for streaming\n",num*size); 177 177 178 - if ((d->buf_list = kmalloc(num*sizeof(u8 *), GFP_ATOMIC)) == NULL) 178 + if ((d->buf_list = kcalloc(num, sizeof(u8 *), GFP_ATOMIC)) == NULL) 179 179 return -ENOMEM; 180 180 181 - if ((d->dma_addr = kmalloc(num*sizeof(dma_addr_t), GFP_ATOMIC)) == NULL) { 181 + if ((d->dma_addr = kcalloc(num, sizeof(dma_addr_t), GFP_ATOMIC)) == NULL) { 182 182 kfree(d->buf_list); 183 183 return -ENOMEM; 184 184 } 185 - memset(d->buf_list,0,num*sizeof(u8 *)); 186 - memset(d->dma_addr,0,num*sizeof(dma_addr_t)); 187 185 188 186 d->state |= DVB_USB_STATE_URB_BUF; 189 187 ··· 283 285 usb_clear_halt(d->udev,usb_rcvbulkpipe(d->udev,d->props.urb.endpoint)); 284 286 285 287 /* allocate the array for the data transfer URBs */ 286 - d->urb_list = kmalloc(d->props.urb.count * sizeof(struct urb *),GFP_KERNEL); 288 + d->urb_list = kzalloc(d->props.urb.count * sizeof(struct urb *),GFP_KERNEL); 287 289 if (d->urb_list == NULL) 288 290 return -ENOMEM; 289 - memset(d->urb_list,0,d->props.urb.count * sizeof(struct urb *)); 290 291 d->state |= DVB_USB_STATE_URB_LIST; 291 292 292 293 switch (d->props.urb.type) {
+1 -2
drivers/media/dvb/dvb-usb/vp702x-fe.c
··· 281 281 282 282 struct dvb_frontend * vp702x_fe_attach(struct dvb_usb_device *d) 283 283 { 284 - struct vp702x_fe_state *s = kmalloc(sizeof(struct vp702x_fe_state), GFP_KERNEL); 284 + struct vp702x_fe_state *s = kzalloc(sizeof(struct vp702x_fe_state), GFP_KERNEL); 285 285 if (s == NULL) 286 286 goto error; 287 - memset(s,0,sizeof(struct vp702x_fe_state)); 288 287 289 288 s->d = d; 290 289 s->fe.ops = &vp702x_fe_ops;
+1 -2
drivers/media/dvb/dvb-usb/vp7045-fe.c
··· 145 145 146 146 struct dvb_frontend * vp7045_fe_attach(struct dvb_usb_device *d) 147 147 { 148 - struct vp7045_fe_state *s = kmalloc(sizeof(struct vp7045_fe_state), GFP_KERNEL); 148 + struct vp7045_fe_state *s = kzalloc(sizeof(struct vp7045_fe_state), GFP_KERNEL); 149 149 if (s == NULL) 150 150 goto error; 151 - memset(s,0,sizeof(struct vp7045_fe_state)); 152 151 153 152 s->d = d; 154 153 s->fe.ops = &vp7045_fe_ops;
+1 -2
drivers/media/dvb/frontends/bcm3510.c
··· 782 782 bcm3510_register_value v; 783 783 784 784 /* allocate memory for the internal state */ 785 - state = kmalloc(sizeof(struct bcm3510_state), GFP_KERNEL); 785 + state = kzalloc(sizeof(struct bcm3510_state), GFP_KERNEL); 786 786 if (state == NULL) 787 787 goto error; 788 - memset(state,0,sizeof(struct bcm3510_state)); 789 788 790 789 /* setup the state */ 791 790
+1 -2
drivers/media/dvb/frontends/dib3000mb.c
··· 700 700 struct dib3000_state* state = NULL; 701 701 702 702 /* allocate memory for the internal state */ 703 - state = kmalloc(sizeof(struct dib3000_state), GFP_KERNEL); 703 + state = kzalloc(sizeof(struct dib3000_state), GFP_KERNEL); 704 704 if (state == NULL) 705 705 goto error; 706 - memset(state,0,sizeof(struct dib3000_state)); 707 706 708 707 /* setup the state */ 709 708 state->i2c = i2c;
+1 -2
drivers/media/dvb/frontends/dib3000mc.c
··· 832 832 u16 devid; 833 833 834 834 /* allocate memory for the internal state */ 835 - state = kmalloc(sizeof(struct dib3000_state), GFP_KERNEL); 835 + state = kzalloc(sizeof(struct dib3000_state), GFP_KERNEL); 836 836 if (state == NULL) 837 837 goto error; 838 - memset(state,0,sizeof(struct dib3000_state)); 839 838 840 839 /* setup the state */ 841 840 state->i2c = i2c;
+17
drivers/media/dvb/frontends/dvb-pll.c
··· 345 345 }; 346 346 EXPORT_SYMBOL(dvb_pll_tbmv30111in); 347 347 348 + /* 349 + * Philips SD1878 Tuner. 350 + */ 351 + struct dvb_pll_desc dvb_pll_philips_sd1878_tda8261 = { 352 + .name = "Philips SD1878", 353 + .min = 950000, 354 + .max = 2150000, 355 + .count = 4, 356 + .entries = { 357 + { 1250000, 499, 500, 0xc4, 0x00}, 358 + { 1550000, 499, 500, 0xc4, 0x40}, 359 + { 2050000, 499, 500, 0xc4, 0x80}, 360 + { 2150000, 499, 500, 0xc4, 0xc0}, 361 + }, 362 + }; 363 + EXPORT_SYMBOL(dvb_pll_philips_sd1878_tda8261); 364 + 348 365 /* ----------------------------------------------------------- */ 349 366 /* code */ 350 367
+1
drivers/media/dvb/frontends/dvb-pll.h
··· 39 39 extern struct dvb_pll_desc dvb_pll_tuv1236d; 40 40 extern struct dvb_pll_desc dvb_pll_tdhu2; 41 41 extern struct dvb_pll_desc dvb_pll_tbmv30111in; 42 + extern struct dvb_pll_desc dvb_pll_philips_sd1878_tda8261; 42 43 43 44 int dvb_pll_configure(struct dvb_pll_desc *desc, u8 *buf, 44 45 u32 freq, int bandwidth);
+1 -2
drivers/media/dvb/frontends/lgdt330x.c
··· 714 714 u8 buf[1]; 715 715 716 716 /* Allocate memory for the internal state */ 717 - state = (struct lgdt330x_state*) kmalloc(sizeof(struct lgdt330x_state), GFP_KERNEL); 717 + state = kzalloc(sizeof(struct lgdt330x_state), GFP_KERNEL); 718 718 if (state == NULL) 719 719 goto error; 720 - memset(state,0,sizeof(*state)); 721 720 722 721 /* Setup the state */ 723 722 state->config = config;
+1 -2
drivers/media/dvb/frontends/mt352.c
··· 535 535 struct mt352_state* state = NULL; 536 536 537 537 /* allocate memory for the internal state */ 538 - state = kmalloc(sizeof(struct mt352_state), GFP_KERNEL); 538 + state = kzalloc(sizeof(struct mt352_state), GFP_KERNEL); 539 539 if (state == NULL) goto error; 540 - memset(state,0,sizeof(*state)); 541 540 542 541 /* setup the state */ 543 542 state->i2c = i2c;
+1 -2
drivers/media/dvb/frontends/nxt200x.c
··· 1110 1110 u8 buf [] = {0,0,0,0,0}; 1111 1111 1112 1112 /* allocate memory for the internal state */ 1113 - state = (struct nxt200x_state*) kmalloc(sizeof(struct nxt200x_state), GFP_KERNEL); 1113 + state = kzalloc(sizeof(struct nxt200x_state), GFP_KERNEL); 1114 1114 if (state == NULL) 1115 1115 goto error; 1116 - memset(state,0,sizeof(*state)); 1117 1116 1118 1117 /* setup the state */ 1119 1118 state->config = config;
+1 -2
drivers/media/dvb/pluto2/pluto2.c
··· 584 584 struct dmx_demux *dmx; 585 585 int ret = -ENOMEM; 586 586 587 - pluto = kmalloc(sizeof(struct pluto), GFP_KERNEL); 587 + pluto = kzalloc(sizeof(struct pluto), GFP_KERNEL); 588 588 if (!pluto) 589 589 goto out; 590 590 591 - memset(pluto, 0, sizeof(struct pluto)); 592 591 pluto->pdev = pdev; 593 592 594 593 ret = pci_enable_device(pdev);
+1 -3
drivers/media/dvb/ttpci/av7110.c
··· 2565 2565 } 2566 2566 2567 2567 /* prepare the av7110 device struct */ 2568 - av7110 = kmalloc(sizeof(struct av7110), GFP_KERNEL); 2568 + av7110 = kzalloc(sizeof(struct av7110), GFP_KERNEL); 2569 2569 if (!av7110) { 2570 2570 dprintk(1, "out of memory\n"); 2571 2571 return -ENOMEM; 2572 2572 } 2573 - 2574 - memset(av7110, 0, sizeof(struct av7110)); 2575 2573 2576 2574 av7110->card_name = (char*) pci_ext->ext_priv; 2577 2575 av7110->dev = dev;
+126 -3
drivers/media/dvb/ttpci/budget-av.c
··· 37 37 #include "stv0299.h" 38 38 #include "tda10021.h" 39 39 #include "tda1004x.h" 40 + #include "dvb-pll.h" 40 41 #include <media/saa7146_vv.h> 41 42 #include <linux/module.h> 42 43 #include <linux/errno.h> ··· 865 864 .request_firmware = philips_tu1216_request_firmware, 866 865 }; 867 866 867 + static u8 philips_sd1878_inittab[] = { 868 + 0x01, 0x15, 869 + 0x02, 0x30, 870 + 0x03, 0x00, 871 + 0x04, 0x7d, 872 + 0x05, 0x35, 873 + 0x06, 0x40, 874 + 0x07, 0x00, 875 + 0x08, 0x43, 876 + 0x09, 0x02, 877 + 0x0C, 0x51, 878 + 0x0D, 0x82, 879 + 0x0E, 0x23, 880 + 0x10, 0x3f, 881 + 0x11, 0x84, 882 + 0x12, 0xb9, 883 + 0x15, 0xc9, 884 + 0x16, 0x19, 885 + 0x17, 0x8c, 886 + 0x18, 0x59, 887 + 0x19, 0xf8, 888 + 0x1a, 0xfe, 889 + 0x1c, 0x7f, 890 + 0x1d, 0x00, 891 + 0x1e, 0x00, 892 + 0x1f, 0x50, 893 + 0x20, 0x00, 894 + 0x21, 0x00, 895 + 0x22, 0x00, 896 + 0x23, 0x00, 897 + 0x28, 0x00, 898 + 0x29, 0x28, 899 + 0x2a, 0x14, 900 + 0x2b, 0x0f, 901 + 0x2c, 0x09, 902 + 0x2d, 0x09, 903 + 0x31, 0x1f, 904 + 0x32, 0x19, 905 + 0x33, 0xfc, 906 + 0x34, 0x93, 907 + 0xff, 0xff 908 + }; 868 909 910 + static int philips_sd1878_tda8261_pll_set(struct dvb_frontend *fe, 911 + struct i2c_adapter *i2c, 912 + struct dvb_frontend_parameters *params) 913 + { 914 + u8 buf[4]; 915 + int rc; 916 + struct i2c_msg tuner_msg = {.addr=0x60,.flags=0,.buf=buf,.len=sizeof(buf)}; 869 917 918 + if((params->frequency < 950000) || (params->frequency > 2150000)) 919 + return -EINVAL; 920 + 921 + rc=dvb_pll_configure(&dvb_pll_philips_sd1878_tda8261, buf, 922 + params->frequency, 0); 923 + if(rc < 0) return rc; 924 + 925 + if(i2c_transfer(i2c, &tuner_msg, 1) != 1) 926 + return -EIO; 927 + 928 + return 0; 929 + } 930 + 931 + static int philips_sd1878_ci_set_symbol_rate(struct dvb_frontend *fe, 932 + u32 srate, u32 ratio) 933 + { 934 + u8 aclk = 0; 935 + u8 bclk = 0; 936 + u8 m1; 937 + 938 + aclk = 0xb5; 939 + if (srate < 2000000) 940 + bclk = 0x86; 941 + else if (srate < 5000000) 942 + bclk = 0x89; 943 + else if (srate < 15000000) 944 + bclk = 0x8f; 945 + else if (srate < 45000000) 946 + bclk = 0x95; 947 + 948 + m1 = 0x14; 949 + if (srate < 4000000) 950 + m1 = 0x10; 951 + 952 + stv0299_writereg(fe, 0x0e, 0x23); 953 + stv0299_writereg(fe, 0x0f, 0x94); 954 + stv0299_writereg(fe, 0x10, 0x39); 955 + stv0299_writereg(fe, 0x13, aclk); 956 + stv0299_writereg(fe, 0x14, bclk); 957 + stv0299_writereg(fe, 0x15, 0xc9); 958 + stv0299_writereg(fe, 0x1f, (ratio >> 16) & 0xff); 959 + stv0299_writereg(fe, 0x20, (ratio >> 8) & 0xff); 960 + stv0299_writereg(fe, 0x21, (ratio) & 0xf0); 961 + stv0299_writereg(fe, 0x0f, 0x80 | m1); 962 + 963 + return 0; 964 + } 965 + 966 + static struct stv0299_config philips_sd1878_config = { 967 + .demod_address = 0x68, 968 + .inittab = philips_sd1878_inittab, 969 + .mclk = 88000000UL, 970 + .invert = 0, 971 + .skip_reinit = 0, 972 + .lock_output = STV0229_LOCKOUTPUT_1, 973 + .volt13_op0_op1 = STV0299_VOLT13_OP0, 974 + .min_delay_ms = 100, 975 + .set_symbol_rate = philips_sd1878_ci_set_symbol_rate, 976 + .pll_set = philips_sd1878_tda8261_pll_set, 977 + }; 870 978 871 979 static u8 read_pwm(struct budget_av *budget_av) 872 980 { ··· 996 886 #define SUBID_DVBS_KNC1_PLUS 0x0011 997 887 #define SUBID_DVBS_TYPHOON 0x4f56 998 888 #define SUBID_DVBS_CINERGY1200 0x1154 889 + #define SUBID_DVBS_CYNERGY1200N 0x1155 999 890 891 + #define SUBID_DVBS_TV_STAR 0x0014 892 + #define SUBID_DVBS_TV_STAR_CI 0x0016 1000 893 #define SUBID_DVBC_KNC1 0x0020 1001 894 #define SUBID_DVBC_KNC1_PLUS 0x0021 1002 895 #define SUBID_DVBC_CINERGY1200 0x1156 ··· 1033 920 fe = stv0299_attach(&typhoon_config, 1034 921 &budget_av->budget.i2c_adap); 1035 922 } 923 + break; 924 + 925 + case SUBID_DVBS_TV_STAR: 926 + case SUBID_DVBS_TV_STAR_CI: 927 + case SUBID_DVBS_CYNERGY1200N: 928 + fe = stv0299_attach(&philips_sd1878_config, 929 + &budget_av->budget.i2c_adap); 1036 930 break; 1037 931 1038 932 case SUBID_DVBS_KNC1_PLUS: ··· 1147 1027 1148 1028 dprintk(2, "dev: %p\n", dev); 1149 1029 1150 - if (!(budget_av = kmalloc(sizeof(struct budget_av), GFP_KERNEL))) 1030 + if (!(budget_av = kzalloc(sizeof(struct budget_av), GFP_KERNEL))) 1151 1031 return -ENOMEM; 1152 - 1153 - memset(budget_av, 0, sizeof(struct budget_av)); 1154 1032 1155 1033 budget_av->has_saa7113 = 0; 1156 1034 budget_av->budget.ci_present = 0; ··· 1284 1166 MAKE_BUDGET_INFO(knc1s, "KNC1 DVB-S", BUDGET_KNC1S); 1285 1167 MAKE_BUDGET_INFO(knc1c, "KNC1 DVB-C", BUDGET_KNC1C); 1286 1168 MAKE_BUDGET_INFO(knc1t, "KNC1 DVB-T", BUDGET_KNC1T); 1169 + MAKE_BUDGET_INFO(kncxs, "KNC TV STAR DVB-S", BUDGET_TVSTAR); 1287 1170 MAKE_BUDGET_INFO(knc1sp, "KNC1 DVB-S Plus", BUDGET_KNC1SP); 1288 1171 MAKE_BUDGET_INFO(knc1cp, "KNC1 DVB-C Plus", BUDGET_KNC1CP); 1289 1172 MAKE_BUDGET_INFO(knc1tp, "KNC1 DVB-T Plus", BUDGET_KNC1TP); 1290 1173 MAKE_BUDGET_INFO(cin1200s, "TerraTec Cinergy 1200 DVB-S", BUDGET_CIN1200S); 1174 + MAKE_BUDGET_INFO(cin1200sn, "TerraTec Cinergy 1200 DVB-S", BUDGET_CIN1200S); 1291 1175 MAKE_BUDGET_INFO(cin1200c, "Terratec Cinergy 1200 DVB-C", BUDGET_CIN1200C); 1292 1176 MAKE_BUDGET_INFO(cin1200t, "Terratec Cinergy 1200 DVB-T", BUDGET_CIN1200T); 1293 1177 ··· 1298 1178 MAKE_EXTENSION_PCI(knc1s, 0x1131, 0x0010), 1299 1179 MAKE_EXTENSION_PCI(knc1s, 0x1894, 0x0010), 1300 1180 MAKE_EXTENSION_PCI(knc1sp, 0x1131, 0x0011), 1181 + MAKE_EXTENSION_PCI(kncxs, 0x1894, 0x0014), 1182 + MAKE_EXTENSION_PCI(kncxs, 0x1894, 0x0016), 1301 1183 MAKE_EXTENSION_PCI(knc1c, 0x1894, 0x0020), 1302 1184 MAKE_EXTENSION_PCI(knc1cp, 0x1894, 0x0021), 1303 1185 MAKE_EXTENSION_PCI(knc1t, 0x1894, 0x0030), 1304 1186 MAKE_EXTENSION_PCI(knc1tp, 0x1894, 0x0031), 1305 1187 MAKE_EXTENSION_PCI(cin1200s, 0x153b, 0x1154), 1188 + MAKE_EXTENSION_PCI(cin1200sn, 0x153b, 0x1155), 1306 1189 MAKE_EXTENSION_PCI(cin1200c, 0x153b, 0x1156), 1307 1190 MAKE_EXTENSION_PCI(cin1200t, 0x153b, 0x1157), 1308 1191 {
+1
drivers/media/dvb/ttpci/budget.h
··· 95 95 #define BUDGET_KNC1SP 11 96 96 #define BUDGET_KNC1CP 12 97 97 #define BUDGET_KNC1TP 13 98 + #define BUDGET_TVSTAR 14 98 99 99 100 #define BUDGET_VIDEO_PORTA 0 100 101 #define BUDGET_VIDEO_PORTB 1
+1 -3
drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
··· 1489 1489 1490 1490 if (intf->altsetting->desc.bInterfaceNumber != 1) return -ENODEV; 1491 1491 1492 - if (!(ttusb = kmalloc(sizeof(struct ttusb), GFP_KERNEL))) 1492 + if (!(ttusb = kzalloc(sizeof(struct ttusb), GFP_KERNEL))) 1493 1493 return -ENOMEM; 1494 - 1495 - memset(ttusb, 0, sizeof(struct ttusb)); 1496 1494 1497 1495 ttusb->dev = udev; 1498 1496 ttusb->c = 0;
+1 -3
drivers/media/dvb/ttusb-dec/ttusb_dec.c
··· 1606 1606 1607 1607 udev = interface_to_usbdev(intf); 1608 1608 1609 - if (!(dec = kmalloc(sizeof(struct ttusb_dec), GFP_KERNEL))) { 1609 + if (!(dec = kzalloc(sizeof(struct ttusb_dec), GFP_KERNEL))) { 1610 1610 printk("%s: couldn't allocate memory.\n", __FUNCTION__); 1611 1611 return -ENOMEM; 1612 1612 } 1613 1613 1614 1614 usb_set_intfdata(intf, (void *)dec); 1615 - 1616 - memset(dec, 0, sizeof(struct ttusb_dec)); 1617 1615 1618 1616 switch (le16_to_cpu(id->idProduct)) { 1619 1617 case 0x1006:
+1 -2
drivers/media/radio/radio-gemtek-pci.c
··· 318 318 struct gemtek_pci_card *card; 319 319 struct video_device *devradio; 320 320 321 - if ( (card = kmalloc( sizeof( struct gemtek_pci_card ), GFP_KERNEL )) == NULL ) { 321 + if ( (card = kzalloc( sizeof( struct gemtek_pci_card ), GFP_KERNEL )) == NULL ) { 322 322 printk( KERN_ERR "gemtek_pci: out of memory\n" ); 323 323 return -ENOMEM; 324 324 } 325 - memset( card, 0, sizeof( struct gemtek_pci_card ) ); 326 325 327 326 if ( pci_enable_device( pci_dev ) ) 328 327 goto err_pci;
+1 -1
drivers/media/video/Kconfig
··· 183 183 help 184 184 Say Y here to enable support for the Stradis 4:2:2 MPEG-2 video 185 185 driver for PCI. There is a product page at 186 - <http://www.stradis.com/decoder.html>. 186 + <http://www.stradis.com/>. 187 187 188 188 config VIDEO_ZORAN 189 189 tristate "Zoran ZR36057/36067 Video For Linux"
+2 -4
drivers/media/video/adv7170.c
··· 413 413 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) 414 414 return 0; 415 415 416 - client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); 416 + client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); 417 417 if (client == 0) 418 418 return -ENOMEM; 419 - memset(client, 0, sizeof(struct i2c_client)); 420 419 client->addr = address; 421 420 client->adapter = adapter; 422 421 client->driver = &i2c_driver_adv7170; ··· 432 433 } 433 434 strlcpy(I2C_NAME(client), dname, sizeof(I2C_NAME(client))); 434 435 435 - encoder = kmalloc(sizeof(struct adv7170), GFP_KERNEL); 436 + encoder = kzalloc(sizeof(struct adv7170), GFP_KERNEL); 436 437 if (encoder == NULL) { 437 438 kfree(client); 438 439 return -ENOMEM; 439 440 } 440 - memset(encoder, 0, sizeof(struct adv7170)); 441 441 encoder->norm = VIDEO_MODE_NTSC; 442 442 encoder->input = 0; 443 443 encoder->enable = 1;
+2 -4
drivers/media/video/adv7175.c
··· 463 463 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) 464 464 return 0; 465 465 466 - client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); 466 + client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); 467 467 if (client == 0) 468 468 return -ENOMEM; 469 - memset(client, 0, sizeof(struct i2c_client)); 470 469 client->addr = address; 471 470 client->adapter = adapter; 472 471 client->driver = &i2c_driver_adv7175; ··· 482 483 } 483 484 strlcpy(I2C_NAME(client), dname, sizeof(I2C_NAME(client))); 484 485 485 - encoder = kmalloc(sizeof(struct adv7175), GFP_KERNEL); 486 + encoder = kzalloc(sizeof(struct adv7175), GFP_KERNEL); 486 487 if (encoder == NULL) { 487 488 kfree(client); 488 489 return -ENOMEM; 489 490 } 490 - memset(encoder, 0, sizeof(struct adv7175)); 491 491 encoder->norm = VIDEO_MODE_PAL; 492 492 encoder->input = 0; 493 493 encoder->enable = 1;
+2 -5
drivers/media/video/bt819.c
··· 528 528 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) 529 529 return 0; 530 530 531 - client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); 531 + client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); 532 532 if (client == 0) 533 533 return -ENOMEM; 534 - memset(client, 0, sizeof(struct i2c_client)); 535 534 client->addr = address; 536 535 client->adapter = adapter; 537 536 client->driver = &i2c_driver_bt819; 538 537 539 - decoder = kmalloc(sizeof(struct bt819), GFP_KERNEL); 538 + decoder = kzalloc(sizeof(struct bt819), GFP_KERNEL); 540 539 if (decoder == NULL) { 541 540 kfree(client); 542 541 return -ENOMEM; 543 542 } 544 - 545 - memset(decoder, 0, sizeof(struct bt819)); 546 543 decoder->norm = VIDEO_MODE_NTSC; 547 544 decoder->input = 0; 548 545 decoder->enable = 1;
+3 -4
drivers/media/video/bt832.c
··· 75 75 76 76 if(debug>1) { 77 77 int i; 78 - v4l_dbg(2,i2c_client_s,"hexdump:"); 78 + v4l_dbg(2, debug,i2c_client_s,"hexdump:"); 79 79 for(i=1;i<65;i++) { 80 80 if(i!=1) { 81 81 if(((i-1)%8)==0) printk(" "); 82 82 if(((i-1)%16)==0) { 83 83 printk("\n"); 84 - v4l_dbg(2,i2c_client_s,"hexdump:"); 84 + v4l_dbg(2, debug,i2c_client_s,"hexdump:"); 85 85 } 86 86 } 87 87 printk(" %02x",buf[i]); ··· 167 167 client_template.adapter = adap; 168 168 client_template.addr = addr; 169 169 170 - if (NULL == (t = kmalloc(sizeof(*t), GFP_KERNEL))) 170 + if (NULL == (t = kzalloc(sizeof(*t), GFP_KERNEL))) 171 171 return -ENOMEM; 172 - memset(t,0,sizeof(*t)); 173 172 t->client = client_template; 174 173 i2c_set_clientdata(&t->client, t); 175 174 i2c_attach_client(&t->client);
+2 -4
drivers/media/video/bt856.c
··· 316 316 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) 317 317 return 0; 318 318 319 - client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); 319 + client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); 320 320 if (client == 0) 321 321 return -ENOMEM; 322 - memset(client, 0, sizeof(struct i2c_client)); 323 322 client->addr = address; 324 323 client->adapter = adapter; 325 324 client->driver = &i2c_driver_bt856; 326 325 strlcpy(I2C_NAME(client), "bt856", sizeof(I2C_NAME(client))); 327 326 328 - encoder = kmalloc(sizeof(struct bt856), GFP_KERNEL); 327 + encoder = kzalloc(sizeof(struct bt856), GFP_KERNEL); 329 328 if (encoder == NULL) { 330 329 kfree(client); 331 330 return -ENOMEM; 332 331 } 333 - memset(encoder, 0, sizeof(struct bt856)); 334 332 encoder->norm = VIDEO_MODE_NTSC; 335 333 encoder->enable = 1; 336 334 i2c_set_clientdata(client, encoder);
+164 -141
drivers/media/video/bttv-cards.c
··· 321 321 .audio_inputs = 1, 322 322 .tuner = 0, 323 323 .svhs = 2, 324 - .muxsel = { 2, 3, 1, 0}, 324 + .muxsel = { 2, 3, 1, 0 }, 325 325 .tuner_type = -1, 326 326 .tuner_addr = ADDR_UNSET, 327 327 .radio_addr = ADDR_UNSET, ··· 333 333 .tuner = 0, 334 334 .svhs = 2, 335 335 .gpiomask = 15, 336 - .muxsel = { 2, 3, 1, 1}, 337 - .audiomux = { 2, 0, 0, 0, 10}, 336 + .muxsel = { 2, 3, 1, 1 }, 337 + .audiomux = { 2, 0, 0, 0, 10 }, 338 338 .needs_tvaudio = 1, 339 339 .tuner_type = -1, 340 340 .tuner_addr = ADDR_UNSET, ··· 347 347 .tuner = 0, 348 348 .svhs = 2, 349 349 .gpiomask = 7, 350 - .muxsel = { 2, 3, 1, 1}, 351 - .audiomux = { 0, 1, 2, 3, 4}, 350 + .muxsel = { 2, 3, 1, 1 }, 351 + .audiomux = { 0, 1, 2, 3, 4 }, 352 352 .needs_tvaudio = 1, 353 353 .tuner_type = -1, 354 354 .tuner_addr = ADDR_UNSET, ··· 361 361 .tuner = 0, 362 362 .svhs = 2, 363 363 .gpiomask = 7, 364 - .muxsel = { 2, 3, 1, 1}, 365 - .audiomux = { 4, 0, 2, 3, 1}, 364 + .muxsel = { 2, 3, 1, 1 }, 365 + .audiomux = { 4, 0, 2, 3, 1 }, 366 366 .no_msp34xx = 1, 367 367 .needs_tvaudio = 1, 368 368 .tuner_type = TUNER_PHILIPS_NTSC, ··· 380 380 .tuner = -1, 381 381 .svhs = 2, 382 382 .gpiomask = 0, 383 - .muxsel = { 2, 3, 1, 1}, 383 + .muxsel = { 2, 3, 1, 1 }, 384 384 .audiomux = { 0 }, 385 385 .needs_tvaudio = 0, 386 386 .tuner_type = 4, ··· 394 394 .tuner = 0, 395 395 .svhs = 2, 396 396 .gpiomask = 3, 397 - .muxsel = { 2, 3, 1, 0}, 398 - .audiomux = { 0, 1, 0, 1, 3}, 397 + .muxsel = { 2, 3, 1, 0 }, 398 + .audiomux = { 0, 1, 0, 1, 3 }, 399 399 .needs_tvaudio = 1, 400 400 .tuner_type = -1, 401 401 .tuner_addr = ADDR_UNSET, ··· 407 407 .audio_inputs = 1, 408 408 .tuner = 0, 409 409 .svhs = 3, 410 - .muxsel = { 2, 3, 1, 1}, 410 + .muxsel = { 2, 3, 1, 1 }, 411 411 .gpiomask = 0x0f, 412 - .audiomux = { 0x0c, 0x04, 0x08, 0x04, 0}, 412 + .audiomux = { 0x0c, 0x04, 0x08, 0x04, 0 }, 413 413 /* 0x04 for some cards ?? */ 414 414 .needs_tvaudio = 1, 415 415 .tuner_type = -1, ··· 425 425 .tuner = -1, 426 426 .svhs = 3, 427 427 .gpiomask = 0, 428 - .muxsel = { 2, 3, 1, 0, 0}, 429 - .audiomux = {0 }, 428 + .muxsel = { 2, 3, 1, 0, 0 }, 429 + .audiomux = { 0 }, 430 430 .needs_tvaudio = 1, 431 431 .tuner_type = -1, 432 432 .tuner_addr = ADDR_UNSET, ··· 441 441 .tuner = 0, 442 442 .svhs = 2, 443 443 .gpiomask = 0xc00, 444 - .muxsel = { 2, 3, 1, 1}, 445 - .audiomux = { 0, 0xc00, 0x800, 0x400, 0xc00, 0}, 444 + .muxsel = { 2, 3, 1, 1 }, 445 + .audiomux = { 0, 0xc00, 0x800, 0x400, 0xc00, 0 }, 446 446 .needs_tvaudio = 1, 447 447 .pll = PLL_28, 448 448 .tuner_type = -1, ··· 456 456 .tuner = 0, 457 457 .svhs = 2, 458 458 .gpiomask = 3, 459 - .muxsel = { 2, 3, 1, 1}, 460 - .audiomux = { 1, 1, 2, 3, 0}, 459 + .muxsel = { 2, 3, 1, 1 }, 460 + .audiomux = { 1, 1, 2, 3, 0 }, 461 461 .needs_tvaudio = 0, 462 462 .pll = PLL_28, 463 463 .tuner_type = TUNER_TEMIC_PAL, ··· 471 471 .tuner = 0, 472 472 .svhs = 2, 473 473 .gpiomask = 0x0f, /* old: 7 */ 474 - .muxsel = { 2, 0, 1, 1}, 475 - .audiomux = { 0, 1, 2, 3, 4}, 474 + .muxsel = { 2, 0, 1, 1 }, 475 + .audiomux = { 0, 1, 2, 3, 4 }, 476 476 .needs_tvaudio = 1, 477 477 .pll = PLL_28, 478 478 .tuner_type = -1, ··· 486 486 .tuner = 0, 487 487 .svhs = 2, 488 488 .gpiomask = 0x3014f, 489 - .muxsel = { 2, 3, 1, 1}, 490 - .audiomux = { 0x20001,0x10001, 0, 0,10}, 489 + .muxsel = { 2, 3, 1, 1 }, 490 + .audiomux = { 0x20001,0x10001, 0, 0,10 }, 491 491 .needs_tvaudio = 1, 492 492 .tuner_type = -1, 493 493 .tuner_addr = ADDR_UNSET, ··· 502 502 .tuner = 0, 503 503 .svhs = 2, 504 504 .gpiomask = 15, 505 - .muxsel = { 2, 3, 1, 1}, 506 - .audiomux = { 13, 14, 11, 7, 0, 0}, 505 + .muxsel = { 2, 3, 1, 1 }, 506 + .audiomux = { 13, 14, 11, 7, 0, 0 }, 507 507 .needs_tvaudio = 1, 508 508 .tuner_type = -1, 509 509 .tuner_addr = ADDR_UNSET, ··· 516 516 .tuner = 0, 517 517 .svhs = 2, 518 518 .gpiomask = 15, 519 - .muxsel = { 2, 3, 1, 1}, 520 - .audiomux = { 13, 14, 11, 7, 0, 0}, 519 + .muxsel = { 2, 3, 1, 1 }, 520 + .audiomux = { 13, 14, 11, 7, 0, 0 }, 521 521 .needs_tvaudio = 1, 522 522 .msp34xx_alt = 1, 523 523 .pll = PLL_28, ··· 534 534 .tuner = 0, 535 535 .svhs = 2, 536 536 .gpiomask = 7, 537 - .muxsel = { 2, 3, 1, 1}, 538 - .audiomux = { 0, 2, 1, 3, 4}, /* old: { 0, 1, 2, 3, 4} */ 537 + .muxsel = { 2, 3, 1, 1 }, 538 + .audiomux = { 0, 2, 1, 3, 4 }, /* old: {0, 1, 2, 3, 4} */ 539 539 .needs_tvaudio = 1, 540 540 .pll = PLL_28, 541 541 .tuner_type = -1, ··· 549 549 .tuner = 0, 550 550 .svhs = 2, 551 551 .gpiomask = 15, 552 - .muxsel = { 2, 3, 1, 1}, 553 - .audiomux = {0 , 0, 1 , 0, 10}, 552 + .muxsel = { 2, 3, 1, 1 }, 553 + .audiomux = { 0 , 0, 1 , 0, 10 }, 554 554 .needs_tvaudio = 1, 555 555 .tuner_type = -1, 556 556 .tuner_addr = ADDR_UNSET, ··· 565 565 .tuner = 0, 566 566 .svhs = 2, 567 567 .gpiomask = 0x01fe00, 568 - .muxsel = { 2, 3, 1, 1}, 568 + .muxsel = { 2, 3, 1, 1 }, 569 569 #if 0 570 570 /* old */ 571 571 .audiomux = { 0x01c000, 0, 0x018000, 0x014000, 0x002000, 0 }, ··· 584 584 .tuner = 0, 585 585 .svhs = 2, 586 586 .gpiomask = 0x8300f8, 587 - .muxsel = { 2, 3, 1, 1,0}, 588 - .audiomux = { 0x4fa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007}, 587 + .muxsel = { 2, 3, 1, 1,0 }, 588 + .audiomux = { 0x4fa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007 }, 589 589 .needs_tvaudio = 1, 590 590 .tuner_type = -1, 591 591 .tuner_addr = ADDR_UNSET, ··· 600 600 .tuner = 0, 601 601 .svhs = 2, 602 602 .gpiomask = 0, 603 - .muxsel = {2, 3, 1, 1}, 604 - .audiomux = {1, 0, 0, 0, 0}, 603 + .muxsel = { 2, 3, 1, 1 }, 604 + .audiomux = { 1, 0, 0, 0, 0 }, 605 605 .needs_tvaudio = 1, 606 606 .tuner_type = -1, 607 607 .tuner_addr = ADDR_UNSET, ··· 614 614 .tuner = -1, 615 615 .svhs = -1, 616 616 .gpiomask = 0x8dff00, 617 - .muxsel = { 2, 3, 1, 1}, 617 + .muxsel = { 2, 3, 1, 1 }, 618 618 .audiomux = { 0 }, 619 619 .no_msp34xx = 1, 620 620 .tuner_type = -1, ··· 629 629 .audio_inputs = 3, 630 630 .tuner = 0, 631 631 .svhs = 2, 632 - .muxsel = {2, 3, 1, 1}, 632 + .muxsel = { 2, 3, 1, 1 }, 633 633 .tuner_type = -1, 634 634 .tuner_addr = ADDR_UNSET, 635 635 .radio_addr = ADDR_UNSET, ··· 641 641 .tuner = 0, 642 642 .svhs = 2, 643 643 .gpiomask = 0x1800, 644 - .muxsel = { 2, 3, 1, 1}, 645 - .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800}, 644 + .muxsel = { 2, 3, 1, 1 }, 645 + .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800 }, 646 646 .pll = PLL_28, 647 647 .tuner_type = TUNER_PHILIPS_PAL_I, 648 648 .tuner_addr = ADDR_UNSET, ··· 655 655 .tuner = 0, 656 656 .svhs = 2, 657 657 .gpiomask = 0xc00, 658 - .muxsel = { 2, 3, 1, 1}, 659 - .audiomux = {0, 1, 0x800, 0x400, 0xc00, 0}, 658 + .muxsel = { 2, 3, 1, 1 }, 659 + .audiomux = { 0, 1, 0x800, 0x400, 0xc00, 0 }, 660 660 .needs_tvaudio = 1, 661 661 .pll = PLL_28, 662 662 .tuner_type = -1, ··· 688 688 .tuner = 0, 689 689 .svhs = 2, 690 690 .gpiomask = 0xe00, 691 - .muxsel = { 2, 3, 1, 1}, 692 - .audiomux = {0x400, 0x400, 0x400, 0x400, 0xc00}, 691 + .muxsel = { 2, 3, 1, 1 }, 692 + .audiomux = {0x400, 0x400, 0x400, 0x400, 0xc00 }, 693 693 .needs_tvaudio = 1, 694 694 .pll = PLL_28, 695 695 .tuner_type = -1, ··· 704 704 .tuner = 0, 705 705 .svhs = 2, 706 706 .gpiomask = 0x1f0fff, 707 - .muxsel = { 2, 3, 1, 1}, 708 - .audiomux = { 0x20000, 0x30000, 0x10000, 0, 0x40000}, 707 + .muxsel = { 2, 3, 1, 1 }, 708 + .audiomux = { 0x20000, 0x30000, 0x10000, 0, 0x40000 }, 709 709 .needs_tvaudio = 0, 710 710 .tuner_type = TUNER_PHILIPS_PAL, 711 711 .tuner_addr = ADDR_UNSET, ··· 719 719 .tuner = 0, 720 720 .svhs = 3, 721 721 .gpiomask = 7, 722 - .muxsel = { 2, 0, 1, 1}, 723 - .audiomux = { 0, 1, 2, 3, 4}, 722 + .muxsel = { 2, 0, 1, 1 }, 723 + .audiomux = { 0, 1, 2, 3, 4 }, 724 724 .needs_tvaudio = 1, 725 725 .tuner_type = -1, 726 726 .tuner_addr = ADDR_UNSET, ··· 733 733 .tuner = 0, 734 734 .svhs = 2, 735 735 .gpiomask = 0x1800, 736 - .muxsel = { 2, 3, 1, 1}, 737 - .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800}, 736 + .muxsel = { 2, 3, 1, 1 }, 737 + .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800 }, 738 738 .pll = PLL_28, 739 739 .tuner_type = TUNER_PHILIPS_SECAM, 740 740 .tuner_addr = ADDR_UNSET, ··· 749 749 .tuner = 0, 750 750 .svhs = 2, 751 751 .gpiomask = 0x1f0fff, 752 - .muxsel = { 2, 3, 1, 1}, 753 - .audiomux = { 0x20000, 0x30000, 0x10000, 0x00000, 0x40000}, 752 + .muxsel = { 2, 3, 1, 1 }, 753 + .audiomux = { 0x20000, 0x30000, 0x10000, 0x00000, 0x40000 }, 754 754 .needs_tvaudio = 0, 755 755 .tuner_type = TUNER_PHILIPS_PAL, 756 756 .tuner_addr = ADDR_UNSET, ··· 812 812 .tuner = 0, 813 813 .svhs = 2, 814 814 .gpiomask = 0x1800, /* 0x8dfe00 */ 815 - .muxsel = { 2, 3, 1, 1}, 815 + .muxsel = { 2, 3, 1, 1 }, 816 816 .audiomux = { 0, 0x0800, 0x1000, 0x1000, 0x1800, 0 }, 817 817 .pll = PLL_28, 818 818 .tuner_type = -1, ··· 826 826 .tuner = 0, 827 827 .svhs = 3, 828 828 .gpiomask = 1, 829 - .muxsel = { 2, 3, 1, 1}, 829 + .muxsel = { 2, 3, 1, 1 }, 830 830 .audiomux = { 1, 0, 0, 0, 0 }, 831 831 .pll = PLL_28, 832 832 .tuner_type = TUNER_PHILIPS_PAL, ··· 842 842 .tuner = -1, 843 843 .svhs = 2, 844 844 .gpiomask = 0, 845 - .muxsel = { 2, 3, 1, 1}, 845 + .muxsel = { 2, 3, 1, 1 }, 846 846 .audiomux = { 0 }, 847 847 .needs_tvaudio = 0, 848 848 .tuner_type = 4, ··· 856 856 .tuner = 0, 857 857 .svhs = 2, 858 858 .gpiomask = 0xffff00, 859 - .muxsel = { 2, 3, 1, 1}, 860 - .audiomux = { 0x500, 0, 0x300, 0x900, 0x900}, 859 + .muxsel = { 2, 3, 1, 1 }, 860 + .audiomux = { 0x500, 0, 0x300, 0x900, 0x900 }, 861 861 .needs_tvaudio = 1, 862 862 .pll = PLL_28, 863 863 .tuner_type = TUNER_PHILIPS_PAL, ··· 870 870 .audio_inputs = 1, 871 871 .tuner = 0, 872 872 .svhs = 2, 873 - .muxsel = { 2, 3, 1, 1, 0}, /* TV, CVid, SVid, CVid over SVid connector */ 873 + .muxsel = { 2, 3, 1, 1, 0 }, /* TV, CVid, SVid, CVid over SVid connector */ 874 874 #if 0 875 875 .gpiomask = 0xc33000, 876 876 .audiomux = { 0x422000,0x1000,0x0000,0x620000,0x800000 }, ··· 906 906 .tuner = 0, 907 907 .svhs = 2, 908 908 .gpiomask = 0x1800, 909 - .muxsel = { 2, 3, 1, 1}, 910 - .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800}, 909 + .muxsel = { 2, 3, 1, 1 }, 910 + .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800 }, 911 911 .pll = PLL_28, 912 912 .tuner_type = -1, 913 913 .tuner_addr = ADDR_UNSET, ··· 922 922 .tuner = 0, 923 923 .svhs = 2, 924 924 .gpiomask = 0x1800, 925 - .muxsel = { 2, 3, 1, 1}, 925 + .muxsel = { 2, 3, 1, 1 }, 926 926 .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800, 0 }, 927 927 .pll = PLL_28, 928 928 .tuner_type = -1, ··· 952 952 .tuner = 0, 953 953 .svhs = 2, 954 954 .gpiomask = 0x551e00, 955 - .muxsel = { 2, 3, 1, 0}, 955 + .muxsel = { 2, 3, 1, 0 }, 956 956 .audiomux = { 0x551400, 0x551200, 0, 0, 0x551c00, 0x551200 }, 957 957 .needs_tvaudio = 1, 958 958 .pll = PLL_28, ··· 968 968 .tuner = 0, 969 969 .svhs = 2, 970 970 .gpiomask = 0x03000F, 971 - .muxsel = { 2, 3, 1, 1}, 972 - .audiomux = { 2, 0xd0001, 0, 0, 1}, 971 + .muxsel = { 2, 3, 1, 1 }, 972 + .audiomux = { 2, 0xd0001, 0, 0, 1 }, 973 973 .needs_tvaudio = 0, 974 974 .pll = PLL_28, 975 975 .tuner_type = -1, ··· 985 985 .tuner = 0, 986 986 .svhs = 2, 987 987 .gpiomask = 7, 988 - .muxsel = { 2, 3, 1, 1}, 989 - .audiomux = { 4, 0, 2, 3, 1}, 988 + .muxsel = { 2, 3, 1, 1 }, 989 + .audiomux = { 4, 0, 2, 3, 1 }, 990 990 .no_msp34xx = 1, 991 991 .needs_tvaudio = 1, 992 992 .tuner_type = TUNER_PHILIPS_NTSC, ··· 1002 1002 .tuner = 0, 1003 1003 .svhs = 2, 1004 1004 .gpiomask = 15, 1005 - .muxsel = { 2, 3, 1, 1}, 1006 - .audiomux = { 13, 4, 11, 7, 0, 0}, 1005 + .muxsel = { 2, 3, 1, 1 }, 1006 + .audiomux = { 13, 4, 11, 7, 0, 0 }, 1007 1007 .needs_tvaudio = 1, 1008 1008 .pll = PLL_28, 1009 1009 .tuner_type = -1, ··· 1035 1035 .tuner = 0, 1036 1036 .svhs = 2, 1037 1037 .gpiomask = 0xe00b, 1038 - .muxsel = {2, 3, 1, 1}, 1039 - .audiomux = {0xff9ff6, 0xff9ff6, 0xff1ff7, 0, 0xff3ffc}, 1038 + .muxsel = { 2, 3, 1, 1 }, 1039 + .audiomux = { 0xff9ff6, 0xff9ff6, 0xff1ff7, 0, 0xff3ffc }, 1040 1040 .no_msp34xx = 1, 1041 1041 .tuner_type = -1, 1042 1042 .tuner_addr = ADDR_UNSET, ··· 1051 1051 .tuner = 0, 1052 1052 .svhs = -1, 1053 1053 .gpiomask = 3, 1054 - .muxsel = {2, 3, 1, 1}, 1055 - .audiomux = {1, 1, 0, 2, 3}, 1054 + .muxsel = { 2, 3, 1, 1 }, 1055 + .audiomux = { 1, 1, 0, 2, 3 }, 1056 1056 .no_msp34xx = 1, 1057 1057 .pll = PLL_NONE, 1058 1058 .tuner_type = -1, ··· 1066 1066 .tuner = -1, 1067 1067 .svhs = 3, 1068 1068 .gpiomask = 0, 1069 - .muxsel = { 2, 3, 1, 0, 0}, 1070 - .audiomux = {0 }, 1069 + .muxsel = { 2, 3, 1, 0, 0 }, 1070 + .audiomux = { 0 }, 1071 1071 .no_msp34xx = 1, 1072 1072 .pll = PLL_28, 1073 1073 .tuner_type = -1, ··· 1081 1081 .tuner = 0, 1082 1082 .svhs = 2, 1083 1083 .gpiomask = 0xbcf03f, 1084 - .muxsel = { 2, 3, 1, 1}, 1085 - .audiomux = { 0xbc803f, 0xbc903f, 0xbcb03f, 0, 0xbcb03f}, 1084 + .muxsel = { 2, 3, 1, 1 }, 1085 + .audiomux = { 0xbc803f, 0xbc903f, 0xbcb03f, 0, 0xbcb03f }, 1086 1086 .no_msp34xx = 1, 1087 1087 .pll = PLL_28, 1088 1088 .tuner_type = 21, ··· 1096 1096 .tuner = 0, 1097 1097 .svhs = 2, 1098 1098 .gpiomask = 0x70000, 1099 - .muxsel = { 2, 3, 1, 1}, 1099 + .muxsel = { 2, 3, 1, 1 }, 1100 1100 .audiomux = { 0x20000, 0x30000, 0x10000, 0, 0x40000, 0x20000 }, 1101 1101 .needs_tvaudio = 1, 1102 1102 .no_msp34xx = 1, ··· 1115 1115 .tuner = 0, 1116 1116 .svhs = 2, 1117 1117 .gpiomask = 15, 1118 - .muxsel = { 2, 3, 1, 1}, 1119 - .audiomux = {2,0,0,0,1}, 1118 + .muxsel = { 2, 3, 1, 1 }, 1119 + .audiomux = {2,0,0,0,1 }, 1120 1120 .needs_tvaudio = 1, 1121 1121 .pll = PLL_28, 1122 1122 .tuner_type = -1, ··· 1130 1130 .tuner = 0, 1131 1131 .svhs = 2, 1132 1132 .gpiomask = 0x010f00, 1133 - .muxsel = {2, 3, 0, 0}, 1134 - .audiomux = {0x10000, 0, 0x10000, 0, 0, 0}, 1133 + .muxsel = {2, 3, 0, 0 }, 1134 + .audiomux = {0x10000, 0, 0x10000, 0, 0, 0 }, 1135 1135 .no_msp34xx = 1, 1136 1136 .pll = PLL_28, 1137 1137 .tuner_type = TUNER_ALPS_TSHC6_NTSC, ··· 1172 1172 .tuner = 0, 1173 1173 .svhs = 2, 1174 1174 .gpiomask = 7, 1175 - .muxsel = { 2, 0, 1, 1}, 1176 - .audiomux = { 0, 1, 2, 3, 4}, 1175 + .muxsel = { 2, 0, 1, 1 }, 1176 + .audiomux = { 0, 1, 2, 3, 4 }, 1177 1177 .pll = PLL_28, 1178 1178 .tuner_type = -1 /* TUNER_ALPS_TMDH2_NTSC */, 1179 1179 .tuner_addr = ADDR_UNSET, ··· 1189 1189 .tuner = 0, 1190 1190 .svhs = 3, 1191 1191 .gpiomask = 0x03000F, 1192 - .muxsel = { 2, 3, 1, 1}, 1193 - .audiomux = { 1, 0xd0001, 0, 0, 10}, 1192 + .muxsel = { 2, 3, 1, 1 }, 1193 + .audiomux = { 1, 0xd0001, 0, 0, 10 }, 1194 1194 /* sound path (5 sources): 1195 1195 MUX1 (mask 0x03), Enable Pin 0x08 (0=enable, 1=disable) 1196 1196 0= ext. Audio IN ··· 1215 1215 .tuner = 0, 1216 1216 .svhs = 2, 1217 1217 .gpiomask = 0x1c, 1218 - .muxsel = { 2, 3, 1, 1}, 1218 + .muxsel = { 2, 3, 1, 1 }, 1219 1219 .audiomux = { 0, 0, 0x10, 8, 4 }, 1220 1220 .needs_tvaudio = 1, 1221 1221 .pll = PLL_28, ··· 1236 1236 .tuner = 0, 1237 1237 .svhs = 2, 1238 1238 .gpiomask = 0x18e0, 1239 - .muxsel = { 2, 3, 1, 1}, 1239 + .muxsel = { 2, 3, 1, 1 }, 1240 1240 .audiomux = { 0x0000,0x0800,0x1000,0x1000,0x18e0 }, 1241 1241 /* For cards with tda9820/tda9821: 1242 1242 0x0000: Tuner normal stereo ··· 1256 1256 .tuner = 0, 1257 1257 .svhs = 2, 1258 1258 .gpiomask = 0xF, 1259 - .muxsel = { 2, 3, 1, 0}, 1260 - .audiomux = { 2, 0, 0, 0, 10}, 1259 + .muxsel = { 2, 3, 1, 0 }, 1260 + .audiomux = { 2, 0, 0, 0, 10 }, 1261 1261 .needs_tvaudio = 0, 1262 1262 .pll = PLL_28, 1263 1263 .tuner_type = TUNER_TEMIC_PAL, ··· 1274 1274 .tuner = 0, 1275 1275 .svhs = 2, 1276 1276 .gpiomask = 0x1800, 1277 - .muxsel = { 2, 3, 1, 1}, 1277 + .muxsel = { 2, 3, 1, 1 }, 1278 1278 .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800, 0 }, 1279 1279 .pll = PLL_28, 1280 1280 .tuner_type = 5, ··· 1324 1324 .tuner = 0, 1325 1325 .svhs = 2, 1326 1326 .gpiomask = 0x03000F, 1327 - .muxsel = { 2, 3, 1, 0}, 1328 - .audiomux = { 2,0,0,0,1 }, 1327 + .muxsel = { 2, 3, 1, 0 }, 1328 + .audiomux = { 2, 0, 0, 0, 1 }, 1329 1329 .pll = PLL_28, 1330 1330 .tuner_type = 0, 1331 1331 .tuner_addr = ADDR_UNSET, ··· 1341 1341 .tuner = 0, 1342 1342 .svhs = -1, 1343 1343 .gpiomask = 11, 1344 - .muxsel = { 2, 3, 1, 1}, 1345 - .audiomux = { 2, 0, 0, 1, 8}, 1344 + .muxsel = { 2, 3, 1, 1 }, 1345 + .audiomux = { 2, 0, 0, 1, 8 }, 1346 1346 .pll = PLL_35, 1347 1347 .tuner_type = TUNER_TEMIC_PAL, 1348 1348 .tuner_addr = ADDR_UNSET, ··· 1356 1356 .tuner = -1, 1357 1357 .svhs = 1, 1358 1358 .gpiomask = 0xF, 1359 - .muxsel = { 2, 2}, 1359 + .muxsel = { 2, 2 }, 1360 1360 .audiomux = { }, 1361 1361 .no_msp34xx = 1, 1362 1362 .needs_tvaudio = 0, ··· 1375 1375 .tuner = 0, 1376 1376 .svhs = 2, 1377 1377 .gpiomask = 0xFF, 1378 - .muxsel = { 2, 3, 1, 0}, 1379 - .audiomux = { 1, 0, 4, 4, 9}, 1378 + .muxsel = { 2, 3, 1, 0 }, 1379 + .audiomux = { 1, 0, 4, 4, 9 }, 1380 1380 .needs_tvaudio = 0, 1381 1381 .pll = PLL_28, 1382 1382 .tuner_type = TUNER_PHILIPS_PAL, ··· 1392 1392 .svhs = 2, 1393 1393 .gpiomask = 0xf03f, 1394 1394 .muxsel = { 2, 3, 1, 0 }, 1395 - .audiomux = { 0xbffe, 0, 0xbfff, 0, 0xbffe}, 1395 + .audiomux = { 0xbffe, 0, 0xbfff, 0, 0xbffe }, 1396 1396 .pll = PLL_28, 1397 1397 .tuner_type = TUNER_TEMIC_4006FN5_MULTI_PAL, 1398 1398 .tuner_addr = ADDR_UNSET, ··· 1408 1408 .tuner = 0, 1409 1409 .svhs = -1, 1410 1410 .gpiomask = 1, 1411 - .muxsel = { 2, 3, 0, 1}, 1412 - .audiomux = { 0, 0, 1, 0, 0}, 1411 + .muxsel = { 2, 3, 0, 1 }, 1412 + .audiomux = { 0, 0, 1, 0, 0 }, 1413 1413 .no_msp34xx = 1, 1414 1414 .pll = PLL_28, 1415 1415 .tuner_type = TUNER_TEMIC_4006FN5_MULTI_PAL, ··· 1424 1424 .tuner = 0, 1425 1425 .svhs = 2, 1426 1426 .gpiomask = 0x18e0, 1427 - .muxsel = { 2, 3, 0, 1}, 1427 + .muxsel = { 2, 3, 0, 1 }, 1428 1428 /* Radio changed from 1e80 to 0x800 to make 1429 1429 FlyVideo2000S in .hu happy (gm)*/ 1430 1430 /* -dk-???: set mute=0x1800 for tda9874h daughterboard */ ··· 1445 1445 .tuner = 0, 1446 1446 .svhs = 2, 1447 1447 .gpiomask = 0xffff00, 1448 - .muxsel = { 2, 3, 1, 1}, 1449 - .audiomux = { 0x500, 0x500, 0x300, 0x900, 0x900}, 1448 + .muxsel = { 2, 3, 1, 1 }, 1449 + .audiomux = { 0x500, 0x500, 0x300, 0x900, 0x900 }, 1450 1450 .needs_tvaudio = 1, 1451 1451 .pll = PLL_28, 1452 1452 .tuner_type = TUNER_PHILIPS_PAL, ··· 1462 1462 .tuner = 0, 1463 1463 .svhs = 2, 1464 1464 .gpiomask = 0x010f00, 1465 - .muxsel = {2, 3, 0, 0}, 1466 - .audiomux = {0x10000, 0, 0x10000, 0, 0, 0}, 1465 + .muxsel = {2, 3, 0, 0 }, 1466 + .audiomux = {0x10000, 0, 0x10000, 0, 0, 0 }, 1467 1467 .no_msp34xx = 1, 1468 1468 .pll = PLL_28, 1469 1469 .tuner_type = TUNER_SHARP_2U5JF5540_NTSC, ··· 1487 1487 .audiomux = {0x947fff, 0x987fff,0x947fff,0x947fff, 0x947fff}, 1488 1488 /* tvtuner, radio, external,internal, mute, stereo 1489 1489 * tuner, Composit, SVid, Composit-on-Svid-adapter */ 1490 - .muxsel = { 2, 3 ,0 ,1}, 1490 + .muxsel = { 2, 3 ,0 ,1 }, 1491 1491 .tuner_type = TUNER_MT2032, 1492 1492 .tuner_addr = ADDR_UNSET, 1493 1493 .radio_addr = ADDR_UNSET, ··· 1515 1515 .tuner = 0, 1516 1516 .svhs = 2, 1517 1517 .gpiomask = 15, 1518 - .muxsel = { 2, 3, 1, 1}, 1519 - .audiomux = { 0, 0, 11, 7, 13, 0}, /* TV and Radio with same GPIO ! */ 1518 + .muxsel = { 2, 3, 1, 1 }, 1519 + .audiomux = { 0, 0, 11, 7, 13, 0 }, /* TV and Radio with same GPIO ! */ 1520 1520 .needs_tvaudio = 1, 1521 1521 .pll = PLL_28, 1522 1522 .tuner_type = 25, ··· 1537 1537 .audio_inputs = 0, 1538 1538 .tuner = -1, 1539 1539 .svhs = 2, 1540 - .muxsel = { 2, 3, 1, 1}, /* AV1, AV2, SVHS, CVid adapter on SVHS */ 1540 + .muxsel = { 2, 3, 1, 1 }, /* AV1, AV2, SVHS, CVid adapter on SVHS */ 1541 1541 .pll = PLL_28, 1542 1542 .no_msp34xx = 1, 1543 1543 .tuner_type = UNSET, ··· 1583 1583 .tuner = -1, 1584 1584 .svhs = 4, 1585 1585 .gpiomask = 0, 1586 - .muxsel = { 2, 3, 1, 0, 0}, 1586 + .muxsel = { 2, 3, 1, 0, 0 }, 1587 1587 .audiomux = { 0 }, 1588 1588 .needs_tvaudio = 0, 1589 1589 .tuner_type = -1, ··· 1696 1696 .name = "DSP Design TCVIDEO", 1697 1697 .video_inputs = 4, 1698 1698 .svhs = -1, 1699 - .muxsel = { 2, 3, 1, 0}, 1699 + .muxsel = { 2, 3, 1, 0 }, 1700 1700 .pll = PLL_28, 1701 1701 .tuner_type = -1, 1702 1702 .tuner_addr = ADDR_UNSET, ··· 1710 1710 .audio_inputs = 1, 1711 1711 .tuner = 0, 1712 1712 .svhs = 2, 1713 - .muxsel = { 2, 0, 1, 1}, 1713 + .muxsel = { 2, 0, 1, 1 }, 1714 1714 .needs_tvaudio = 1, 1715 1715 .pll = PLL_28, 1716 1716 .tuner_type = -1, ··· 1727 1727 .tuner = 0, 1728 1728 .svhs = 2, 1729 1729 .gpiomask = 0x0f0f80, 1730 - .muxsel = {2, 3, 1, 0}, 1730 + .muxsel = {2, 3, 1, 0 }, 1731 1731 .audiomux = {0x030000, 0x010000, 0, 0, 0x020000, 0}, 1732 1732 .no_msp34xx = 1, 1733 1733 .pll = PLL_28, ··· 1944 1944 .no_msp34xx = 1, 1945 1945 .no_tda9875 = 1, 1946 1946 .no_tda7432 = 1, 1947 - .muxsel = { 3, 0, 1, 2}, 1947 + .muxsel = { 3, 0, 1, 2 }, 1948 1948 .pll = PLL_28, 1949 1949 .no_gpioirq = 1, 1950 1950 .has_dvb = 1, ··· 1957 1957 .svhs = 3, 1958 1958 .gpiomask = 2, 1959 1959 /* TV, Comp1, Composite over SVID con, SVID */ 1960 - .muxsel = { 2, 3, 1, 1}, 1960 + .muxsel = { 2, 3, 1, 1 }, 1961 1961 .audiomux = { 2, 2, 0, 0, 0 }, 1962 1962 .pll = PLL_28, 1963 1963 .has_radio = 1, ··· 2074 2074 .audio_inputs = 1, 2075 2075 .tuner = 0, 2076 2076 .svhs = 2, 2077 - .muxsel = { 2, 3, 1, 1}, /* Tuner, CVid, SVid, CVid over SVid connector */ 2077 + .muxsel = { 2, 3, 1, 1 }, /* Tuner, CVid, SVid, CVid over SVid connector */ 2078 2078 .gpiomask = 0, 2079 2079 .no_tda9875 = 1, 2080 2080 .no_tda7432 = 1, ··· 2128 2128 .video_inputs = 1, 2129 2129 .tuner = -1, 2130 2130 .svhs = -1, 2131 - .muxsel = { 2, 3, 1, 0}, 2131 + .muxsel = { 2, 3, 1, 0 }, 2132 2132 .no_msp34xx = 1, 2133 2133 .no_tda9875 = 1, 2134 2134 .no_tda7432 = 1, ··· 2166 2166 .tuner = -1, /* card has no tuner */ 2167 2167 .svhs = 3, 2168 2168 .gpiomask = 0x00, 2169 - .muxsel = { 2, 3, 1, 0}, 2169 + .muxsel = { 2, 3, 1, 0 }, 2170 2170 .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */ 2171 2171 .needs_tvaudio = 1, 2172 2172 .pll = PLL_28, ··· 2181 2181 .tuner = -1, /* card has no tuner */ 2182 2182 .svhs = 3, 2183 2183 .gpiomask = 0x00, 2184 - .muxsel = { 2, 3, 1, 1}, 2184 + .muxsel = { 2, 3, 1, 1 }, 2185 2185 .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */ 2186 2186 .needs_tvaudio = 1, 2187 2187 .pll = PLL_28, ··· 2268 2268 .audio_inputs = 1, 2269 2269 .tuner = 0, 2270 2270 .svhs = 2, 2271 - .muxsel = { 2, 3, 1, 0}, 2271 + .muxsel = { 2, 3, 1, 0 }, 2272 2272 .tuner_type = TUNER_PHILIPS_ATSC, 2273 2273 .tuner_addr = ADDR_UNSET, 2274 2274 .radio_addr = ADDR_UNSET, ··· 2291 2291 .audio_inputs = 0, 2292 2292 .svhs = 1, 2293 2293 .tuner = -1, 2294 - .muxsel = { 3, 1, 1, 3}, /* Vid In, SVid In, Vid over SVid in connector */ 2294 + .muxsel = { 3, 1, 1, 3 }, /* Vid In, SVid In, Vid over SVid in connector */ 2295 2295 .no_msp34xx = 1, 2296 2296 .no_tda9875 = 1, 2297 2297 .no_tda7432 = 1, ··· 2307 2307 .tuner = 0, 2308 2308 .svhs = 2, 2309 2309 .gpiomask = 3, 2310 - .muxsel = { 2, 3, 1, 1}, 2311 - .audiomux = { 1, 1, 1, 1, 0}, 2310 + .muxsel = { 2, 3, 1, 1 }, 2311 + .audiomux = { 1, 1, 1, 1, 0 }, 2312 2312 .needs_tvaudio = 1, 2313 2313 .tuner_type = TUNER_PHILIPS_PAL, 2314 2314 .tuner_addr = ADDR_UNSET, ··· 2327 2327 .tuner_addr = ADDR_UNSET, 2328 2328 .radio_addr = ADDR_UNSET, 2329 2329 .pll = PLL_28, 2330 - .muxsel = { 2, 2, 2, 2}, 2330 + .muxsel = { 2, 2, 2, 2 }, 2331 2331 .gpiomask = 0x3F, 2332 2332 .muxsel_hook = gvc1100_muxsel, 2333 2333 }, ··· 2338 2338 .tuner = 0, 2339 2339 .svhs = 2, 2340 2340 .gpiomask = 0x008007, 2341 - .muxsel = {2, 3, 0, 0}, 2342 - .audiomux = {0, 0, 0, 0, 0x000003, 0}, 2341 + .muxsel = { 2, 3, 0, 0 }, 2342 + .audiomux = { 0, 0, 0, 0, 0x000003, 0 }, 2343 2343 .pll = PLL_28, 2344 2344 .tuner_type = TUNER_PHILIPS_PAL, 2345 2345 .tuner_addr = ADDR_UNSET, ··· 2374 2374 .svhs = 2, 2375 2375 .needs_tvaudio = 0, 2376 2376 .gpiomask = 0x68, 2377 - .muxsel = { 2, 3, 1}, 2377 + .muxsel = { 2, 3, 1 }, 2378 2378 .audiomux = { 0x68, 0x68, 0x61, 0x61, 0x00 }, 2379 2379 .pll = PLL_28, 2380 2380 }, ··· 2433 2433 .svhs = 2, 2434 2434 .gpiomask = 0x0000000f, 2435 2435 .muxsel = { 2, 1, 1 }, 2436 - .audiomux = { 0x02, 0x00, 0x00, 0x00, 0x00}, 2436 + .audiomux = { 0x02, 0x00, 0x00, 0x00, 0x00 }, 2437 2437 .tuner_type = TUNER_TEMIC_PAL, 2438 2438 .tuner_addr = ADDR_UNSET, 2439 2439 .radio_addr = ADDR_UNSET, ··· 2466 2466 .video_inputs = 2, 2467 2467 .tuner = -1, 2468 2468 .svhs = 1, 2469 - .muxsel = { 3, 1, 2, 0}, /* Comp0, S-Video, ?, ? */ 2469 + .muxsel = { 3, 1, 2, 0 }, /* Comp0, S-Video, ?, ? */ 2470 2470 .no_msp34xx = 1, 2471 2471 .no_tda9875 = 1, 2472 2472 .no_tda7432 = 1, ··· 2523 2523 .tuner = 0, 2524 2524 .svhs = -1, 2525 2525 .gpiomask = 0xFF, 2526 - .muxsel = { 2, 3, 1, 1}, 2527 - .audiomux = { 2, 0, 0, 0, 10}, 2526 + .muxsel = { 2, 3, 1, 1 }, 2527 + .audiomux = { 2, 0, 0, 0, 10 }, 2528 2528 .needs_tvaudio = 0, 2529 2529 .pll = PLL_28, 2530 2530 .tuner_type = TUNER_PHILIPS_PAL, ··· 2557 2557 .tuner = 0, 2558 2558 .svhs = 2, 2559 2559 .gpiomask = 0x3f, 2560 - .muxsel = {2, 3, 1, 0}, 2561 - .audiomux = {0x31, 0x31, 0x31, 0x31, 0x31, 0x31}, 2560 + .muxsel = {2, 3, 1, 0 }, 2561 + .audiomux = {0x31, 0x31, 0x31, 0x31, 0x31, 0x31 }, 2562 2562 .no_msp34xx = 1, 2563 2563 .pll = PLL_28, 2564 2564 .tuner_type = TUNER_PHILIPS_NTSC_M, ··· 2576 2576 .audio_inputs = 1, 2577 2577 .tuner = 0, 2578 2578 .svhs = 2, 2579 - .muxsel = { 2, 3, 1, 0}, 2579 + .muxsel = { 2, 3, 1, 0 }, 2580 2580 .tuner_type = TUNER_PHILIPS_NTSC, 2581 2581 .tuner_addr = ADDR_UNSET, 2582 2582 .radio_addr = ADDR_UNSET, 2583 2583 .gpiomask = 0x008007, 2584 - .audiomux = { 0, 0x000001,0,0, 0}, 2584 + .audiomux = { 0, 0x000001,0,0, 0 }, 2585 2585 .needs_tvaudio = 1, 2586 2586 .has_radio = 1, 2587 2587 }, ··· 2672 2672 .audio_inputs = 1, 2673 2673 .tuner = 0, 2674 2674 .svhs = 2, 2675 - .muxsel = { 2, 3, 1, 0}, 2675 + .muxsel = { 2, 3, 1, 0 }, 2676 2676 .tuner_type = -1, 2677 2677 .tuner_addr = ADDR_UNSET, 2678 2678 .radio_addr = ADDR_UNSET, ··· 2706 2706 .tuner = 0, 2707 2707 .svhs = 2, 2708 2708 .gpiomask = 0x01fe00, 2709 - .muxsel = { 2, 3, 1, 1}, 2709 + .muxsel = { 2, 3, 1, 1 }, 2710 2710 .audiomux = { 0x001e00, 0, 0x018000, 0x014000, 0x002000, 0 }, 2711 2711 .needs_tvaudio = 1, 2712 2712 .pll = PLL_28, ··· 2794 2794 .tuner = 0, 2795 2795 .svhs = 2, 2796 2796 .gpiomask = 15, 2797 - .muxsel = { 2, 3, 1, 1}, 2798 - .audiomux = {2,0,0,0,1}, 2797 + .muxsel = { 2, 3, 1, 1 }, 2798 + .audiomux = { 2, 0, 0, 0, 1 }, 2799 2799 .needs_tvaudio = 1, 2800 2800 .pll = PLL_28, 2801 2801 .tuner_type = 2, ··· 2810 2810 .tuner = 0, 2811 2811 .svhs = 2, 2812 2812 .gpiomask = 0x108007, 2813 - .muxsel = { 2, 3, 1, 1}, 2814 - .audiomux = { 100000, 100002, 100002, 100000}, 2813 + .muxsel = { 2, 3, 1, 1 }, 2814 + .audiomux = { 100000, 100002, 100002, 100000 }, 2815 2815 .no_msp34xx = 1, 2816 2816 .no_tda9875 = 1, 2817 2817 .no_tda7432 = 1, ··· 2828 2828 .tuner = -1, 2829 2829 .svhs = -1, 2830 2830 .gpiomask = 0x0f, /* old: 7 */ 2831 - .muxsel = { 0, 1, 3, 2}, /* Composite 0-3 */ 2831 + .muxsel = { 0, 1, 3, 2 }, /* Composite 0-3 */ 2832 2832 .no_msp34xx = 1, 2833 2833 .no_tda9875 = 1, 2834 2834 .no_tda7432 = 1, 2835 2835 .tuner_type = -1, 2836 2836 .tuner_addr = ADDR_UNSET, 2837 2837 .radio_addr = ADDR_UNSET, 2838 + }, 2839 + [BTTV_BOARD_MACHTV_MAGICTV] = { 2840 + /* Julian Calaby <julian.calaby@gmail.com> 2841 + * Slightly different from original MachTV definition (0x60) 2842 + 2843 + * FIXME: RegSpy says gpiomask should be "0x001c800f", but it 2844 + * stuffs up remote chip. Bug is a pin on the jaecs is not set 2845 + * properly (methinks) causing no keyup bits being set */ 2846 + 2847 + .name = "MagicTV", /* rebranded MachTV */ 2848 + .video_inputs = 3, 2849 + .audio_inputs = 1, 2850 + .tuner = 0, 2851 + .svhs = 2, 2852 + .gpiomask = 7, 2853 + .muxsel = { 2, 3, 1, 1 }, 2854 + .audiomux = { 0, 1, 2, 3, 4 }, 2855 + .tuner_type = TUNER_TEMIC_4009FR5_PAL, 2856 + .tuner_addr = ADDR_UNSET, 2857 + .radio_addr = ADDR_UNSET, 2858 + .pll = PLL_28, 2859 + .has_radio = 1, 2860 + .has_remote = 1, 2838 2861 }, 2839 2862 }; 2840 2863
+1 -2
drivers/media/video/bttv-gpio.c
··· 64 64 struct bttv_sub_device *sub; 65 65 int err; 66 66 67 - sub = kmalloc(sizeof(*sub),GFP_KERNEL); 67 + sub = kzalloc(sizeof(*sub),GFP_KERNEL); 68 68 if (NULL == sub) 69 69 return -ENOMEM; 70 - memset(sub,0,sizeof(*sub)); 71 70 72 71 sub->core = core; 73 72 sub->dev.parent = &core->pci->dev;
+6
drivers/media/video/bttv-input.c
··· 583 583 btv->custom_irq = bttv_rc5_irq; 584 584 ir->rc5_gpio = 1; 585 585 break; 586 + case BTTV_BOARD_MACHTV_MAGICTV: 587 + ir_codes = ir_codes_apac_viewcomp; 588 + ir->mask_keycode = 0x001F00; 589 + ir->mask_keyup = 0x004000; 590 + ir->polling = 50; /* ms */ 591 + break; 586 592 } 587 593 if (NULL == ir_codes) { 588 594 dprintk(KERN_INFO "Ooops: IR config error [card=%d]\n",btv->c.type);
+1
drivers/media/video/bttv.h
··· 166 166 #define BTTV_BOARD_ASOUND_SKYEYE 0x8d 167 167 #define BTTV_BOARD_SABRENT_TVFM 0x8e 168 168 #define BTTV_BOARD_HAUPPAUGE_IMPACTVCB 0x8f 169 + #define BTTV_BOARD_MACHTV_MAGICTV 0x90 169 170 170 171 /* i2c address list */ 171 172 #define I2C_TSA5522 0xc2
+259 -112
drivers/media/video/compat_ioctl32.c
··· 18 18 #include <linux/videodev2.h> 19 19 #include <linux/module.h> 20 20 #include <linux/smp_lock.h> 21 + #include <media/v4l2-common.h> 21 22 22 23 #ifdef CONFIG_COMPAT 24 + 25 + 23 26 struct video_tuner32 { 24 27 compat_int_t tuner; 25 28 char name[32]; ··· 33 30 34 31 static int get_video_tuner32(struct video_tuner *kp, struct video_tuner32 __user *up) 35 32 { 36 - if(get_user(kp->tuner, &up->tuner)) 33 + if(!access_ok(VERIFY_READ, up, sizeof(struct video_tuner32)) || 34 + get_user(kp->tuner, &up->tuner) || 35 + copy_from_user(kp->name, up->name, 32) || 36 + get_user(kp->rangelow, &up->rangelow) || 37 + get_user(kp->rangehigh, &up->rangehigh) || 38 + get_user(kp->flags, &up->flags) || 39 + get_user(kp->mode, &up->mode) || 40 + get_user(kp->signal, &up->signal)) 37 41 return -EFAULT; 38 - __copy_from_user(kp->name, up->name, 32); 39 - __get_user(kp->rangelow, &up->rangelow); 40 - __get_user(kp->rangehigh, &up->rangehigh); 41 - __get_user(kp->flags, &up->flags); 42 - __get_user(kp->mode, &up->mode); 43 - __get_user(kp->signal, &up->signal); 44 42 return 0; 45 43 } 46 44 47 45 static int put_video_tuner32(struct video_tuner *kp, struct video_tuner32 __user *up) 48 46 { 49 - if(put_user(kp->tuner, &up->tuner)) 50 - return -EFAULT; 51 - __copy_to_user(up->name, kp->name, 32); 52 - __put_user(kp->rangelow, &up->rangelow); 53 - __put_user(kp->rangehigh, &up->rangehigh); 54 - __put_user(kp->flags, &up->flags); 55 - __put_user(kp->mode, &up->mode); 56 - __put_user(kp->signal, &up->signal); 47 + if(!access_ok(VERIFY_WRITE, up, sizeof(struct video_tuner32)) || 48 + put_user(kp->tuner, &up->tuner) || 49 + copy_to_user(up->name, kp->name, 32) || 50 + put_user(kp->rangelow, &up->rangelow) || 51 + put_user(kp->rangehigh, &up->rangehigh) || 52 + put_user(kp->flags, &up->flags) || 53 + put_user(kp->mode, &up->mode) || 54 + put_user(kp->signal, &up->signal)) 55 + return -EFAULT; 57 56 return 0; 58 57 } 59 58 ··· 68 63 { 69 64 u32 tmp; 70 65 71 - if (get_user(tmp, &up->base)) 72 - return -EFAULT; 66 + if (!access_ok(VERIFY_READ, up, sizeof(struct video_buffer32)) || 67 + get_user(tmp, &up->base) || 68 + get_user(kp->height, &up->height) || 69 + get_user(kp->width, &up->width) || 70 + get_user(kp->depth, &up->depth) || 71 + get_user(kp->bytesperline, &up->bytesperline)) 72 + return -EFAULT; 73 73 74 74 /* This is actually a physical address stored 75 75 * as a void pointer. 76 76 */ 77 77 kp->base = (void *)(unsigned long) tmp; 78 78 79 - __get_user(kp->height, &up->height); 80 - __get_user(kp->width, &up->width); 81 - __get_user(kp->depth, &up->depth); 82 - __get_user(kp->bytesperline, &up->bytesperline); 83 79 return 0; 84 80 } 85 81 ··· 88 82 { 89 83 u32 tmp = (u32)((unsigned long)kp->base); 90 84 91 - if(put_user(tmp, &up->base)) 92 - return -EFAULT; 93 - __put_user(kp->height, &up->height); 94 - __put_user(kp->width, &up->width); 95 - __put_user(kp->depth, &up->depth); 96 - __put_user(kp->bytesperline, &up->bytesperline); 85 + if(!access_ok(VERIFY_WRITE, up, sizeof(struct video_buffer32)) || 86 + put_user(tmp, &up->base) || 87 + put_user(kp->height, &up->height) || 88 + put_user(kp->width, &up->width) || 89 + put_user(kp->depth, &up->depth) || 90 + put_user(kp->bytesperline, &up->bytesperline)) 91 + return -EFAULT; 97 92 return 0; 98 93 } 99 94 ··· 128 121 /* You get back everything except the clips... */ 129 122 static int put_video_window32(struct video_window *kp, struct video_window32 __user *up) 130 123 { 131 - if(put_user(kp->x, &up->x)) 132 - return -EFAULT; 133 - __put_user(kp->y, &up->y); 134 - __put_user(kp->width, &up->width); 135 - __put_user(kp->height, &up->height); 136 - __put_user(kp->chromakey, &up->chromakey); 137 - __put_user(kp->flags, &up->flags); 138 - __put_user(kp->clipcount, &up->clipcount); 124 + if(!access_ok(VERIFY_WRITE, up, sizeof(struct video_window32)) || 125 + put_user(kp->x, &up->x) || 126 + put_user(kp->y, &up->y) || 127 + put_user(kp->width, &up->width) || 128 + put_user(kp->height, &up->height) || 129 + put_user(kp->chromakey, &up->chromakey) || 130 + put_user(kp->flags, &up->flags) || 131 + put_user(kp->clipcount, &up->clipcount)) 132 + return -EFAULT; 139 133 return 0; 140 134 } 141 135 ··· 158 150 159 151 static int get_v4l2_window32(struct v4l2_window *kp, struct v4l2_window32 __user *up) 160 152 { 161 - if (copy_from_user(&kp->w, &up->w, sizeof(up->w))) 162 - return -EFAULT; 163 - __get_user(kp->field, &up->field); 164 - __get_user(kp->chromakey, &up->chromakey); 165 - __get_user(kp->clipcount, &up->clipcount); 153 + if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_window32)) || 154 + copy_from_user(&kp->w, &up->w, sizeof(up->w)) || 155 + get_user(kp->field, &up->field) || 156 + get_user(kp->chromakey, &up->chromakey) || 157 + get_user(kp->clipcount, &up->clipcount)) 158 + return -EFAULT; 166 159 if (kp->clipcount > 2048) 167 160 return -EINVAL; 168 161 if (kp->clipcount) { ··· 174 165 kclips = compat_alloc_user_space(n * sizeof(struct v4l2_clip)); 175 166 kp->clips = kclips; 176 167 while (--n >= 0) { 177 - copy_from_user(&kclips->c, &uclips->c, sizeof(uclips->c)); 168 + if (!access_ok(VERIFY_READ, &uclips->c, sizeof(uclips->c)) || 169 + copy_from_user(&kclips->c, &uclips->c, sizeof(uclips->c))) 170 + return -EFAULT; 178 171 kclips->next = n ? kclips + 1 : 0; 179 172 uclips += 1; 180 173 kclips += 1; ··· 188 177 189 178 static int put_v4l2_window32(struct v4l2_window *kp, struct v4l2_window32 __user *up) 190 179 { 191 - if (copy_to_user(&up->w, &kp->w, sizeof(up->w))) 192 - return -EFAULT; 193 - __put_user(kp->field, &up->field); 194 - __put_user(kp->chromakey, &up->chromakey); 195 - __put_user(kp->clipcount, &up->clipcount); 180 + if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_window32)) || 181 + copy_to_user(&up->w, &kp->w, sizeof(up->w)) || 182 + put_user(kp->field, &up->field) || 183 + put_user(kp->chromakey, &up->chromakey) || 184 + put_user(kp->clipcount, &up->clipcount)) 185 + return -EFAULT; 196 186 return 0; 197 187 } 198 188 199 189 static inline int get_v4l2_pix_format(struct v4l2_pix_format *kp, struct v4l2_pix_format __user *up) 200 190 { 201 - return copy_from_user(kp, up, sizeof(struct v4l2_pix_format)); 191 + if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_pix_format)) || 192 + copy_from_user(kp, up, sizeof(struct v4l2_pix_format))) 193 + return -EFAULT; 194 + return 0; 202 195 } 203 196 204 197 static inline int put_v4l2_pix_format(struct v4l2_pix_format *kp, struct v4l2_pix_format __user *up) 205 198 { 206 - return copy_to_user(up, kp, sizeof(struct v4l2_pix_format)); 199 + if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_pix_format)) || 200 + copy_to_user(up, kp, sizeof(struct v4l2_pix_format))) 201 + return -EFAULT; 202 + return 0; 207 203 } 208 204 209 205 static inline int get_v4l2_vbi_format(struct v4l2_vbi_format *kp, struct v4l2_vbi_format __user *up) 210 206 { 211 - return copy_from_user(kp, up, sizeof(struct v4l2_vbi_format)); 207 + if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_vbi_format)) || 208 + copy_from_user(kp, up, sizeof(struct v4l2_vbi_format))) 209 + return -EFAULT; 210 + return 0; 212 211 } 213 212 214 213 static inline int put_v4l2_vbi_format(struct v4l2_vbi_format *kp, struct v4l2_vbi_format __user *up) 215 214 { 216 - return copy_to_user(up, kp, sizeof(struct v4l2_vbi_format)); 215 + if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_vbi_format)) || 216 + copy_to_user(up, kp, sizeof(struct v4l2_vbi_format))) 217 + return -EFAULT; 218 + return 0; 217 219 } 218 220 219 221 struct v4l2_format32 ··· 243 219 244 220 static int get_v4l2_format32(struct v4l2_format *kp, struct v4l2_format32 __user *up) 245 221 { 246 - if(get_user(kp->type, &up->type)) 247 - return -EFAULT; 222 + if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_format32)) || 223 + get_user(kp->type, &up->type)) 224 + return -EFAULT; 248 225 switch (kp->type) { 249 226 case V4L2_BUF_TYPE_VIDEO_CAPTURE: 250 227 return get_v4l2_pix_format(&kp->fmt.pix, &up->fmt.pix); ··· 262 237 263 238 static int put_v4l2_format32(struct v4l2_format *kp, struct v4l2_format32 __user *up) 264 239 { 265 - if(put_user(kp->type, &up->type)) 240 + if(!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_format32)) || 241 + put_user(kp->type, &up->type)) 266 242 return -EFAULT; 267 243 switch (kp->type) { 268 244 case V4L2_BUF_TYPE_VIDEO_CAPTURE: ··· 275 249 default: 276 250 return -ENXIO; 277 251 } 252 + } 253 + 254 + static inline int get_v4l2_standard(struct v4l2_standard *kp, struct v4l2_standard __user *up) 255 + { 256 + if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_standard)) || 257 + copy_from_user(kp, up, sizeof(struct v4l2_standard))) 258 + return -EFAULT; 259 + return 0; 260 + 261 + } 262 + 263 + static inline int put_v4l2_standard(struct v4l2_standard *kp, struct v4l2_standard __user *up) 264 + { 265 + if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_standard)) || 266 + copy_to_user(up, kp, sizeof(struct v4l2_standard))) 267 + return -EFAULT; 268 + return 0; 278 269 } 279 270 280 271 struct v4l2_standard32 ··· 307 264 static int get_v4l2_standard32(struct v4l2_standard *kp, struct v4l2_standard32 __user *up) 308 265 { 309 266 /* other fields are not set by the user, nor used by the driver */ 310 - return get_user(kp->index, &up->index); 267 + if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_standard32)) || 268 + get_user(kp->index, &up->index)) 269 + return -EFAULT; 270 + return 0; 311 271 } 312 272 313 273 static int put_v4l2_standard32(struct v4l2_standard *kp, struct v4l2_standard32 __user *up) 314 274 { 315 - if(put_user(kp->index, &up->index)) 316 - return -EFAULT; 317 - __copy_to_user(up->id, &kp->id, sizeof(__u64)); 318 - __copy_to_user(up->name, kp->name, 24); 319 - __put_user(kp->frameperiod, &up->frameperiod); 320 - __put_user(kp->framelines, &up->framelines); 321 - __copy_to_user(up->reserved, kp->reserved, 4 * sizeof(__u32)); 275 + if(!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_standard32)) || 276 + put_user(kp->index, &up->index) || 277 + copy_to_user(up->id, &kp->id, sizeof(__u64)) || 278 + copy_to_user(up->name, kp->name, 24) || 279 + copy_to_user(&up->frameperiod, &kp->frameperiod, sizeof(kp->frameperiod)) || 280 + put_user(kp->framelines, &up->framelines) || 281 + copy_to_user(up->reserved, kp->reserved, 4 * sizeof(__u32))) 282 + return -EFAULT; 283 + return 0; 284 + } 285 + 286 + static inline int get_v4l2_tuner(struct v4l2_tuner *kp, struct v4l2_tuner __user *up) 287 + { 288 + if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_tuner)) || 289 + copy_from_user(kp, up, sizeof(struct v4l2_tuner))) 290 + return -EFAULT; 291 + return 0; 292 + 293 + } 294 + 295 + static inline int put_v4l2_tuner(struct v4l2_tuner *kp, struct v4l2_tuner __user *up) 296 + { 297 + if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_tuner)) || 298 + copy_to_user(up, kp, sizeof(struct v4l2_tuner))) 299 + return -EFAULT; 322 300 return 0; 323 301 } 324 302 ··· 368 304 static int get_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user *up) 369 305 { 370 306 371 - if (get_user(kp->index, &up->index)) 372 - return -EFAULT; 373 - __get_user(kp->type, &up->type); 374 - __get_user(kp->flags, &up->flags); 375 - __get_user(kp->memory, &up->memory); 376 - __get_user(kp->input, &up->input); 307 + if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_buffer32)) || 308 + get_user(kp->index, &up->index) || 309 + get_user(kp->type, &up->type) || 310 + get_user(kp->flags, &up->flags) || 311 + get_user(kp->memory, &up->memory) || 312 + get_user(kp->input, &up->input)) 313 + return -EFAULT; 377 314 switch(kp->memory) { 378 315 case V4L2_MEMORY_MMAP: 379 316 break; ··· 382 317 { 383 318 unsigned long tmp = (unsigned long)compat_ptr(up->m.userptr); 384 319 385 - __get_user(kp->length, &up->length); 386 - __get_user(kp->m.userptr, &tmp); 320 + if(get_user(kp->length, &up->length) || 321 + get_user(kp->m.userptr, &tmp)) 322 + return -EFAULT; 387 323 } 388 324 break; 389 325 case V4L2_MEMORY_OVERLAY: 390 - __get_user(kp->m.offset, &up->m.offset); 326 + if(get_user(kp->m.offset, &up->m.offset)) 327 + return -EFAULT; 391 328 break; 392 329 } 393 330 return 0; ··· 397 330 398 331 static int put_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user *up) 399 332 { 400 - if (put_user(kp->index, &up->index)) 401 - return -EFAULT; 402 - __put_user(kp->type, &up->type); 403 - __put_user(kp->flags, &up->flags); 404 - __put_user(kp->memory, &up->memory); 405 - __put_user(kp->input, &up->input); 333 + if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_buffer32)) || 334 + put_user(kp->index, &up->index) || 335 + put_user(kp->type, &up->type) || 336 + put_user(kp->flags, &up->flags) || 337 + put_user(kp->memory, &up->memory) || 338 + put_user(kp->input, &up->input)) 339 + return -EFAULT; 406 340 switch(kp->memory) { 407 341 case V4L2_MEMORY_MMAP: 408 - __put_user(kp->length, &up->length); 409 - __put_user(kp->m.offset, &up->m.offset); 342 + if (put_user(kp->length, &up->length) || 343 + put_user(kp->m.offset, &up->m.offset)) 344 + return -EFAULT; 410 345 break; 411 346 case V4L2_MEMORY_USERPTR: 412 - __put_user(kp->length, &up->length); 413 - __put_user(kp->m.userptr, &up->m.userptr); 347 + if (put_user(kp->length, &up->length) || 348 + put_user(kp->m.userptr, &up->m.userptr)) 349 + return -EFAULT; 414 350 break; 415 351 case V4L2_MEMORY_OVERLAY: 416 - __put_user(kp->m.offset, &up->m.offset); 352 + if (put_user(kp->m.offset, &up->m.offset)) 353 + return -EFAULT; 417 354 break; 418 355 } 419 - __put_user(kp->bytesused, &up->bytesused); 420 - __put_user(kp->field, &up->field); 421 - __put_user(kp->timestamp.tv_sec, &up->timestamp.tv_sec); 422 - __put_user(kp->timestamp.tv_usec, &up->timestamp.tv_usec); 423 - __copy_to_user(&up->timecode, &kp->timecode, sizeof(struct v4l2_timecode)); 424 - __put_user(kp->sequence, &up->sequence); 425 - __put_user(kp->reserved, &up->reserved); 356 + if (put_user(kp->bytesused, &up->bytesused) || 357 + put_user(kp->field, &up->field) || 358 + put_user(kp->timestamp.tv_sec, &up->timestamp.tv_sec) || 359 + put_user(kp->timestamp.tv_usec, &up->timestamp.tv_usec) || 360 + copy_to_user(&up->timecode, &kp->timecode, sizeof(struct v4l2_timecode)) || 361 + put_user(kp->sequence, &up->sequence) || 362 + put_user(kp->reserved, &up->reserved)) 363 + return -EFAULT; 426 364 return 0; 427 365 } 428 366 ··· 443 371 { 444 372 u32 tmp; 445 373 446 - if (get_user(tmp, &up->base)) 447 - return -EFAULT; 374 + if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_framebuffer32)) || 375 + get_user(tmp, &up->base) || 376 + get_user(kp->capability, &up->capability) || 377 + get_user(kp->flags, &up->flags)) 378 + return -EFAULT; 448 379 kp->base = compat_ptr(tmp); 449 - __get_user(kp->capability, &up->capability); 450 - __get_user(kp->flags, &up->flags); 451 380 get_v4l2_pix_format(&kp->fmt, &up->fmt); 452 381 return 0; 453 382 } ··· 457 384 { 458 385 u32 tmp = (u32)((unsigned long)kp->base); 459 386 460 - if(put_user(tmp, &up->base)) 461 - return -EFAULT; 462 - __put_user(kp->capability, &up->capability); 463 - __put_user(kp->flags, &up->flags); 387 + if(!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_framebuffer32)) || 388 + put_user(tmp, &up->base) || 389 + put_user(kp->capability, &up->capability) || 390 + put_user(kp->flags, &up->flags)) 391 + return -EFAULT; 464 392 put_v4l2_pix_format(&kp->fmt, &up->fmt); 465 393 return 0; 466 394 } 467 395 468 - struct v4l2_input32 /* identical layout, but different size */ 396 + static inline int get_v4l2_input32(struct v4l2_input *kp, struct v4l2_input __user *up) 469 397 { 470 - __u32 index; /* Which input */ 471 - __u8 name[32]; /* Label */ 472 - __u32 type; /* Type of input */ 473 - __u32 audioset; /* Associated audios (bitfield) */ 474 - __u32 tuner; /* Associated tuner */ 475 - __u32 std[2]; /* __u64 would get the padding wrong */ 476 - __u32 status; 477 - __u32 reserved[4]; 478 - }; 398 + if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_input) - 4) || 399 + copy_from_user(kp, up, sizeof(struct v4l2_input) - 4)) 400 + return -EFAULT; 401 + return 0; 402 + } 403 + 404 + static inline int put_v4l2_input32(struct v4l2_input *kp, struct v4l2_input __user *up) 405 + { 406 + if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_input) - 4) || 407 + copy_to_user(up, kp, sizeof(struct v4l2_input) - 4)) 408 + return -EFAULT; 409 + return 0; 410 + } 411 + 412 + static inline int get_v4l2_input(struct v4l2_input *kp, struct v4l2_input __user *up) 413 + { 414 + if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_input)) || 415 + copy_from_user(kp, up, sizeof(struct v4l2_input))) 416 + return -EFAULT; 417 + return 0; 418 + } 419 + 420 + static inline int put_v4l2_input(struct v4l2_input *kp, struct v4l2_input __user *up) 421 + { 422 + if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_input)) || 423 + copy_to_user(up, kp, sizeof(struct v4l2_input))) 424 + return -EFAULT; 425 + return 0; 426 + } 479 427 480 428 #define VIDIOCGTUNER32 _IOWR('v',4, struct video_tuner32) 481 429 #define VIDIOCSTUNER32 _IOW('v',5, struct video_tuner32) ··· 507 413 #define VIDIOCGFREQ32 _IOR('v',14, u32) 508 414 #define VIDIOCSFREQ32 _IOW('v',15, u32) 509 415 416 + /* VIDIOC_ENUMINPUT32 is VIDIOC_ENUMINPUT minus 4 bytes of padding alignement */ 417 + #define VIDIOC_ENUMINPUT32 VIDIOC_ENUMINPUT - _IOC(0, 0, 0, 4) 510 418 #define VIDIOC_G_FMT32 _IOWR ('V', 4, struct v4l2_format32) 511 419 #define VIDIOC_S_FMT32 _IOWR ('V', 5, struct v4l2_format32) 512 420 #define VIDIOC_QUERYBUF32 _IOWR ('V', 9, struct v4l2_buffer32) ··· 521 425 #define VIDIOC_STREAMON32 _IOW ('V', 18, compat_int_t) 522 426 #define VIDIOC_STREAMOFF32 _IOW ('V', 19, compat_int_t) 523 427 #define VIDIOC_ENUMSTD32 _IOWR ('V', 25, struct v4l2_standard32) 524 - #define VIDIOC_ENUMINPUT32 _IOWR ('V', 26, struct v4l2_input32) 525 428 /* VIDIOC_S_CTRL is now _IOWR, but was _IOW */ 526 429 #define VIDIOC_S_CTRL32 _IOW ('V', 28, struct v4l2_control) 527 430 #define VIDIOC_G_INPUT32 _IOR ('V', 38, compat_int_t) ··· 538 443 struct video_clip __user *p; 539 444 int nclips; 540 445 u32 n; 446 + 447 + if (!access_ok(VERIFY_READ, up, sizeof(struct video_window32))) 448 + return -EFAULT; 541 449 542 450 if (get_user(nclips, &up->clipcount)) 543 451 return -EFAULT; ··· 574 476 return -EINVAL; 575 477 for (i = 0; i < nclips; i++, u++, p++) { 576 478 s32 v; 577 - if (get_user(v, &u->x) || 479 + if (!access_ok(VERIFY_READ, u, sizeof(struct video_clip32)) || 480 + !access_ok(VERIFY_WRITE, p, sizeof(struct video_clip32)) || 481 + get_user(v, &u->x) || 578 482 put_user(v, &p->x) || 579 483 get_user(v, &u->y) || 580 484 put_user(v, &p->y) || ··· 602 502 struct v4l2_buffer v2b; 603 503 struct v4l2_framebuffer v2fb; 604 504 struct v4l2_standard v2s; 505 + struct v4l2_input v2i; 506 + struct v4l2_tuner v2t; 605 507 unsigned long vx; 606 508 } karg; 607 509 void __user *up = compat_ptr(arg); 608 510 int compatible_arg = 1; 609 511 int err = 0; 512 + int realcmd = cmd; 610 513 611 514 /* First, convert the command. */ 612 515 switch(cmd) { ··· 630 527 case VIDIOC_G_FBUF32: cmd = VIDIOC_G_FBUF; break; 631 528 case VIDIOC_S_FBUF32: cmd = VIDIOC_S_FBUF; break; 632 529 case VIDIOC_OVERLAY32: cmd = VIDIOC_OVERLAY; break; 633 - case VIDIOC_ENUMSTD32: cmd = VIDIOC_ENUMSTD; break; 634 - case VIDIOC_ENUMINPUT32: cmd = VIDIOC_ENUMINPUT; break; 530 + case VIDIOC_ENUMSTD32: realcmd = VIDIOC_ENUMSTD; break; 531 + case VIDIOC_ENUMINPUT32: realcmd = VIDIOC_ENUMINPUT; break; 635 532 case VIDIOC_S_CTRL32: cmd = VIDIOC_S_CTRL; break; 636 533 case VIDIOC_G_INPUT32: cmd = VIDIOC_G_INPUT; break; 637 534 case VIDIOC_S_INPUT32: cmd = VIDIOC_S_INPUT; break; ··· 680 577 break; 681 578 682 579 case VIDIOC_ENUMSTD: 580 + err = get_v4l2_standard(&karg.v2s, up); 581 + compatible_arg = 0; 582 + break; 583 + 584 + case VIDIOC_ENUMSTD32: 683 585 err = get_v4l2_standard32(&karg.v2s, up); 586 + compatible_arg = 0; 587 + break; 588 + 589 + case VIDIOC_ENUMINPUT: 590 + err = get_v4l2_input(&karg.v2i, up); 591 + compatible_arg = 0; 592 + break; 593 + 594 + case VIDIOC_ENUMINPUT32: 595 + err = get_v4l2_input32(&karg.v2i, up); 596 + compatible_arg = 0; 597 + break; 598 + 599 + case VIDIOC_G_TUNER: 600 + case VIDIOC_S_TUNER: 601 + err = get_v4l2_tuner(&karg.v2t, up); 684 602 compatible_arg = 0; 685 603 break; 686 604 ··· 717 593 goto out; 718 594 719 595 if(compatible_arg) 720 - err = native_ioctl(file, cmd, (unsigned long)up); 596 + err = native_ioctl(file, realcmd, (unsigned long)up); 721 597 else { 722 598 mm_segment_t old_fs = get_fs(); 723 599 724 600 set_fs(KERNEL_DS); 725 - err = native_ioctl(file, cmd, (unsigned long)&karg); 601 + err = native_ioctl(file, realcmd, (unsigned long)&karg); 726 602 set_fs(old_fs); 727 603 } 728 604 if(err == 0) { ··· 756 632 break; 757 633 758 634 case VIDIOC_ENUMSTD: 635 + err = put_v4l2_standard(&karg.v2s, up); 636 + break; 637 + 638 + case VIDIOC_ENUMSTD32: 759 639 err = put_v4l2_standard32(&karg.v2s, up); 640 + break; 641 + 642 + case VIDIOC_G_TUNER: 643 + case VIDIOC_S_TUNER: 644 + err = put_v4l2_tuner(&karg.v2t, up); 645 + break; 646 + 647 + case VIDIOC_ENUMINPUT: 648 + err = put_v4l2_input(&karg.v2i, up); 649 + break; 650 + 651 + case VIDIOC_ENUMINPUT32: 652 + err = put_v4l2_input32(&karg.v2i, up); 760 653 break; 761 654 762 655 case VIDIOCGFREQ: ··· 820 679 case VIDIOC_G_PARM: 821 680 case VIDIOC_G_STD: 822 681 case VIDIOC_S_STD: 682 + case VIDIOC_G_TUNER: 683 + case VIDIOC_S_TUNER: 684 + case VIDIOC_ENUMSTD: 823 685 case VIDIOC_ENUMSTD32: 686 + case VIDIOC_ENUMINPUT: 824 687 case VIDIOC_ENUMINPUT32: 825 688 case VIDIOC_G_CTRL: 826 689 case VIDIOC_S_CTRL32: ··· 863 718 case _IOR('v' , BASE_VIDIOCPRIVATE+7, int): 864 719 ret = native_ioctl(file, cmd, (unsigned long)compat_ptr(arg)); 865 720 break; 721 + default: 722 + v4l_print_ioctl("compat_ioctl32", cmd); 866 723 } 867 724 return ret; 868 725 }
+1 -2
drivers/media/video/cpia_pp.c
··· 702 702 return -ENXIO; 703 703 } 704 704 705 - cam = kmalloc(sizeof(struct pp_cam_entry), GFP_KERNEL); 705 + cam = kzalloc(sizeof(struct pp_cam_entry), GFP_KERNEL); 706 706 if (cam == NULL) { 707 707 LOG("failed to allocate camera structure\n"); 708 708 return -ENOMEM; 709 709 } 710 - memset(cam,0,sizeof(struct pp_cam_entry)); 711 710 712 711 pdev = parport_register_device(port, "cpia_pp", NULL, NULL, 713 712 NULL, 0, cam);
+1 -3
drivers/media/video/cpia_usb.c
··· 499 499 500 500 printk(KERN_INFO "USB CPiA camera found\n"); 501 501 502 - ucpia = kmalloc(sizeof(*ucpia), GFP_KERNEL); 502 + ucpia = kzalloc(sizeof(*ucpia), GFP_KERNEL); 503 503 if (!ucpia) { 504 504 printk(KERN_ERR "couldn't kmalloc cpia struct\n"); 505 505 return -ENOMEM; 506 506 } 507 - 508 - memset(ucpia, 0, sizeof(*ucpia)); 509 507 510 508 ucpia->dev = udev; 511 509 ucpia->iface = interface->desc.bInterfaceNumber;
+3 -4
drivers/media/video/cs53l32a.c
··· 141 141 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) 142 142 return 0; 143 143 144 - client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); 144 + client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); 145 145 if (client == 0) 146 146 return -ENOMEM; 147 147 148 - memset(client, 0, sizeof(struct i2c_client)); 149 148 client->addr = address; 150 149 client->adapter = adapter; 151 150 client->driver = &i2c_driver; ··· 155 156 for (i = 1; i <= 7; i++) { 156 157 u8 v = cs53l32a_read(client, i); 157 158 158 - v4l_dbg(1, client, "Read Reg %d %02x\n", i, v); 159 + v4l_dbg(1, debug, client, "Read Reg %d %02x\n", i, v); 159 160 } 160 161 161 162 /* Set cs53l32a internal register for Adaptec 2010/2410 setup */ ··· 173 174 for (i = 1; i <= 7; i++) { 174 175 u8 v = cs53l32a_read(client, i); 175 176 176 - v4l_dbg(1, client, "Read Reg %d %02x\n", i, v); 177 + v4l_dbg(1, debug, client, "Read Reg %d %02x\n", i, v); 177 178 } 178 179 179 180 i2c_attach_client(client);
+9 -10
drivers/media/video/cx25840/cx25840-core.c
··· 43 43 static unsigned short normal_i2c[] = { 0x88 >> 1, I2C_CLIENT_END }; 44 44 45 45 46 - int debug = 0; 46 + int cx25840_debug = 0; 47 47 48 - module_param(debug, bool, 0644); 48 + module_param_named(debug,cx25840_debug, int, 0644); 49 49 50 50 MODULE_PARM_DESC(debug, "Debugging messages [0=Off (default) 1=On]"); 51 51 ··· 265 265 vid_input <= CX25840_COMPOSITE8); 266 266 u8 reg; 267 267 268 - v4l_dbg(1, client, "decoder set video input %d, audio input %d\n", 268 + v4l_dbg(1, cx25840_debug, client, "decoder set video input %d, audio input %d\n", 269 269 vid_input, aud_input); 270 270 271 271 if (is_composite) { ··· 533 533 else 534 534 filter = 3; 535 535 536 - v4l_dbg(1, client, "decoder set size %dx%d -> scale %ux%u\n", 536 + v4l_dbg(1, cx25840_debug, client, "decoder set size %dx%d -> scale %ux%u\n", 537 537 pix->width, pix->height, HSC, VSC); 538 538 539 539 /* HSCALE=HSC */ ··· 687 687 return cx25840_audio(client, cmd, arg); 688 688 689 689 case VIDIOC_STREAMON: 690 - v4l_dbg(1, client, "enable output\n"); 690 + v4l_dbg(1, cx25840_debug, client, "enable output\n"); 691 691 cx25840_write(client, 0x115, 0x8c); 692 692 cx25840_write(client, 0x116, 0x07); 693 693 break; 694 694 695 695 case VIDIOC_STREAMOFF: 696 - v4l_dbg(1, client, "disable output\n"); 696 + v4l_dbg(1, cx25840_debug, client, "disable output\n"); 697 697 cx25840_write(client, 0x115, 0x00); 698 698 cx25840_write(client, 0x116, 0x00); 699 699 break; ··· 862 862 if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) 863 863 return 0; 864 864 865 - client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); 865 + client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); 866 866 if (client == 0) 867 867 return -ENOMEM; 868 868 869 - memset(client, 0, sizeof(struct i2c_client)); 870 869 client->addr = address; 871 870 client->adapter = adapter; 872 871 client->driver = &i2c_driver_cx25840; 873 872 snprintf(client->name, sizeof(client->name) - 1, "cx25840"); 874 873 875 - v4l_dbg(1, client, "detecting cx25840 client on address 0x%x\n", address << 1); 874 + v4l_dbg(1, cx25840_debug, client, "detecting cx25840 client on address 0x%x\n", address << 1); 876 875 877 876 device_id = cx25840_read(client, 0x101) << 8; 878 877 device_id |= cx25840_read(client, 0x100); ··· 879 880 /* The high byte of the device ID should be 880 881 * 0x84 if chip is present */ 881 882 if ((device_id & 0xff00) != 0x8400) { 882 - v4l_dbg(1, client, "cx25840 not found\n"); 883 + v4l_dbg(1, cx25840_debug, client, "cx25840 not found\n"); 883 884 kfree(client); 884 885 return 0; 885 886 }
+2 -4
drivers/media/video/cx88/cx88-blackbird.c
··· 1539 1539 dprintk(1,"open minor=%d\n",minor); 1540 1540 1541 1541 /* allocate + initialize per filehandle data */ 1542 - fh = kmalloc(sizeof(*fh),GFP_KERNEL); 1542 + fh = kzalloc(sizeof(*fh),GFP_KERNEL); 1543 1543 if (NULL == fh) 1544 1544 return -ENOMEM; 1545 - memset(fh,0,sizeof(*fh)); 1546 1545 file->private_data = fh; 1547 1546 fh->dev = dev; 1548 1547 ··· 1677 1678 goto fail_core; 1678 1679 1679 1680 err = -ENOMEM; 1680 - dev = kmalloc(sizeof(*dev),GFP_KERNEL); 1681 + dev = kzalloc(sizeof(*dev),GFP_KERNEL); 1681 1682 if (NULL == dev) 1682 1683 goto fail_core; 1683 - memset(dev,0,sizeof(*dev)); 1684 1684 dev->pci = pci_dev; 1685 1685 dev->core = core; 1686 1686 dev->width = 720;
+5
drivers/media/video/cx88/cx88-cards.c
··· 1244 1244 .subvendor = 0x18ac, 1245 1245 .subdevice = 0xdb50, 1246 1246 .card = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL, 1247 + },{ 1248 + .subvendor = 0x18ac, 1249 + .subdevice = 0xdb11, 1250 + .card = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS, 1251 + /* Re-branded DViCO: UltraView DVB-T Plus */ 1247 1252 }, 1248 1253 }; 1249 1254 const unsigned int cx88_idcount = ARRAY_SIZE(cx88_subids);
+1 -2
drivers/media/video/cx88/cx88-core.c
··· 1050 1050 up(&devlist); 1051 1051 return core; 1052 1052 } 1053 - core = kmalloc(sizeof(*core),GFP_KERNEL); 1053 + core = kzalloc(sizeof(*core),GFP_KERNEL); 1054 1054 if (NULL == core) 1055 1055 goto fail_unlock; 1056 1056 1057 - memset(core,0,sizeof(*core)); 1058 1057 atomic_inc(&core->refcount); 1059 1058 core->pci_bus = pci->bus->number; 1060 1059 core->pci_slot = PCI_SLOT(pci->devfn);
+1 -2
drivers/media/video/cx88/cx88-dvb.c
··· 657 657 goto fail_core; 658 658 659 659 err = -ENOMEM; 660 - dev = kmalloc(sizeof(*dev),GFP_KERNEL); 660 + dev = kzalloc(sizeof(*dev),GFP_KERNEL); 661 661 if (NULL == dev) 662 662 goto fail_core; 663 - memset(dev,0,sizeof(*dev)); 664 663 dev->pci = pci_dev; 665 664 dev->core = core; 666 665
+1
drivers/media/video/cx88/cx88-input.c
··· 697 697 case CX88_BOARD_HAUPPAUGE_DVB_T1: 698 698 case CX88_BOARD_HAUPPAUGE_NOVASE2_S1: 699 699 case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1: 700 + case CX88_BOARD_HAUPPAUGE_HVR1100: 700 701 ircode = ir_decode_biphase(ir->samples, ir->scount, 5, 7); 701 702 ir_dprintk("biphase decoded: %x\n", ircode); 702 703 if ((ircode & 0xfffff000) != 0x3000)
+2 -4
drivers/media/video/cx88/cx88-video.c
··· 750 750 minor,radio,v4l2_type_names[type]); 751 751 752 752 /* allocate + initialize per filehandle data */ 753 - fh = kmalloc(sizeof(*fh),GFP_KERNEL); 753 + fh = kzalloc(sizeof(*fh),GFP_KERNEL); 754 754 if (NULL == fh) 755 755 return -ENOMEM; 756 - memset(fh,0,sizeof(*fh)); 757 756 file->private_data = fh; 758 757 fh->dev = dev; 759 758 fh->radio = radio; ··· 1808 1809 struct cx88_core *core; 1809 1810 int err; 1810 1811 1811 - dev = kmalloc(sizeof(*dev),GFP_KERNEL); 1812 + dev = kzalloc(sizeof(*dev),GFP_KERNEL); 1812 1813 if (NULL == dev) 1813 1814 return -ENOMEM; 1814 - memset(dev,0,sizeof(*dev)); 1815 1815 1816 1816 /* pci init */ 1817 1817 dev->pci = pci_dev;
+1 -2
drivers/media/video/dpc7146.c
··· 94 94 struct i2c_client *client; 95 95 struct list_head *item; 96 96 97 - dpc = (struct dpc*)kmalloc(sizeof(struct dpc), GFP_KERNEL); 97 + dpc = kzalloc(sizeof(struct dpc), GFP_KERNEL); 98 98 if( NULL == dpc ) { 99 99 printk("dpc_v4l2.o: dpc_probe: not enough kernel memory.\n"); 100 100 return -ENOMEM; 101 101 } 102 - memset(dpc, 0x0, sizeof(struct dpc)); 103 102 104 103 /* FIXME: enable i2c-port pins, video-port-pins 105 104 video port pins should be enabled here ?! */
+1 -2
drivers/media/video/em28xx/em28xx-video.c
··· 1861 1861 } 1862 1862 1863 1863 /* allocate memory for our device state and initialize it */ 1864 - dev = kmalloc(sizeof(*dev), GFP_KERNEL); 1864 + dev = kzalloc(sizeof(*dev), GFP_KERNEL); 1865 1865 if (dev == NULL) { 1866 1866 em28xx_err(DRIVER_NAME ": out of memory!\n"); 1867 1867 return -ENOMEM; 1868 1868 } 1869 - memset(dev, 0, sizeof(*dev)); 1870 1869 1871 1870 /* compute alternate max packet sizes */ 1872 1871 uif = udev->actconfig->interface[0];
+1 -2
drivers/media/video/hexium_gemini.c
··· 240 240 241 241 DEB_EE((".\n")); 242 242 243 - hexium = (struct hexium *) kmalloc(sizeof(struct hexium), GFP_KERNEL); 243 + hexium = kzalloc(sizeof(struct hexium), GFP_KERNEL); 244 244 if (NULL == hexium) { 245 245 printk("hexium_gemini: not enough kernel memory in hexium_attach().\n"); 246 246 return -ENOMEM; 247 247 } 248 - memset(hexium, 0x0, sizeof(struct hexium)); 249 248 dev->ext_priv = hexium; 250 249 251 250 /* enable i2c-port pins */
+1 -2
drivers/media/video/hexium_orion.c
··· 224 224 return -EFAULT; 225 225 } 226 226 227 - hexium = (struct hexium *) kmalloc(sizeof(struct hexium), GFP_KERNEL); 227 + hexium = kzalloc(sizeof(struct hexium), GFP_KERNEL); 228 228 if (NULL == hexium) { 229 229 printk("hexium_orion: hexium_probe: not enough kernel memory.\n"); 230 230 return -ENOMEM; 231 231 } 232 - memset(hexium, 0x0, sizeof(struct hexium)); 233 232 234 233 /* enable i2c-port pins */ 235 234 saa7146_write(dev, MC1, (MASK_08 | MASK_24 | MASK_10 | MASK_26));
+2 -5
drivers/media/video/indycam.c
··· 289 289 printk(KERN_INFO "SGI IndyCam driver version %s\n", 290 290 INDYCAM_MODULE_VERSION); 291 291 292 - client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); 292 + client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); 293 293 if (!client) 294 294 return -ENOMEM; 295 - camera = kmalloc(sizeof(struct indycam), GFP_KERNEL); 295 + camera = kzalloc(sizeof(struct indycam), GFP_KERNEL); 296 296 if (!camera) { 297 297 err = -ENOMEM; 298 298 goto out_free_client; 299 299 } 300 - 301 - memset(client, 0, sizeof(struct i2c_client)); 302 - memset(camera, 0, sizeof(struct indycam)); 303 300 304 301 client->addr = addr; 305 302 client->adapter = adap;
+32 -32
drivers/media/video/msp3400-driver.c
··· 66 66 67 67 /* module parameters */ 68 68 static int opmode = OPMODE_AUTO; 69 - int debug = 0; /* debug output */ 70 - int once = 0; /* no continous stereo monitoring */ 71 - int amsound = 0; /* hard-wire AM sound at 6.5 Hz (france), 69 + int msp_debug = 0; /* msp_debug output */ 70 + int msp_once = 0; /* no continous stereo monitoring */ 71 + int msp_amsound = 0; /* hard-wire AM sound at 6.5 Hz (france), 72 72 the autoscan seems work well only with FM... */ 73 - int standard = 1; /* Override auto detect of audio standard, if needed. */ 74 - int dolby = 0; 73 + int msp_standard = 1; /* Override auto detect of audio msp_standard, if needed. */ 74 + int msp_dolby = 0; 75 75 76 - int stereo_threshold = 0x190; /* a2 threshold for stereo/bilingual 76 + int msp_stereo_thresh = 0x190; /* a2 threshold for stereo/bilingual 77 77 (msp34xxg only) 0x00a0-0x03c0 */ 78 78 79 79 /* read-only */ 80 80 module_param(opmode, int, 0444); 81 81 82 82 /* read-write */ 83 - module_param(once, bool, 0644); 84 - module_param(debug, int, 0644); 85 - module_param(stereo_threshold, int, 0644); 86 - module_param(standard, int, 0644); 87 - module_param(amsound, bool, 0644); 88 - module_param(dolby, bool, 0644); 83 + module_param_named(once,msp_once, bool, 0644); 84 + module_param_named(debug,msp_debug, int, 0644); 85 + module_param_named(stereo_threshold,msp_stereo_thresh, int, 0644); 86 + module_param_named(standard,msp_standard, int, 0644); 87 + module_param_named(amsound,msp_amsound, bool, 0644); 88 + module_param_named(dolby,msp_dolby, bool, 0644); 89 89 90 90 MODULE_PARM_DESC(opmode, "Forces a MSP3400 opmode. 0=Manual, 1=Autodetect, 2=Autodetect and autoselect"); 91 91 MODULE_PARM_DESC(once, "No continuous stereo monitoring"); ··· 127 127 { client->addr, I2C_M_RD, 2, read }, 128 128 }; 129 129 130 - v4l_dbg(3, client, "msp_reset\n"); 130 + v4l_dbg(3, msp_debug, client, "msp_reset\n"); 131 131 if (i2c_transfer(client->adapter, &reset[0], 1) != 1 || 132 132 i2c_transfer(client->adapter, &reset[1], 1) != 1 || 133 133 i2c_transfer(client->adapter, test, 2) != 2) { ··· 165 165 return -1; 166 166 } 167 167 retval = read[0] << 8 | read[1]; 168 - v4l_dbg(3, client, "msp_read(0x%x, 0x%x): 0x%x\n", dev, addr, retval); 168 + v4l_dbg(3, msp_debug, client, "msp_read(0x%x, 0x%x): 0x%x\n", dev, addr, retval); 169 169 return retval; 170 170 } 171 171 ··· 190 190 buffer[3] = val >> 8; 191 191 buffer[4] = val & 0xff; 192 192 193 - v4l_dbg(3, client, "msp_write(0x%x, 0x%x, 0x%x)\n", dev, addr, val); 193 + v4l_dbg(3, msp_debug, client, "msp_write(0x%x, 0x%x, 0x%x)\n", dev, addr, val); 194 194 for (err = 0; err < 3; err++) { 195 195 if (i2c_master_send(client, buffer, 5) == 5) 196 196 break; ··· 273 273 } else 274 274 state->acb = 0xf60; /* Mute Input and SCART 1 Output */ 275 275 276 - v4l_dbg(1, client, "scart switch: %s => %d (ACB=0x%04x)\n", 276 + v4l_dbg(1, msp_debug, client, "scart switch: %s => %d (ACB=0x%04x)\n", 277 277 scart_names[in], out, state->acb); 278 278 msp_write_dsp(client, 0x13, state->acb); 279 279 ··· 285 285 { 286 286 struct msp_state *state = i2c_get_clientdata(client); 287 287 288 - v4l_dbg(1, client, "mute audio\n"); 288 + v4l_dbg(1, msp_debug, client, "mute audio\n"); 289 289 msp_write_dsp(client, 0x0000, 0); 290 290 msp_write_dsp(client, 0x0007, 1); 291 291 if (state->has_scart2_out_volume) ··· 303 303 if (!state->muted) 304 304 val = (state->volume * 0x7f / 65535) << 8; 305 305 306 - v4l_dbg(1, client, "mute=%s volume=%d\n", 306 + v4l_dbg(1, msp_debug, client, "mute=%s volume=%d\n", 307 307 state->muted ? "on" : "off", state->volume); 308 308 309 309 msp_write_dsp(client, 0x0000, val); ··· 321 321 treble = ((state->treble - 32768) * 0x60 / 65535) << 8; 322 322 loudness = state->loudness ? ((5 * 4) << 8) : 0; 323 323 324 - v4l_dbg(1, client, "balance=%d bass=%d treble=%d loudness=%d\n", 324 + v4l_dbg(1, msp_debug, client, "balance=%d bass=%d treble=%d loudness=%d\n", 325 325 state->balance, state->bass, state->treble, state->loudness); 326 326 327 327 msp_write_dsp(client, 0x0001, bal << 8); ··· 341 341 struct msp_state *state = i2c_get_clientdata(client); 342 342 343 343 if (state->radio) { 344 - v4l_dbg(1, client, "video mode selected to Radio\n"); 344 + v4l_dbg(1, msp_debug, client, "video mode selected to Radio\n"); 345 345 return 0x0003; 346 346 } 347 347 348 348 if (state->v4l2_std & V4L2_STD_PAL) { 349 - v4l_dbg(1, client, "video mode selected to PAL\n"); 349 + v4l_dbg(1, msp_debug, client, "video mode selected to PAL\n"); 350 350 351 351 #if 1 352 352 /* experimental: not sure this works with all chip versions */ ··· 357 357 #endif 358 358 } 359 359 if (state->v4l2_std & V4L2_STD_NTSC) { 360 - v4l_dbg(1, client, "video mode selected to NTSC\n"); 360 + v4l_dbg(1, msp_debug, client, "video mode selected to NTSC\n"); 361 361 return 0x2003; 362 362 } 363 363 if (state->v4l2_std & V4L2_STD_SECAM) { 364 - v4l_dbg(1, client, "video mode selected to SECAM\n"); 364 + v4l_dbg(1, msp_debug, client, "video mode selected to SECAM\n"); 365 365 return 0x0003; 366 366 } 367 367 return 0x0003; ··· 619 619 u16 *sarg = arg; 620 620 int scart = 0; 621 621 622 - if (debug >= 2) 622 + if (msp_debug >= 2) 623 623 v4l_i2c_print_ioctl(client, cmd); 624 624 625 625 switch (cmd) { ··· 666 666 if (state->radio) 667 667 return 0; 668 668 state->radio = 1; 669 - v4l_dbg(1, client, "switching to radio mode\n"); 669 + v4l_dbg(1, msp_debug, client, "switching to radio mode\n"); 670 670 state->watch_stereo = 0; 671 671 switch (state->opmode) { 672 672 case OPMODE_MANUAL: ··· 937 937 if (a->index < 0 || a->index > 2) 938 938 return -EINVAL; 939 939 940 - v4l_dbg(1, client, "Setting audio out on msp34xx to input %i\n", a->index); 940 + v4l_dbg(1, msp_debug, client, "Setting audio out on msp34xx to input %i\n", a->index); 941 941 msp_set_scart(client, state->in_scart, a->index + 1); 942 942 943 943 break; ··· 947 947 { 948 948 u32 *a = (u32 *)arg; 949 949 950 - v4l_dbg(1, client, "Setting I2S speed to %d\n", *a); 950 + v4l_dbg(1, msp_debug, client, "Setting I2S speed to %d\n", *a); 951 951 952 952 switch (*a) { 953 953 case 1024000: ··· 1041 1041 { 1042 1042 struct i2c_client *client = container_of(dev, struct i2c_client, dev); 1043 1043 1044 - v4l_dbg(1, client, "suspend\n"); 1044 + v4l_dbg(1, msp_debug, client, "suspend\n"); 1045 1045 msp_reset(client); 1046 1046 return 0; 1047 1047 } ··· 1050 1050 { 1051 1051 struct i2c_client *client = container_of(dev, struct i2c_client, dev); 1052 1052 1053 - v4l_dbg(1, client, "resume\n"); 1053 + v4l_dbg(1, msp_debug, client, "resume\n"); 1054 1054 msp_wake_thread(client); 1055 1055 return 0; 1056 1056 } ··· 1080 1080 snprintf(client->name, sizeof(client->name) - 1, "msp3400"); 1081 1081 1082 1082 if (msp_reset(client) == -1) { 1083 - v4l_dbg(1, client, "msp3400 not found\n"); 1083 + v4l_dbg(1, msp_debug, client, "msp3400 not found\n"); 1084 1084 kfree(client); 1085 1085 return -1; 1086 1086 } ··· 1107 1107 state->rev1 = msp_read_dsp(client, 0x1e); 1108 1108 if (state->rev1 != -1) 1109 1109 state->rev2 = msp_read_dsp(client, 0x1f); 1110 - v4l_dbg(1, client, "rev1=0x%04x, rev2=0x%04x\n", state->rev1, state->rev2); 1110 + v4l_dbg(1, msp_debug, client, "rev1=0x%04x, rev2=0x%04x\n", state->rev1, state->rev2); 1111 1111 if (state->rev1 == -1 || (state->rev1 == 0 && state->rev2 == 0)) { 1112 - v4l_dbg(1, client, "not an msp3400 (cannot read chip version)\n"); 1112 + v4l_dbg(1, msp_debug, client, "not an msp3400 (cannot read chip version)\n"); 1113 1113 kfree(state); 1114 1114 kfree(client); 1115 1115 return -1;
+62 -62
drivers/media/video/msp3400-kthreads.c
··· 168 168 struct msp_state *state = i2c_get_clientdata(client); 169 169 int i; 170 170 171 - v4l_dbg(1, client, "setmode: %d\n", type); 171 + v4l_dbg(1, msp_debug, client, "setmode: %d\n", type); 172 172 state->mode = type; 173 173 state->audmode = V4L2_TUNER_MODE_MONO; 174 174 state->rxsubchans = V4L2_TUNER_SUB_MONO; ··· 191 191 192 192 msp_write_dem(client, 0x0056, 0); /*LOAD_REG_1/2*/ 193 193 194 - if (dolby) { 194 + if (msp_dolby) { 195 195 msp_write_dsp(client, 0x0008, 0x0520); /* I2S1 */ 196 196 msp_write_dsp(client, 0x0009, 0x0620); /* I2S2 */ 197 197 msp_write_dsp(client, 0x000b, msp3400c_init_data[type].dsp_src); ··· 221 221 /* this method would break everything, let's make sure 222 222 * it's never called 223 223 */ 224 - v4l_dbg(1, client, "setstereo called with mode=%d instead of set_source (ignored)\n", 224 + v4l_dbg(1, msp_debug, client, "setstereo called with mode=%d instead of set_source (ignored)\n", 225 225 mode); 226 226 return; 227 227 } ··· 229 229 /* switch demodulator */ 230 230 switch (state->mode) { 231 231 case MSP_MODE_FM_TERRA: 232 - v4l_dbg(1, client, "FM setstereo: %s\n", strmode[mode]); 232 + v4l_dbg(1, msp_debug, client, "FM setstereo: %s\n", strmode[mode]); 233 233 msp3400c_setcarrier(client, state->second, state->main); 234 234 switch (mode) { 235 235 case V4L2_TUNER_MODE_STEREO: ··· 243 243 } 244 244 break; 245 245 case MSP_MODE_FM_SAT: 246 - v4l_dbg(1, client, "SAT setstereo: %s\n", strmode[mode]); 246 + v4l_dbg(1, msp_debug, client, "SAT setstereo: %s\n", strmode[mode]); 247 247 switch (mode) { 248 248 case V4L2_TUNER_MODE_MONO: 249 249 msp3400c_setcarrier(client, MSP_CARRIER(6.5), MSP_CARRIER(6.5)); ··· 262 262 case MSP_MODE_FM_NICAM1: 263 263 case MSP_MODE_FM_NICAM2: 264 264 case MSP_MODE_AM_NICAM: 265 - v4l_dbg(1, client, "NICAM setstereo: %s\n",strmode[mode]); 265 + v4l_dbg(1, msp_debug, client, "NICAM setstereo: %s\n",strmode[mode]); 266 266 msp3400c_setcarrier(client,state->second,state->main); 267 267 if (state->nicam_on) 268 268 nicam=0x0100; 269 269 break; 270 270 case MSP_MODE_BTSC: 271 - v4l_dbg(1, client, "BTSC setstereo: %s\n",strmode[mode]); 271 + v4l_dbg(1, msp_debug, client, "BTSC setstereo: %s\n",strmode[mode]); 272 272 nicam=0x0300; 273 273 break; 274 274 case MSP_MODE_EXTERN: 275 - v4l_dbg(1, client, "extern setstereo: %s\n",strmode[mode]); 275 + v4l_dbg(1, msp_debug, client, "extern setstereo: %s\n",strmode[mode]); 276 276 nicam = 0x0200; 277 277 break; 278 278 case MSP_MODE_FM_RADIO: 279 - v4l_dbg(1, client, "FM-Radio setstereo: %s\n",strmode[mode]); 279 + v4l_dbg(1, msp_debug, client, "FM-Radio setstereo: %s\n",strmode[mode]); 280 280 break; 281 281 default: 282 - v4l_dbg(1, client, "mono setstereo\n"); 282 + v4l_dbg(1, msp_debug, client, "mono setstereo\n"); 283 283 return; 284 284 } 285 285 ··· 290 290 break; 291 291 case V4L2_TUNER_MODE_MONO: 292 292 if (state->mode == MSP_MODE_AM_NICAM) { 293 - v4l_dbg(1, client, "switching to AM mono\n"); 293 + v4l_dbg(1, msp_debug, client, "switching to AM mono\n"); 294 294 /* AM mono decoding is handled by tuner, not MSP chip */ 295 295 /* SCART switching control register */ 296 296 msp_set_scart(client, SCART_MONO, 0); ··· 304 304 src = 0x0010 | nicam; 305 305 break; 306 306 } 307 - v4l_dbg(1, client, "setstereo final source/matrix = 0x%x\n", src); 307 + v4l_dbg(1, msp_debug, client, "setstereo final source/matrix = 0x%x\n", src); 308 308 309 - if (dolby) { 309 + if (msp_dolby) { 310 310 msp_write_dsp(client, 0x0008, 0x0520); 311 311 msp_write_dsp(client, 0x0009, 0x0620); 312 312 msp_write_dsp(client, 0x000a, src); ··· 327 327 struct msp_state *state = i2c_get_clientdata(client); 328 328 329 329 if (state->main == state->second) { 330 - v4l_dbg(1, client, "mono sound carrier: %d.%03d MHz\n", 330 + v4l_dbg(1, msp_debug, client, "mono sound carrier: %d.%03d MHz\n", 331 331 state->main / 910000, (state->main / 910) % 1000); 332 332 } else { 333 - v4l_dbg(1, client, "main sound carrier: %d.%03d MHz\n", 333 + v4l_dbg(1, msp_debug, client, "main sound carrier: %d.%03d MHz\n", 334 334 state->main / 910000, (state->main / 910) % 1000); 335 335 } 336 336 if (state->mode == MSP_MODE_FM_NICAM1 || state->mode == MSP_MODE_FM_NICAM2) 337 - v4l_dbg(1, client, "NICAM/FM carrier : %d.%03d MHz\n", 337 + v4l_dbg(1, msp_debug, client, "NICAM/FM carrier : %d.%03d MHz\n", 338 338 state->second / 910000, (state->second/910) % 1000); 339 339 if (state->mode == MSP_MODE_AM_NICAM) 340 - v4l_dbg(1, client, "NICAM/AM carrier : %d.%03d MHz\n", 340 + v4l_dbg(1, msp_debug, client, "NICAM/AM carrier : %d.%03d MHz\n", 341 341 state->second / 910000, (state->second / 910) % 1000); 342 342 if (state->mode == MSP_MODE_FM_TERRA && state->main != state->second) { 343 - v4l_dbg(1, client, "FM-stereo carrier : %d.%03d MHz\n", 343 + v4l_dbg(1, msp_debug, client, "FM-stereo carrier : %d.%03d MHz\n", 344 344 state->second / 910000, (state->second / 910) % 1000); 345 345 } 346 346 } ··· 360 360 val = msp_read_dsp(client, 0x18); 361 361 if (val > 32767) 362 362 val -= 65536; 363 - v4l_dbg(2, client, "stereo detect register: %d\n", val); 363 + v4l_dbg(2, msp_debug, client, "stereo detect register: %d\n", val); 364 364 if (val > 4096) { 365 365 rxsubchans = V4L2_TUNER_SUB_STEREO | V4L2_TUNER_SUB_MONO; 366 366 } else if (val < -4096) { ··· 374 374 case MSP_MODE_FM_NICAM2: 375 375 case MSP_MODE_AM_NICAM: 376 376 val = msp_read_dem(client, 0x23); 377 - v4l_dbg(2, client, "nicam sync=%d, mode=%d\n", 377 + v4l_dbg(2, msp_debug, client, "nicam sync=%d, mode=%d\n", 378 378 val & 1, (val & 0x1e) >> 1); 379 379 380 380 if (val & 1) { ··· 407 407 break; 408 408 case MSP_MODE_BTSC: 409 409 val = msp_read_dem(client, 0x200); 410 - v4l_dbg(2, client, "status=0x%x (pri=%s, sec=%s, %s%s%s)\n", 410 + v4l_dbg(2, msp_debug, client, "status=0x%x (pri=%s, sec=%s, %s%s%s)\n", 411 411 val, 412 412 (val & 0x0002) ? "no" : "yes", 413 413 (val & 0x0004) ? "no" : "yes", ··· 421 421 } 422 422 if (rxsubchans != state->rxsubchans) { 423 423 update = 1; 424 - v4l_dbg(1, client, "watch: rxsubchans %d => %d\n", 424 + v4l_dbg(1, msp_debug, client, "watch: rxsubchans %d => %d\n", 425 425 state->rxsubchans,rxsubchans); 426 426 state->rxsubchans = rxsubchans; 427 427 } 428 428 if (newnicam != state->nicam_on) { 429 429 update = 1; 430 - v4l_dbg(1, client, "watch: nicam %d => %d\n", 430 + v4l_dbg(1, msp_debug, client, "watch: nicam %d => %d\n", 431 431 state->nicam_on,newnicam); 432 432 state->nicam_on = newnicam; 433 433 } ··· 452 452 msp3400c_setstereo(client, V4L2_TUNER_MODE_MONO); 453 453 } 454 454 455 - if (once) 455 + if (msp_once) 456 456 state->watch_stereo = 0; 457 457 } 458 458 ··· 464 464 int count, max1,max2,val1,val2, val,this; 465 465 466 466 467 - v4l_dbg(1, client, "msp3400 daemon started\n"); 467 + v4l_dbg(1, msp_debug, client, "msp3400 daemon started\n"); 468 468 for (;;) { 469 - v4l_dbg(2, client, "msp3400 thread: sleep\n"); 469 + v4l_dbg(2, msp_debug, client, "msp3400 thread: sleep\n"); 470 470 msp_sleep(state, -1); 471 - v4l_dbg(2, client, "msp3400 thread: wakeup\n"); 471 + v4l_dbg(2, msp_debug, client, "msp3400 thread: wakeup\n"); 472 472 473 473 restart: 474 - v4l_dbg(1, client, "thread: restart scan\n"); 474 + v4l_dbg(1, msp_debug, client, "thread: restart scan\n"); 475 475 state->restart = 0; 476 476 if (kthread_should_stop()) 477 477 break; 478 478 479 479 if (state->radio || MSP_MODE_EXTERN == state->mode) { 480 480 /* no carrier scan, just unmute */ 481 - v4l_dbg(1, client, "thread: no carrier scan\n"); 481 + v4l_dbg(1, msp_debug, client, "thread: no carrier scan\n"); 482 482 msp_set_audio(client); 483 483 continue; 484 484 } ··· 498 498 cd = msp3400c_carrier_detect_main; 499 499 count = ARRAY_SIZE(msp3400c_carrier_detect_main); 500 500 501 - if (amsound && (state->v4l2_std & V4L2_STD_SECAM)) { 501 + if (msp_amsound && (state->v4l2_std & V4L2_STD_SECAM)) { 502 502 /* autodetect doesn't work well with AM ... */ 503 503 max1 = 3; 504 504 count = 0; 505 - v4l_dbg(1, client, "AM sound override\n"); 505 + v4l_dbg(1, msp_debug, client, "AM sound override\n"); 506 506 } 507 507 508 508 for (this = 0; this < count; this++) { ··· 514 514 val -= 65536; 515 515 if (val1 < val) 516 516 val1 = val, max1 = this; 517 - v4l_dbg(1, client, "carrier1 val: %5d / %s\n", val,cd[this].name); 517 + v4l_dbg(1, msp_debug, client, "carrier1 val: %5d / %s\n", val,cd[this].name); 518 518 } 519 519 520 520 /* carrier detect pass #2 -- second (stereo) carrier */ ··· 535 535 break; 536 536 } 537 537 538 - if (amsound && (state->v4l2_std & V4L2_STD_SECAM)) { 538 + if (msp_amsound && (state->v4l2_std & V4L2_STD_SECAM)) { 539 539 /* autodetect doesn't work well with AM ... */ 540 540 cd = NULL; 541 541 count = 0; ··· 550 550 val -= 65536; 551 551 if (val2 < val) 552 552 val2 = val, max2 = this; 553 - v4l_dbg(1, client, "carrier2 val: %5d / %s\n", val,cd[this].name); 553 + v4l_dbg(1, msp_debug, client, "carrier2 val: %5d / %s\n", val,cd[this].name); 554 554 } 555 555 556 556 /* program the msp3400 according to the results */ ··· 627 627 /* unmute */ 628 628 msp_set_audio(client); 629 629 630 - if (debug) 630 + if (msp_debug) 631 631 msp3400c_print_mode(client); 632 632 633 633 /* monitor tv audio mode */ ··· 637 637 watch_stereo(client); 638 638 } 639 639 } 640 - v4l_dbg(1, client, "thread: exit\n"); 640 + v4l_dbg(1, msp_debug, client, "thread: exit\n"); 641 641 return 0; 642 642 } 643 643 ··· 648 648 struct msp_state *state = i2c_get_clientdata(client); 649 649 int val, i, std; 650 650 651 - v4l_dbg(1, client, "msp3410 daemon started\n"); 651 + v4l_dbg(1, msp_debug, client, "msp3410 daemon started\n"); 652 652 653 653 for (;;) { 654 - v4l_dbg(2, client, "msp3410 thread: sleep\n"); 654 + v4l_dbg(2, msp_debug, client, "msp3410 thread: sleep\n"); 655 655 msp_sleep(state,-1); 656 - v4l_dbg(2, client, "msp3410 thread: wakeup\n"); 656 + v4l_dbg(2, msp_debug, client, "msp3410 thread: wakeup\n"); 657 657 658 658 restart: 659 - v4l_dbg(1, client, "thread: restart scan\n"); 659 + v4l_dbg(1, msp_debug, client, "thread: restart scan\n"); 660 660 state->restart = 0; 661 661 if (kthread_should_stop()) 662 662 break; 663 663 664 664 if (state->mode == MSP_MODE_EXTERN) { 665 665 /* no carrier scan needed, just unmute */ 666 - v4l_dbg(1, client, "thread: no carrier scan\n"); 666 + v4l_dbg(1, msp_debug, client, "thread: no carrier scan\n"); 667 667 msp_set_audio(client); 668 668 continue; 669 669 } ··· 682 682 std = (state->v4l2_std & V4L2_STD_NTSC) ? 0x20 : 1; 683 683 state->watch_stereo = 0; 684 684 685 - if (debug) 686 - v4l_dbg(1, client, "setting standard: %s (0x%04x)\n", 685 + if (msp_debug) 686 + v4l_dbg(1, msp_debug, client, "setting standard: %s (0x%04x)\n", 687 687 msp_standard_std_name(std), std); 688 688 689 689 if (std != 1) { ··· 700 700 val = msp_read_dem(client, 0x7e); 701 701 if (val < 0x07ff) 702 702 break; 703 - v4l_dbg(1, client, "detection still in progress\n"); 703 + v4l_dbg(1, msp_debug, client, "detection still in progress\n"); 704 704 } 705 705 } 706 706 for (i = 0; msp_stdlist[i].name != NULL; i++) 707 707 if (msp_stdlist[i].retval == val) 708 708 break; 709 - v4l_dbg(1, client, "current standard: %s (0x%04x)\n", 709 + v4l_dbg(1, msp_debug, client, "current standard: %s (0x%04x)\n", 710 710 msp_standard_std_name(val), val); 711 711 state->main = msp_stdlist[i].main; 712 712 state->second = msp_stdlist[i].second; 713 713 state->std = val; 714 714 715 - if (amsound && !state->radio && (state->v4l2_std & V4L2_STD_SECAM) && 715 + if (msp_amsound && !state->radio && (state->v4l2_std & V4L2_STD_SECAM) && 716 716 (val != 0x0009)) { 717 717 /* autodetection has failed, let backup */ 718 - v4l_dbg(1, client, "autodetection failed," 718 + v4l_dbg(1, msp_debug, client, "autodetection failed," 719 719 " switching to backup standard: %s (0x%04x)\n", 720 720 msp_stdlist[8].name ? msp_stdlist[8].name : "unknown",val); 721 721 val = 0x0009; ··· 798 798 watch_stereo(client); 799 799 } 800 800 } 801 - v4l_dbg(1, client, "thread: exit\n"); 801 + v4l_dbg(1, msp_debug, client, "thread: exit\n"); 802 802 return 0; 803 803 } 804 804 805 805 /* ----------------------------------------------------------------------- */ 806 806 807 - /* msp34xxG + (autoselect no-thread) */ 807 + /* msp34xxG + (autoselect no-thread) */ 808 808 /* this one uses both automatic standard detection and automatic sound */ 809 809 /* select which are available in the newer G versions */ 810 810 /* struct msp: only norm, acb and source are really used in this mode */ ··· 825 825 */ 826 826 int value = (source & 0x07) << 8 | (source == 0 ? 0x30 : 0x20); 827 827 828 - v4l_dbg(1, client, "set source to %d (0x%x)\n", source, value); 828 + v4l_dbg(1, msp_debug, client, "set source to %d (0x%x)\n", source, value); 829 829 /* Loudspeaker Output */ 830 830 msp_write_dsp(client, 0x08, value); 831 831 /* SCART1 DA Output */ ··· 840 840 * 0x7f0 = forced mono mode 841 841 */ 842 842 /* a2 threshold for stereo/bilingual */ 843 - msp_write_dem(client, 0x22, stereo_threshold); 843 + msp_write_dem(client, 0x22, msp_stereo_thresh); 844 844 state->source = source; 845 845 } 846 846 ··· 897 897 struct msp_state *state = i2c_get_clientdata(client); 898 898 int val, std, i; 899 899 900 - v4l_dbg(1, client, "msp34xxg daemon started\n"); 900 + v4l_dbg(1, msp_debug, client, "msp34xxg daemon started\n"); 901 901 902 902 state->source = 1; /* default */ 903 903 for (;;) { 904 - v4l_dbg(2, client, "msp34xxg thread: sleep\n"); 904 + v4l_dbg(2, msp_debug, client, "msp34xxg thread: sleep\n"); 905 905 msp_sleep(state, -1); 906 - v4l_dbg(2, client, "msp34xxg thread: wakeup\n"); 906 + v4l_dbg(2, msp_debug, client, "msp34xxg thread: wakeup\n"); 907 907 908 908 restart: 909 - v4l_dbg(1, client, "thread: restart scan\n"); 909 + v4l_dbg(1, msp_debug, client, "thread: restart scan\n"); 910 910 state->restart = 0; 911 911 if (kthread_should_stop()) 912 912 break; 913 913 914 914 /* setup the chip*/ 915 915 msp34xxg_reset(client); 916 - std = standard; 916 + std = msp_standard; 917 917 if (std != 0x01) 918 918 goto unmute; 919 919 920 920 /* watch autodetect */ 921 - v4l_dbg(1, client, "triggered autodetect, waiting for result\n"); 921 + v4l_dbg(1, msp_debug, client, "triggered autodetect, waiting for result\n"); 922 922 for (i = 0; i < 10; i++) { 923 923 if (msp_sleep(state, 100)) 924 924 goto restart; ··· 929 929 std = val; 930 930 break; 931 931 } 932 - v4l_dbg(2, client, "detection still in progress\n"); 932 + v4l_dbg(2, msp_debug, client, "detection still in progress\n"); 933 933 } 934 934 if (std == 1) { 935 - v4l_dbg(1, client, "detection still in progress after 10 tries. giving up.\n"); 935 + v4l_dbg(1, msp_debug, client, "detection still in progress after 10 tries. giving up.\n"); 936 936 continue; 937 937 } 938 938 939 939 unmute: 940 940 state->std = std; 941 - v4l_dbg(1, client, "current standard: %s (0x%04x)\n", 941 + v4l_dbg(1, msp_debug, client, "current standard: %s (0x%04x)\n", 942 942 msp_standard_std_name(std), std); 943 943 944 944 /* unmute: dispatch sound to scart output, set scart volume */ ··· 950 950 951 951 msp_write_dem(client, 0x40, state->i2s_mode); 952 952 } 953 - v4l_dbg(1, client, "thread: exit\n"); 953 + v4l_dbg(1, msp_debug, client, "thread: exit\n"); 954 954 return 0; 955 955 } 956 956 ··· 976 976 * this is a problem, I'll handle SAP just like lang1/lang2. 977 977 */ 978 978 } 979 - v4l_dbg(1, client, "status=0x%x, stereo=%d, bilingual=%d -> rxsubchans=%d\n", 979 + v4l_dbg(1, msp_debug, client, "status=0x%x, stereo=%d, bilingual=%d -> rxsubchans=%d\n", 980 980 status, is_stereo, is_bilingual, state->rxsubchans); 981 981 } 982 982
+6 -6
drivers/media/video/msp3400.h
··· 48 48 #define OPMODE_AUTOSELECT 2 /* use autodetect & autoselect (>= msp34xxG) */ 49 49 50 50 /* module parameters */ 51 - extern int debug; 52 - extern int once; 53 - extern int amsound; 54 - extern int standard; 55 - extern int dolby; 56 - extern int stereo_threshold; 51 + extern int msp_debug; 52 + extern int msp_once; 53 + extern int msp_amsound; 54 + extern int msp_standard; 55 + extern int msp_dolby; 56 + extern int msp_stereo_thresh; 57 57 58 58 struct msp_state { 59 59 int rev1, rev2;
+4 -4
drivers/media/video/mt20xx.c
··· 21 21 module_param(radio_antenna, int, 0644); 22 22 23 23 /* from tuner-core.c */ 24 - extern int debug; 24 + extern int tuner_debug; 25 25 26 26 /* ---------------------------------------------------------------------- */ 27 27 ··· 404 404 div2a=(lo2/8)-1; 405 405 div2b=lo2-(div2a+1)*8; 406 406 407 - if (debug > 1) { 407 + if (tuner_debug > 1) { 408 408 tuner_dbg("lo1 lo2 = %d %d\n", lo1, lo2); 409 409 tuner_dbg("num1 num2 div1a div1b div2a div2b= %x %x %x %x %x %x\n", 410 410 num1,num2,div1a,div1b,div2a,div2b); ··· 420 420 buf[5]=div2a; 421 421 if(num2!=0) buf[5]=buf[5]|0x40; 422 422 423 - if (debug > 1) { 423 + if (tuner_debug > 1) { 424 424 int i; 425 425 tuner_dbg("bufs is: "); 426 426 for(i=0;i<6;i++) ··· 508 508 509 509 i2c_master_send(c,buf,1); 510 510 i2c_master_recv(c,buf,21); 511 - if (debug) { 511 + if (tuner_debug) { 512 512 int i; 513 513 tuner_dbg("MT20xx hexdump:"); 514 514 for(i=0;i<21;i++) {
+1 -2
drivers/media/video/mxb.c
··· 177 177 return -ENODEV; 178 178 } 179 179 180 - mxb = (struct mxb*)kmalloc(sizeof(struct mxb), GFP_KERNEL); 180 + mxb = kzalloc(sizeof(struct mxb), GFP_KERNEL); 181 181 if( NULL == mxb ) { 182 182 DEB_D(("not enough kernel memory.\n")); 183 183 return -ENOMEM; 184 184 } 185 - memset(mxb, 0x0, sizeof(struct mxb)); 186 185 187 186 mxb->i2c_adapter = (struct i2c_adapter) { 188 187 .class = I2C_CLASS_TV_ANALOG,
+1 -2
drivers/media/video/ovcamchip/ov6x20.c
··· 178 178 if (rc < 0) 179 179 return rc; 180 180 181 - ov->spriv = s = kmalloc(sizeof *s, GFP_KERNEL); 181 + ov->spriv = s = kzalloc(sizeof *s, GFP_KERNEL); 182 182 if (!s) 183 183 return -ENOMEM; 184 - memset(s, 0, sizeof *s); 185 184 186 185 s->auto_brt = 1; 187 186 s->auto_exp = 1;
+1 -2
drivers/media/video/ovcamchip/ov6x30.c
··· 141 141 if (rc < 0) 142 142 return rc; 143 143 144 - ov->spriv = s = kmalloc(sizeof *s, GFP_KERNEL); 144 + ov->spriv = s = kzalloc(sizeof *s, GFP_KERNEL); 145 145 if (!s) 146 146 return -ENOMEM; 147 - memset(s, 0, sizeof *s); 148 147 149 148 s->auto_brt = 1; 150 149 s->auto_exp = 1;
+1 -2
drivers/media/video/ovcamchip/ov76be.c
··· 105 105 if (rc < 0) 106 106 return rc; 107 107 108 - ov->spriv = s = kmalloc(sizeof *s, GFP_KERNEL); 108 + ov->spriv = s = kzalloc(sizeof *s, GFP_KERNEL); 109 109 if (!s) 110 110 return -ENOMEM; 111 - memset(s, 0, sizeof *s); 112 111 113 112 s->auto_brt = 1; 114 113 s->auto_exp = 1;
+1 -2
drivers/media/video/ovcamchip/ov7x10.c
··· 115 115 if (rc < 0) 116 116 return rc; 117 117 118 - ov->spriv = s = kmalloc(sizeof *s, GFP_KERNEL); 118 + ov->spriv = s = kzalloc(sizeof *s, GFP_KERNEL); 119 119 if (!s) 120 120 return -ENOMEM; 121 - memset(s, 0, sizeof *s); 122 121 123 122 s->auto_brt = 1; 124 123 s->auto_exp = 1;
+1 -2
drivers/media/video/ovcamchip/ov7x20.c
··· 232 232 if (rc < 0) 233 233 return rc; 234 234 235 - ov->spriv = s = kmalloc(sizeof *s, GFP_KERNEL); 235 + ov->spriv = s = kzalloc(sizeof *s, GFP_KERNEL); 236 236 if (!s) 237 237 return -ENOMEM; 238 - memset(s, 0, sizeof *s); 239 238 240 239 s->auto_brt = 1; 241 240 s->auto_exp = DFL_AUTO_EXP;
+1 -2
drivers/media/video/ovcamchip/ovcamchip_core.c
··· 316 316 c->adapter = adap; 317 317 strcpy(c->name, "OV????"); 318 318 319 - ov = kmalloc(sizeof *ov, GFP_KERNEL); 319 + ov = kzalloc(sizeof *ov, GFP_KERNEL); 320 320 if (!ov) { 321 321 rc = -ENOMEM; 322 322 goto no_ov; 323 323 } 324 - memset(ov, 0, sizeof *ov); 325 324 i2c_set_clientdata(c, ov); 326 325 327 326 rc = ovcamchip_detect(c);
+1 -2
drivers/media/video/saa5246a.c
··· 83 83 client_template.adapter = adap; 84 84 client_template.addr = addr; 85 85 memcpy(client, &client_template, sizeof(*client)); 86 - t = kmalloc(sizeof(*t), GFP_KERNEL); 86 + t = kzalloc(sizeof(*t), GFP_KERNEL); 87 87 if(t==NULL) 88 88 { 89 89 kfree(client); 90 90 return -ENOMEM; 91 91 } 92 - memset(t, 0, sizeof(*t)); 93 92 strlcpy(client->name, IF_NAME, I2C_NAME_SIZE); 94 93 init_MUTEX(&t->lock); 95 94
+2 -3
drivers/media/video/saa5249.c
··· 151 151 client_template.adapter = adap; 152 152 client_template.addr = addr; 153 153 memcpy(client, &client_template, sizeof(*client)); 154 - t = kmalloc(sizeof(*t), GFP_KERNEL); 154 + t = kzalloc(sizeof(*t), GFP_KERNEL); 155 155 if(t==NULL) 156 156 { 157 157 kfree(client); 158 158 return -ENOMEM; 159 159 } 160 - memset(t, 0, sizeof(*t)); 161 160 strlcpy(client->name, IF_NAME, I2C_NAME_SIZE); 162 161 init_MUTEX(&t->lock); 163 162 ··· 164 165 * Now create a video4linux device 165 166 */ 166 167 167 - vd = (struct video_device *)kmalloc(sizeof(struct video_device), GFP_KERNEL); 168 + vd = kmalloc(sizeof(struct video_device), GFP_KERNEL); 168 169 if(vd==NULL) 169 170 { 170 171 kfree(t);
+2 -4
drivers/media/video/saa7110.c
··· 494 494 I2C_FUNC_SMBUS_READ_BYTE | I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) 495 495 return 0; 496 496 497 - client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); 497 + client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); 498 498 if (client == 0) 499 499 return -ENOMEM; 500 - memset(client, 0, sizeof(struct i2c_client)); 501 500 client->addr = address; 502 501 client->adapter = adapter; 503 502 client->driver = &i2c_driver_saa7110; 504 503 strlcpy(I2C_NAME(client), "saa7110", sizeof(I2C_NAME(client))); 505 504 506 - decoder = kmalloc(sizeof(struct saa7110), GFP_KERNEL); 505 + decoder = kzalloc(sizeof(struct saa7110), GFP_KERNEL); 507 506 if (decoder == 0) { 508 507 kfree(client); 509 508 return -ENOMEM; 510 509 } 511 - memset(decoder, 0, sizeof(struct saa7110)); 512 510 decoder->norm = VIDEO_MODE_PAL; 513 511 decoder->input = 0; 514 512 decoder->enable = 1;
+2 -4
drivers/media/video/saa7111.c
··· 511 511 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) 512 512 return 0; 513 513 514 - client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); 514 + client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); 515 515 if (client == 0) 516 516 return -ENOMEM; 517 - memset(client, 0, sizeof(struct i2c_client)); 518 517 client->addr = address; 519 518 client->adapter = adapter; 520 519 client->driver = &i2c_driver_saa7111; 521 520 strlcpy(I2C_NAME(client), "saa7111", sizeof(I2C_NAME(client))); 522 521 523 - decoder = kmalloc(sizeof(struct saa7111), GFP_KERNEL); 522 + decoder = kzalloc(sizeof(struct saa7111), GFP_KERNEL); 524 523 if (decoder == NULL) { 525 524 kfree(client); 526 525 return -ENOMEM; 527 526 } 528 - memset(decoder, 0, sizeof(struct saa7111)); 529 527 decoder->norm = VIDEO_MODE_NTSC; 530 528 decoder->input = 0; 531 529 decoder->enable = 1;
+2 -4
drivers/media/video/saa7114.c
··· 852 852 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) 853 853 return 0; 854 854 855 - client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); 855 + client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); 856 856 if (client == 0) 857 857 return -ENOMEM; 858 - memset(client, 0, sizeof(struct i2c_client)); 859 858 client->addr = address; 860 859 client->adapter = adapter; 861 860 client->driver = &i2c_driver_saa7114; 862 861 strlcpy(I2C_NAME(client), "saa7114", sizeof(I2C_NAME(client))); 863 862 864 - decoder = kmalloc(sizeof(struct saa7114), GFP_KERNEL); 863 + decoder = kzalloc(sizeof(struct saa7114), GFP_KERNEL); 865 864 if (decoder == NULL) { 866 865 kfree(client); 867 866 return -ENOMEM; 868 867 } 869 - memset(decoder, 0, sizeof(struct saa7114)); 870 868 decoder->norm = VIDEO_MODE_NTSC; 871 869 decoder->input = -1; 872 870 decoder->enable = 1;
+21 -23
drivers/media/video/saa7115.c
··· 549 549 u32 hz; 550 550 u64 f; 551 551 552 - v4l_dbg(1, client, "set audio clock freq: %d\n", freq); 552 + v4l_dbg(1, debug, client, "set audio clock freq: %d\n", freq); 553 553 554 554 /* sanity check */ 555 555 if (freq < 32000 || freq > 48000) ··· 670 670 671 671 // This works for NTSC-M, SECAM-L and the 50Hz PAL variants. 672 672 if (std & V4L2_STD_525_60) { 673 - v4l_dbg(1, client, "decoder set standard 60 Hz\n"); 673 + v4l_dbg(1, debug, client, "decoder set standard 60 Hz\n"); 674 674 saa7115_writeregs(client, saa7115_cfg_60hz_video); 675 675 } else { 676 - v4l_dbg(1, client, "decoder set standard 50 Hz\n"); 676 + v4l_dbg(1, debug, client, "decoder set standard 50 Hz\n"); 677 677 saa7115_writeregs(client, saa7115_cfg_50hz_video); 678 678 } 679 679 ··· 863 863 864 864 pix = &(fmt->fmt.pix); 865 865 866 - v4l_dbg(1, client, "decoder set size\n"); 866 + v4l_dbg(1, debug, client, "decoder set size\n"); 867 867 868 868 /* FIXME need better bounds checking here */ 869 869 if ((pix->width < 1) || (pix->width > 1440)) ··· 889 889 HPSC = HPSC ? HPSC : 1; 890 890 HFSC = (int)((1024 * 720) / (HPSC * pix->width)); 891 891 892 - v4l_dbg(1, client, "Hpsc: 0x%05x, Hfsc: 0x%05x\n", HPSC, HFSC); 892 + v4l_dbg(1, debug, client, "Hpsc: 0x%05x, Hfsc: 0x%05x\n", HPSC, HFSC); 893 893 /* FIXME hardcodes to "Task B" 894 894 * write H prescaler integer */ 895 895 saa7115_write(client, 0xd0, (u8) (HPSC & 0x3f)); ··· 903 903 saa7115_write(client, 0xDD, (u8) ((HFSC >> 9) & 0xff)); 904 904 } else { 905 905 if (is_50hz) { 906 - v4l_dbg(1, client, "Setting full 50hz width\n"); 906 + v4l_dbg(1, debug, client, "Setting full 50hz width\n"); 907 907 saa7115_writeregs(client, saa7115_cfg_50hz_fullres_x); 908 908 } else { 909 - v4l_dbg(1, client, "Setting full 60hz width\n"); 909 + v4l_dbg(1, debug, client, "Setting full 60hz width\n"); 910 910 saa7115_writeregs(client, saa7115_cfg_60hz_fullres_x); 911 911 } 912 912 } ··· 915 915 916 916 if (pix->height != Vsrc) { 917 917 VSCY = (int)((1024 * Vsrc) / pix->height); 918 - v4l_dbg(1, client, "Vsrc: %d, Vscy: 0x%05x\n", Vsrc, VSCY); 918 + v4l_dbg(1, debug, client, "Vsrc: %d, Vscy: 0x%05x\n", Vsrc, VSCY); 919 919 920 920 /* Correct Contrast and Luminance */ 921 921 saa7115_write(client, 0xd5, (u8) (64 * 1024 / VSCY)); ··· 929 929 saa7115_write(client, 0xe3, (u8) ((VSCY >> 8) & 0xff)); 930 930 } else { 931 931 if (is_50hz) { 932 - v4l_dbg(1, client, "Setting full 50Hz height\n"); 932 + v4l_dbg(1, debug, client, "Setting full 50Hz height\n"); 933 933 saa7115_writeregs(client, saa7115_cfg_50hz_fullres_y); 934 934 } else { 935 - v4l_dbg(1, client, "Setting full 60hz height\n"); 935 + v4l_dbg(1, debug, client, "Setting full 60hz height\n"); 936 936 saa7115_writeregs(client, saa7115_cfg_60hz_fullres_y); 937 937 } 938 938 } ··· 1079 1079 break; 1080 1080 status = saa7115_read(client, 0x1f); 1081 1081 1082 - v4l_dbg(1, client, "status: 0x%02x\n", status); 1082 + v4l_dbg(1, debug, client, "status: 0x%02x\n", status); 1083 1083 vt->signal = ((status & (1 << 6)) == 0) ? 0xffff : 0x0; 1084 1084 break; 1085 1085 } ··· 1125 1125 break; 1126 1126 1127 1127 case VIDIOC_S_INPUT: 1128 - v4l_dbg(1, client, "decoder set input %d\n", *iarg); 1128 + v4l_dbg(1, debug, client, "decoder set input %d\n", *iarg); 1129 1129 /* inputs from 0-9 are available */ 1130 1130 if (*iarg < 0 || *iarg > 9) { 1131 1131 return -EINVAL; ··· 1133 1133 1134 1134 if (state->input == *iarg) 1135 1135 break; 1136 - v4l_dbg(1, client, "now setting %s input\n", 1136 + v4l_dbg(1, debug, client, "now setting %s input\n", 1137 1137 *iarg >= 6 ? "S-Video" : "Composite"); 1138 1138 state->input = *iarg; 1139 1139 ··· 1150 1150 1151 1151 case VIDIOC_STREAMON: 1152 1152 case VIDIOC_STREAMOFF: 1153 - v4l_dbg(1, client, "%s output\n", 1153 + v4l_dbg(1, debug, client, "%s output\n", 1154 1154 (cmd == VIDIOC_STREAMON) ? "enable" : "disable"); 1155 1155 1156 1156 if (state->enable != (cmd == VIDIOC_STREAMON)) { ··· 1164 1164 break; 1165 1165 1166 1166 case VIDIOC_INT_RESET: 1167 - v4l_dbg(1, client, "decoder RESET\n"); 1167 + v4l_dbg(1, debug, client, "decoder RESET\n"); 1168 1168 saa7115_writeregs(client, saa7115_cfg_reset_scaler); 1169 1169 break; 1170 1170 ··· 1249 1249 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) 1250 1250 return 0; 1251 1251 1252 - client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); 1252 + client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); 1253 1253 if (client == 0) 1254 1254 return -ENOMEM; 1255 - memset(client, 0, sizeof(struct i2c_client)); 1256 1255 client->addr = address; 1257 1256 client->adapter = adapter; 1258 1257 client->driver = &i2c_driver_saa7115; 1259 1258 snprintf(client->name, sizeof(client->name) - 1, "saa7115"); 1260 1259 1261 - v4l_dbg(1, client, "detecting saa7115 client on address 0x%x\n", address << 1); 1260 + v4l_dbg(1, debug, client, "detecting saa7115 client on address 0x%x\n", address << 1); 1262 1261 1263 1262 saa7115_write(client, 0, 5); 1264 1263 chip_id = saa7115_read(client, 0) & 0x0f; 1265 1264 if (chip_id != 4 && chip_id != 5) { 1266 - v4l_dbg(1, client, "saa7115 not found\n"); 1265 + v4l_dbg(1, debug, client, "saa7115 not found\n"); 1267 1266 kfree(client); 1268 1267 return 0; 1269 1268 } ··· 1271 1272 } 1272 1273 v4l_info(client, "saa711%d found @ 0x%x (%s)\n", chip_id, address << 1, adapter->name); 1273 1274 1274 - state = kmalloc(sizeof(struct saa7115_state), GFP_KERNEL); 1275 + state = kzalloc(sizeof(struct saa7115_state), GFP_KERNEL); 1275 1276 i2c_set_clientdata(client, state); 1276 1277 if (state == NULL) { 1277 1278 kfree(client); 1278 1279 return -ENOMEM; 1279 1280 } 1280 - memset(state, 0, sizeof(struct saa7115_state)); 1281 1281 state->std = V4L2_STD_NTSC; 1282 1282 state->input = -1; 1283 1283 state->enable = 1; ··· 1288 1290 state->ident = (chip_id == 4) ? V4L2_IDENT_SAA7114 : V4L2_IDENT_SAA7115; 1289 1291 state->audclk_freq = 48000; 1290 1292 1291 - v4l_dbg(1, client, "writing init values\n"); 1293 + v4l_dbg(1, debug, client, "writing init values\n"); 1292 1294 1293 1295 /* init to 60hz/48khz */ 1294 1296 saa7115_writeregs(client, saa7115_init_auto_input); ··· 1301 1303 1302 1304 i2c_attach_client(client); 1303 1305 1304 - v4l_dbg(1, client, "status: (1E) 0x%02x, (1F) 0x%02x\n", 1306 + v4l_dbg(1, debug, client, "status: (1E) 0x%02x, (1F) 0x%02x\n", 1305 1307 saa7115_read(client, 0x1e), saa7115_read(client, 0x1f)); 1306 1308 1307 1309 return 0;
+2 -4
drivers/media/video/saa711x.c
··· 487 487 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) 488 488 return 0; 489 489 490 - client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); 490 + client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); 491 491 if (client == 0) 492 492 return -ENOMEM; 493 - memset(client, 0, sizeof(struct i2c_client)); 494 493 client->addr = address; 495 494 client->adapter = adapter; 496 495 client->driver = &i2c_driver_saa711x; 497 496 strlcpy(I2C_NAME(client), "saa711x", sizeof(I2C_NAME(client))); 498 - decoder = kmalloc(sizeof(struct saa711x), GFP_KERNEL); 497 + decoder = kzalloc(sizeof(struct saa711x), GFP_KERNEL); 499 498 if (decoder == NULL) { 500 499 kfree(client); 501 500 return -ENOMEM; 502 501 } 503 - memset(decoder, 0, sizeof(struct saa711x)); 504 502 decoder->norm = VIDEO_MODE_NTSC; 505 503 decoder->input = 0; 506 504 decoder->enable = 1;
+20 -22
drivers/media/video/saa7127.c
··· 338 338 if (enable && (data->field != 0 || data->line != 16)) 339 339 return -EINVAL; 340 340 if (state->vps_enable != enable) { 341 - v4l_dbg(1, client, "Turn VPS Signal %s\n", enable ? "on" : "off"); 341 + v4l_dbg(1, debug, client, "Turn VPS Signal %s\n", enable ? "on" : "off"); 342 342 saa7127_write(client, 0x54, enable << 7); 343 343 state->vps_enable = enable; 344 344 } ··· 350 350 state->vps_data[2] = data->data[11]; 351 351 state->vps_data[3] = data->data[12]; 352 352 state->vps_data[4] = data->data[13]; 353 - v4l_dbg(1, client, "Set VPS data %02x %02x %02x %02x %02x\n", 353 + v4l_dbg(1, debug, client, "Set VPS data %02x %02x %02x %02x %02x\n", 354 354 state->vps_data[0], state->vps_data[1], 355 355 state->vps_data[2], state->vps_data[3], 356 356 state->vps_data[4]); ··· 373 373 if (enable && (data->field != 0 || data->line != 21)) 374 374 return -EINVAL; 375 375 if (state->cc_enable != enable) { 376 - v4l_dbg(1, client, "Turn CC %s\n", enable ? "on" : "off"); 376 + v4l_dbg(1, debug, client, "Turn CC %s\n", enable ? "on" : "off"); 377 377 saa7127_write(client, SAA7127_REG_CLOSED_CAPTION, 378 378 (state->xds_enable << 7) | (enable << 6) | 0x11); 379 379 state->cc_enable = enable; ··· 381 381 if (!enable) 382 382 return 0; 383 383 384 - v4l_dbg(2, client, "CC data: %04x\n", cc); 384 + v4l_dbg(2, debug, client, "CC data: %04x\n", cc); 385 385 saa7127_write(client, SAA7127_REG_LINE_21_ODD_0, cc & 0xff); 386 386 saa7127_write(client, SAA7127_REG_LINE_21_ODD_1, cc >> 8); 387 387 state->cc_data = cc; ··· 399 399 if (enable && (data->field != 1 || data->line != 21)) 400 400 return -EINVAL; 401 401 if (state->xds_enable != enable) { 402 - v4l_dbg(1, client, "Turn XDS %s\n", enable ? "on" : "off"); 402 + v4l_dbg(1, debug, client, "Turn XDS %s\n", enable ? "on" : "off"); 403 403 saa7127_write(client, SAA7127_REG_CLOSED_CAPTION, 404 404 (enable << 7) | (state->cc_enable << 6) | 0x11); 405 405 state->xds_enable = enable; ··· 407 407 if (!enable) 408 408 return 0; 409 409 410 - v4l_dbg(2, client, "XDS data: %04x\n", xds); 410 + v4l_dbg(2, debug, client, "XDS data: %04x\n", xds); 411 411 saa7127_write(client, SAA7127_REG_LINE_21_EVEN_0, xds & 0xff); 412 412 saa7127_write(client, SAA7127_REG_LINE_21_EVEN_1, xds >> 8); 413 413 state->xds_data = xds; ··· 424 424 if (enable && (data->field != 0 || data->line != 23)) 425 425 return -EINVAL; 426 426 if (state->wss_enable != enable) { 427 - v4l_dbg(1, client, "Turn WSS %s\n", enable ? "on" : "off"); 427 + v4l_dbg(1, debug, client, "Turn WSS %s\n", enable ? "on" : "off"); 428 428 saa7127_write(client, 0x27, enable << 7); 429 429 state->wss_enable = enable; 430 430 } ··· 433 433 434 434 saa7127_write(client, 0x26, data->data[0]); 435 435 saa7127_write(client, 0x27, 0x80 | (data->data[1] & 0x3f)); 436 - v4l_dbg(1, client, "WSS mode: %s\n", wss_strs[data->data[0] & 0xf]); 436 + v4l_dbg(1, debug, client, "WSS mode: %s\n", wss_strs[data->data[0] & 0xf]); 437 437 state->wss_mode = (data->data[1] & 0x3f) << 8 | data->data[0]; 438 438 return 0; 439 439 } ··· 445 445 struct saa7127_state *state = i2c_get_clientdata(client); 446 446 447 447 if (enable) { 448 - v4l_dbg(1, client, "Enable Video Output\n"); 448 + v4l_dbg(1, debug, client, "Enable Video Output\n"); 449 449 saa7127_write(client, 0x2d, state->reg_2d); 450 450 saa7127_write(client, 0x61, state->reg_61); 451 451 } else { 452 - v4l_dbg(1, client, "Disable Video Output\n"); 452 + v4l_dbg(1, debug, client, "Disable Video Output\n"); 453 453 saa7127_write(client, 0x2d, (state->reg_2d & 0xf0)); 454 454 saa7127_write(client, 0x61, (state->reg_61 | 0xc0)); 455 455 } ··· 465 465 const struct i2c_reg_value *inittab; 466 466 467 467 if (std & V4L2_STD_525_60) { 468 - v4l_dbg(1, client, "Selecting 60 Hz video Standard\n"); 468 + v4l_dbg(1, debug, client, "Selecting 60 Hz video Standard\n"); 469 469 inittab = saa7127_init_config_60hz; 470 470 state->reg_61 = SAA7127_60HZ_DAC_CONTROL; 471 471 } else { 472 - v4l_dbg(1, client, "Selecting 50 Hz video Standard\n"); 472 + v4l_dbg(1, debug, client, "Selecting 50 Hz video Standard\n"); 473 473 inittab = saa7127_init_config_50hz; 474 474 state->reg_61 = SAA7127_50HZ_DAC_CONTROL; 475 475 } ··· 520 520 default: 521 521 return -EINVAL; 522 522 } 523 - v4l_dbg(1, client, "Selecting %s output type\n", output_strs[output]); 523 + v4l_dbg(1, debug, client, "Selecting %s output type\n", output_strs[output]); 524 524 525 525 /* Configure Encoder */ 526 526 saa7127_write(client, 0x2d, state->reg_2d); ··· 537 537 538 538 switch (input) { 539 539 case SAA7127_INPUT_TYPE_NORMAL: /* avia */ 540 - v4l_dbg(1, client, "Selecting Normal Encoder Input\n"); 540 + v4l_dbg(1, debug, client, "Selecting Normal Encoder Input\n"); 541 541 state->reg_3a_cb = 0; 542 542 break; 543 543 544 544 case SAA7127_INPUT_TYPE_TEST_IMAGE: /* color bar */ 545 - v4l_dbg(1, client, "Selecting Color Bar generator\n"); 545 + v4l_dbg(1, debug, client, "Selecting Color Bar generator\n"); 546 546 state->reg_3a_cb = 0x80; 547 547 break; 548 548 ··· 689 689 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) 690 690 return 0; 691 691 692 - client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); 692 + client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); 693 693 if (client == 0) 694 694 return -ENOMEM; 695 695 696 - memset(client, 0, sizeof(struct i2c_client)); 697 696 client->addr = address; 698 697 client->adapter = adapter; 699 698 client->driver = &i2c_driver_saa7127; 700 699 snprintf(client->name, sizeof(client->name) - 1, "saa7127"); 701 700 702 - v4l_dbg(1, client, "detecting saa7127 client on address 0x%x\n", address << 1); 701 + v4l_dbg(1, debug, client, "detecting saa7127 client on address 0x%x\n", address << 1); 703 702 704 703 /* First test register 0: Bits 5-7 are a version ID (should be 0), 705 704 and bit 2 should also be 0. ··· 707 708 0x1d after a reset and not expected to ever change. */ 708 709 if ((saa7127_read(client, 0) & 0xe4) != 0 || 709 710 (saa7127_read(client, 0x29) & 0x3f) != 0x1d) { 710 - v4l_dbg(1, client, "saa7127 not found\n"); 711 + v4l_dbg(1, debug, client, "saa7127 not found\n"); 711 712 kfree(client); 712 713 return 0; 713 714 } 714 - state = kmalloc(sizeof(struct saa7127_state), GFP_KERNEL); 715 + state = kzalloc(sizeof(struct saa7127_state), GFP_KERNEL); 715 716 716 717 if (state == NULL) { 717 718 kfree(client); ··· 719 720 } 720 721 721 722 i2c_set_clientdata(client, state); 722 - memset(state, 0, sizeof(struct saa7127_state)); 723 723 724 724 /* Configure Encoder */ 725 725 726 - v4l_dbg(1, client, "Configuring encoder\n"); 726 + v4l_dbg(1, debug, client, "Configuring encoder\n"); 727 727 saa7127_write_inittab(client, saa7127_init_config_common); 728 728 saa7127_set_std(client, V4L2_STD_NTSC); 729 729 saa7127_set_output_type(client, SAA7127_OUTPUT_TYPE_BOTH);
+1 -1
drivers/media/video/saa7134/Kconfig
··· 15 15 config VIDEO_SAA7134_ALSA 16 16 tristate "Philips SAA7134 DMA audio support" 17 17 depends on VIDEO_SAA7134 && SND 18 - select SND_PCM_OSS 18 + select SND_PCM 19 19 ---help--- 20 20 This is a video4linux driver for direct (DMA) audio in 21 21 Philips SAA713x based TV cards using ALSA
+1 -2
drivers/media/video/saa7134/saa6752hs.c
··· 511 511 struct saa6752hs_state *h; 512 512 513 513 514 - if (NULL == (h = kmalloc(sizeof(*h), GFP_KERNEL))) 514 + if (NULL == (h = kzalloc(sizeof(*h), GFP_KERNEL))) 515 515 return -ENOMEM; 516 - memset(h,0,sizeof(*h)); 517 516 h->client = client_template; 518 517 h->params = param_defaults; 519 518 h->client.adapter = adap;
+1 -1
drivers/media/video/saa7134/saa7134-cards.c
··· 1666 1666 .radio_type = UNSET, 1667 1667 .tuner_addr = ADDR_UNSET, 1668 1668 .radio_addr = ADDR_UNSET, 1669 - .tda9887_conf = TDA9887_PRESENT | TDA9887_INTERCARRIER, 1669 + .tda9887_conf = TDA9887_PRESENT | TDA9887_INTERCARRIER | TDA9887_PORT2_ACTIVE, 1670 1670 .mpeg = SAA7134_MPEG_DVB, 1671 1671 .inputs = {{ 1672 1672 .name = name_tv,
+1 -2
drivers/media/video/saa7134/saa7134-core.c
··· 803 803 struct saa7134_mpeg_ops *mops; 804 804 int err; 805 805 806 - dev = kmalloc(sizeof(*dev),GFP_KERNEL); 806 + dev = kzalloc(sizeof(*dev),GFP_KERNEL); 807 807 if (NULL == dev) 808 808 return -ENOMEM; 809 - memset(dev,0,sizeof(*dev)); 810 809 811 810 /* pci init */ 812 811 dev->pci = pci_dev;
+1 -2
drivers/media/video/saa7134/saa7134-video.c
··· 1264 1264 v4l2_type_names[type]); 1265 1265 1266 1266 /* allocate + initialize per filehandle data */ 1267 - fh = kmalloc(sizeof(*fh),GFP_KERNEL); 1267 + fh = kzalloc(sizeof(*fh),GFP_KERNEL); 1268 1268 if (NULL == fh) 1269 1269 return -ENOMEM; 1270 - memset(fh,0,sizeof(*fh)); 1271 1270 file->private_data = fh; 1272 1271 fh->dev = dev; 1273 1272 fh->radio = radio;
-1
drivers/media/video/saa7146.h
··· 73 73 unsigned int nr; 74 74 unsigned long irq; /* IRQ used by SAA7146 card */ 75 75 unsigned short id; 76 - struct pci_dev *dev; 77 76 unsigned char revision; 78 77 unsigned char boardcfg[64]; /* 64 bytes of config from eeprom */ 79 78 unsigned long saa7146_adr; /* bus address of IO mem from PCI BIOS */
+2 -4
drivers/media/video/saa7185.c
··· 408 408 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) 409 409 return 0; 410 410 411 - client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); 411 + client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); 412 412 if (client == 0) 413 413 return -ENOMEM; 414 - memset(client, 0, sizeof(struct i2c_client)); 415 414 client->addr = address; 416 415 client->adapter = adapter; 417 416 client->driver = &i2c_driver_saa7185; 418 417 strlcpy(I2C_NAME(client), "saa7185", sizeof(I2C_NAME(client))); 419 418 420 - encoder = kmalloc(sizeof(struct saa7185), GFP_KERNEL); 419 + encoder = kzalloc(sizeof(struct saa7185), GFP_KERNEL); 421 420 if (encoder == NULL) { 422 421 kfree(client); 423 422 return -ENOMEM; 424 423 } 425 - memset(encoder, 0, sizeof(struct saa7185)); 426 424 encoder->norm = VIDEO_MODE_NTSC; 427 425 encoder->enable = 1; 428 426 i2c_set_clientdata(client, encoder);
+2 -5
drivers/media/video/saa7191.c
··· 571 571 printk(KERN_INFO "Philips SAA7191 driver version %s\n", 572 572 SAA7191_MODULE_VERSION); 573 573 574 - client = kmalloc(sizeof(*client), GFP_KERNEL); 574 + client = kzalloc(sizeof(*client), GFP_KERNEL); 575 575 if (!client) 576 576 return -ENOMEM; 577 - decoder = kmalloc(sizeof(*decoder), GFP_KERNEL); 577 + decoder = kzalloc(sizeof(*decoder), GFP_KERNEL); 578 578 if (!decoder) { 579 579 err = -ENOMEM; 580 580 goto out_free_client; 581 581 } 582 - 583 - memset(client, 0, sizeof(struct i2c_client)); 584 - memset(decoder, 0, sizeof(struct saa7191)); 585 582 586 583 client->addr = addr; 587 584 client->adapter = adap;
+558 -588
drivers/media/video/stradis.c
··· 49 49 #include "saa7121.h" 50 50 #include "cs8420.h" 51 51 52 - #define DEBUG(x) /* debug driver */ 53 - #undef IDEBUG /* debug irq handler */ 54 - #undef MDEBUG /* debug memory management */ 52 + #define DEBUG(x) /* debug driver */ 53 + #undef IDEBUG /* debug irq handler */ 54 + #undef MDEBUG /* debug memory management */ 55 55 56 56 #define SAA7146_MAX 6 57 57 ··· 62 62 static int video_nr = -1; 63 63 module_param(video_nr, int, 0); 64 64 MODULE_LICENSE("GPL"); 65 - 66 65 67 66 #define nDebNormal 0x00480000 68 67 #define nDebNoInc 0x00480000 ··· 98 99 99 100 #ifdef USE_RESCUE_EEPROM_SDM275 100 101 static unsigned char rescue_eeprom[64] = { 101 - 0x00,0x01,0x04,0x13,0x26,0x0f,0x10,0x00,0x00,0x00,0x43,0x63,0x22,0x01,0x29,0x15,0x73,0x00,0x1f, 'd', 'e', 'c', 'x', 'l', 'd', 'v', 'a',0x02,0x00,0x01,0x00,0xcc,0xa4,0x63,0x09,0xe2,0x10,0x00,0x0a,0x00,0x02,0x02, 'd', 'e', 'c', 'x', 'l', 'a',0x00,0x00,0x42,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 102 + 0x00, 0x01, 0x04, 0x13, 0x26, 0x0f, 0x10, 0x00, 0x00, 0x00, 0x43, 0x63, 103 + 0x22, 0x01, 0x29, 0x15, 0x73, 0x00, 0x1f, 'd', 'e', 'c', 'x', 'l', 104 + 'd', 'v', 'a', 0x02, 0x00, 0x01, 0x00, 0xcc, 0xa4, 0x63, 0x09, 0xe2, 105 + 0x10, 0x00, 0x0a, 0x00, 0x02, 0x02, 'd', 'e', 'c', 'x', 'l', 'a', 106 + 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 107 + 0x00, 0x00, 0x00, 0x00, 102 108 }; 103 109 #endif 104 110 ··· 144 140 145 141 if (saaread(SAA7146_I2C_STATUS) & 0x3c) 146 142 I2CWipe(saa); 147 - for (i = 0; i < 1000 && 148 - (saaread(SAA7146_I2C_STATUS) & SAA7146_I2C_BUSY); i++) 143 + for (i = 0; 144 + i < 1000 && (saaread(SAA7146_I2C_STATUS) & SAA7146_I2C_BUSY); 145 + i++) 149 146 schedule(); 150 147 if (i == 1000) 151 148 I2CWipe(saa); 152 149 if (dosub) 153 150 saawrite(((addr & 0xfe) << 24) | (((addr | 1) & 0xff) << 8) | 154 - ((subaddr & 0xff) << 16) | 0xed, SAA7146_I2C_TRANSFER); 151 + ((subaddr & 0xff) << 16) | 0xed, SAA7146_I2C_TRANSFER); 155 152 else 156 153 saawrite(((addr & 0xfe) << 24) | (((addr | 1) & 0xff) << 16) | 157 - 0xf1, SAA7146_I2C_TRANSFER); 154 + 0xf1, SAA7146_I2C_TRANSFER); 158 155 saawrite((SAA7146_MC2_UPLD_I2C << 16) | 159 156 SAA7146_MC2_UPLD_I2C, SAA7146_MC2); 160 157 /* wait for i2c registers to be programmed */ ··· 168 163 schedule(); 169 164 if (saaread(SAA7146_I2C_STATUS) & SAA7146_I2C_ERR) 170 165 return -1; 171 - if (i == 1000) 166 + if (i == 1000) 172 167 printk("i2c setup read timeout\n"); 173 168 saawrite(0x41, SAA7146_I2C_TRANSFER); 174 169 saawrite((SAA7146_MC2_UPLD_I2C << 16) | ··· 183 178 schedule(); 184 179 if (saaread(SAA7146_I2C_TRANSFER) & SAA7146_I2C_ERR) 185 180 return -1; 186 - if (i == 1000) 181 + if (i == 1000) 187 182 printk("i2c read timeout\n"); 188 183 return ((saaread(SAA7146_I2C_TRANSFER) >> 24) & 0xff); 189 184 } ··· 218 213 { 219 214 int i; 220 215 221 - DEBUG(printk(KERN_DEBUG "stradis%d: i2c: device found=%02x\n", saa->nr, id)); 222 - if (id == 0xa0) { /* we have rev2 or later board, fill in info */ 216 + DEBUG(printk(KERN_DEBUG "stradis%d: i2c: device found=%02x\n", saa->nr, 217 + id)); 218 + if (id == 0xa0) { /* we have rev2 or later board, fill in info */ 223 219 for (i = 0; i < 64; i++) 224 220 saa->boardcfg[i] = I2CRead(saa, 0xa0, i, 1); 225 221 #ifdef USE_RESCUE_EEPROM_SDM275 226 222 if (saa->boardcfg[0] != 0) { 227 - printk("stradis%d: WARNING: EEPROM STORED VALUES HAVE BEEN IGNORED\n", saa->nr); 223 + printk("stradis%d: WARNING: EEPROM STORED VALUES HAVE " 224 + "BEEN IGNORED\n", saa->nr); 228 225 for (i = 0; i < 64; i++) 229 226 saa->boardcfg[i] = rescue_eeprom[i]; 230 227 } 231 228 #endif 232 229 printk("stradis%d: config =", saa->nr); 233 230 for (i = 0; i < 51; i++) { 234 - printk(" %02x",saa->boardcfg[i]); 231 + printk(" %02x", saa->boardcfg[i]); 235 232 } 236 233 printk("\n"); 237 234 } ··· 261 254 for (i = 0; i < 500000 && 262 255 (saaread(SAA7146_PSR) & SAA7146_PSR_DEBI_S); i++) 263 256 saaread(SAA7146_MC2); 257 + 264 258 if (i > debiwait_maxwait) 265 259 printk("wait-for-debi-done maxwait: %d\n", 266 260 debiwait_maxwait = i); 267 - 261 + 268 262 if (i == 500000) 269 263 return -1; 264 + 270 265 return 0; 271 266 } 272 267 273 268 static int debiwrite(struct saa7146 *saa, u32 config, int addr, 274 - u32 val, int count) 269 + u32 val, int count) 275 270 { 276 271 u32 cmd; 277 272 if (count <= 0 || count > 32764) ··· 318 309 return result; 319 310 } 320 311 321 - #if 0 /* unused */ 322 - /* MUST be a multiple of 8 bytes and 8-byte aligned and < 32768 bytes */ 323 - /* data copied into saa->dmadebi buffer, caller must re-enable interrupts */ 324 - static void ibm_block_dram_read(struct saa7146 *saa, int address, int bytes) 325 - { 326 - int i, j; 327 - u32 *buf; 328 - buf = (u32 *) saa->dmadebi; 329 - if (bytes > 0x7000) 330 - bytes = 0x7000; 331 - saawrite(0, SAA7146_IER); /* disable interrupts */ 332 - for (i=0; i < 10000 && 333 - (debiread(saa, debNormal, IBM_MP2_DRAM_CMD_STAT, 2) 334 - & 0x8000); i++) 335 - saaread(SAA7146_MC2); 336 - if (i == 10000) 337 - printk(KERN_ERR "stradis%d: dram_busy never cleared\n", 338 - saa->nr); 339 - debiwrite(saa, debNormal, IBM_MP2_SRC_ADDR, (address<<16) | 340 - (address>>16), 4); 341 - debiwrite(saa, debNormal, IBM_MP2_BLOCK_SIZE, bytes, 2); 342 - debiwrite(saa, debNormal, IBM_MP2_CMD_STAT, 0x8a10, 2); 343 - for (j = 0; j < bytes/4; j++) { 344 - for (i = 0; i < 10000 && 345 - (!(debiread(saa, debNormal, IBM_MP2_DRAM_CMD_STAT, 2) 346 - & 0x4000)); i++) 347 - saaread(SAA7146_MC2); 348 - if (i == 10000) 349 - printk(KERN_ERR "stradis%d: dram_ready never set\n", 350 - saa->nr); 351 - buf[j] = debiread(saa, debNormal, IBM_MP2_DRAM_DATA, 4); 352 - } 353 - } 354 - #endif /* unused */ 355 - 356 312 static void do_irq_send_data(struct saa7146 *saa) 357 313 { 358 314 int split, audbytes, vidbytes; ··· 339 365 return; 340 366 } 341 367 /* if at least 1 block audio waiting and audio fifo isn't full */ 342 - if (audbytes >= 2048 && (debiread(saa, debNormal, 343 - IBM_MP2_AUD_FIFO, 2) & 0xff) < 60) { 368 + if (audbytes >= 2048 && (debiread(saa, debNormal, IBM_MP2_AUD_FIFO, 2) 369 + & 0xff) < 60) { 344 370 if (saa->audhead > saa->audtail) 345 371 split = 65536 - saa->audhead; 346 372 else 347 373 split = 0; 348 374 audbytes = 2048; 349 375 if (split > 0 && split < 2048) { 350 - memcpy(saa->dmadebi, saa->audbuf + saa->audhead, 351 - split); 376 + memcpy(saa->dmadebi, saa->audbuf + saa->audhead, split); 352 377 saa->audhead = 0; 353 378 audbytes -= split; 354 379 } else ··· 356 383 audbytes); 357 384 saa->audhead += audbytes; 358 385 saa->audhead &= 0xffff; 359 - debiwrite(saa, debAudio, (NewCard? IBM_MP2_AUD_FIFO : 360 - IBM_MP2_AUD_FIFOW), 0, 2048); 386 + debiwrite(saa, debAudio, (NewCard ? IBM_MP2_AUD_FIFO : 387 + IBM_MP2_AUD_FIFOW), 0, 2048); 361 388 wake_up_interruptible(&saa->audq); 362 - /* if at least 1 block video waiting and video fifo isn't full */ 389 + /* if at least 1 block video waiting and video fifo isn't full */ 363 390 } else if (vidbytes >= 30720 && (debiread(saa, debNormal, 364 - IBM_MP2_FIFO, 2)) < 16384) { 391 + IBM_MP2_FIFO, 2)) < 16384) { 365 392 if (saa->vidhead > saa->vidtail) 366 393 split = 524288 - saa->vidhead; 367 394 else 368 395 split = 0; 369 396 vidbytes = 30720; 370 397 if (split > 0 && split < 30720) { 371 - memcpy(saa->dmadebi, saa->vidbuf + saa->vidhead, 372 - split); 398 + memcpy(saa->dmadebi, saa->vidbuf + saa->vidhead, split); 373 399 saa->vidhead = 0; 374 400 vidbytes -= split; 375 401 } else ··· 378 406 saa->vidhead += vidbytes; 379 407 saa->vidhead &= 0x7ffff; 380 408 debiwrite(saa, debVideo, (NewCard ? IBM_MP2_FIFO : 381 - IBM_MP2_FIFOW), 0, 30720); 409 + IBM_MP2_FIFOW), 0, 30720); 382 410 wake_up_interruptible(&saa->vidq); 383 411 } 384 412 saawrite(SAA7146_PSR_DEBI_S | SAA7146_PSR_PIN1, SAA7146_IER); ··· 390 418 if (size > 30720) 391 419 size = 30720; 392 420 /* ensure some multiple of 8 bytes is transferred */ 393 - size = 8 * ((size + 8)>>3); 421 + size = 8 * ((size + 8) >> 3); 394 422 if (size) { 395 423 debiwrite(saa, debNormal, IBM_MP2_OSD_ADDR, 396 - (saa->osdhead>>3), 2); 424 + (saa->osdhead >> 3), 2); 397 425 memcpy(saa->dmadebi, &saa->osdbuf[saa->osdhead], size); 398 426 saa->osdhead += size; 399 427 /* block transfer of next 8 bytes to ~32k bytes */ ··· 407 435 408 436 static irqreturn_t saa7146_irq(int irq, void *dev_id, struct pt_regs *regs) 409 437 { 410 - struct saa7146 *saa = (struct saa7146 *) dev_id; 438 + struct saa7146 *saa = dev_id; 411 439 u32 stat, astat; 412 440 int count; 413 441 int handled = 0; ··· 456 484 saa->vidinfo.v_size = 480; 457 485 #if 0 458 486 if (saa->endmarkhead != saa->endmarktail) { 459 - saa->audhead = 487 + saa->audhead = 460 488 saa->endmark[saa->endmarkhead]; 461 489 saa->endmarkhead++; 462 490 if (saa->endmarkhead >= MAX_MARKS) ··· 466 494 } 467 495 if (istat & 0x4000) { /* Sequence Error Code */ 468 496 if (saa->endmarkhead != saa->endmarktail) { 469 - saa->audhead = 497 + saa->audhead = 470 498 saa->endmark[saa->endmarkhead]; 471 499 saa->endmarkhead++; 472 500 if (saa->endmarkhead >= MAX_MARKS) ··· 585 613 int i; 586 614 587 615 if (chain) 588 - debiwrite(saa, debNormal, IBM_MP2_COMMAND, (command << 1) | 1, 2); 616 + debiwrite(saa, debNormal, IBM_MP2_COMMAND, (command << 1)| 1,2); 589 617 else 590 618 debiwrite(saa, debNormal, IBM_MP2_COMMAND, command << 1, 2); 591 619 debiwrite(saa, debNormal, IBM_MP2_CMD_DATA, data, 2); ··· 635 663 else 636 664 sequence = mode8420con; 637 665 for (i = 0; i < INIT8420LEN; i++) 638 - I2CWrite(saa, 0x20, init8420[i * 2], 639 - init8420[i * 2 + 1], 2); 666 + I2CWrite(saa, 0x20, init8420[i * 2], init8420[i * 2 + 1], 2); 640 667 for (i = 0; i < MODE8420LEN; i++) 641 - I2CWrite(saa, 0x20, sequence[i * 2], 642 - sequence[i * 2 + 1], 2); 668 + I2CWrite(saa, 0x20, sequence[i * 2], sequence[i * 2 + 1], 2); 643 669 printk("stradis%d: CS8420 initialized\n", saa->nr); 644 670 } 645 671 ··· 653 683 /* initialize PAL/NTSC video encoder */ 654 684 for (i = 0; i < INIT7121LEN; i++) { 655 685 if (NewCard) { /* handle new card encoder differences */ 656 - if (sequence[i*2] == 0x3a) 686 + if (sequence[i * 2] == 0x3a) 657 687 I2CWrite(saa, 0x88, 0x3a, 0x13, 2); 658 - else if (sequence[i*2] == 0x6b) 688 + else if (sequence[i * 2] == 0x6b) 659 689 I2CWrite(saa, 0x88, 0x6b, 0x20, 2); 660 - else if (sequence[i*2] == 0x6c) 690 + else if (sequence[i * 2] == 0x6c) 661 691 I2CWrite(saa, 0x88, 0x6c, 662 692 dopal ? 0x09 : 0xf5, 2); 663 - else if (sequence[i*2] == 0x6d) 693 + else if (sequence[i * 2] == 0x6d) 664 694 I2CWrite(saa, 0x88, 0x6d, 665 695 dopal ? 0x20 : 0x00, 2); 666 - else if (sequence[i*2] == 0x7a) 696 + else if (sequence[i * 2] == 0x7a) 667 697 I2CWrite(saa, 0x88, 0x7a, 668 698 dopal ? (PALFirstActive - 1) : 669 699 (NTSCFirstActive - 4), 2); 670 - else if (sequence[i*2] == 0x7b) 700 + else if (sequence[i * 2] == 0x7b) 671 701 I2CWrite(saa, 0x88, 0x7b, 672 702 dopal ? PALLastActive : 673 703 NTSCLastActive, 2); 674 - else I2CWrite(saa, 0x88, sequence[i * 2], 675 - sequence[i * 2 + 1], 2); 704 + else 705 + I2CWrite(saa, 0x88, sequence[i * 2], 706 + sequence[i * 2 + 1], 2); 676 707 } else { 677 - if (sequence[i*2] == 0x6b && mod) 678 - I2CWrite(saa, 0x88, 0x6b, 679 - (sequence[i * 2 + 1] ^ 0x09), 2); 680 - else if (sequence[i*2] == 0x7a) 708 + if (sequence[i * 2] == 0x6b && mod) 709 + I2CWrite(saa, 0x88, 0x6b, 710 + (sequence[i * 2 + 1] ^ 0x09), 2); 711 + else if (sequence[i * 2] == 0x7a) 681 712 I2CWrite(saa, 0x88, 0x7a, 682 713 dopal ? (PALFirstActive - 1) : 683 714 (NTSCFirstActive - 4), 2); 684 - else if (sequence[i*2] == 0x7b) 715 + else if (sequence[i * 2] == 0x7b) 685 716 I2CWrite(saa, 0x88, 0x7b, 686 717 dopal ? PALLastActive : 687 718 NTSCLastActive, 2); ··· 706 735 nCode = noffset + 0x100; 707 736 if (nCode == 1) 708 737 nCode = 0x401; 709 - else if (nCode < 1) nCode = 0x400 + PixelsPerLine + nCode; 738 + else if (nCode < 1) 739 + nCode = 0x400 + PixelsPerLine + nCode; 710 740 debiwrite(saa, debNormal, XILINX_GLDELAY, nCode, 2); 711 741 } 712 742 ··· 717 745 saa->boardcfg[2] = mode; 718 746 /* do not adjust analog video parameters here, use saa7121 init */ 719 747 /* you will affect the SDI output on the new card */ 720 - if (mode == VIDEO_MODE_PAL) { /* PAL */ 748 + if (mode == VIDEO_MODE_PAL) { /* PAL */ 721 749 debiwrite(saa, debNormal, XILINX_CTL0, 0x0808, 2); 722 750 mdelay(50); 723 751 saawrite(0x012002c0, SAA7146_NUM_LINE_BYTE1); 724 752 if (NewCard) { 725 - debiwrite(saa, debNormal, IBM_MP2_DISP_MODE, 726 - 0xe100, 2); 753 + debiwrite(saa, debNormal, IBM_MP2_DISP_MODE, 0xe100, 2); 727 754 mdelay(50); 728 755 } 729 756 debiwrite(saa, debNormal, IBM_MP2_DISP_MODE, 730 - NewCard ? 0xe500: 0x6500, 2); 757 + NewCard ? 0xe500 : 0x6500, 2); 731 758 debiwrite(saa, debNormal, IBM_MP2_DISP_DLY, 732 759 (1 << 8) | 733 - (NewCard ? PALFirstActive : PALFirstActive-6), 2); 760 + (NewCard ? PALFirstActive : PALFirstActive - 6), 2); 734 761 } else { /* NTSC */ 735 762 debiwrite(saa, debNormal, XILINX_CTL0, 0x0800, 2); 736 763 mdelay(50); 737 764 saawrite(0x00f002c0, SAA7146_NUM_LINE_BYTE1); 738 765 debiwrite(saa, debNormal, IBM_MP2_DISP_MODE, 739 - NewCard ? 0xe100: 0x6100, 2); 766 + NewCard ? 0xe100 : 0x6100, 2); 740 767 debiwrite(saa, debNormal, IBM_MP2_DISP_DLY, 741 768 (1 << 8) | 742 - (NewCard ? NTSCFirstActive : NTSCFirstActive-6), 2); 769 + (NewCard ? NTSCFirstActive : NTSCFirstActive - 6), 2); 743 770 } 744 771 } 745 - 746 772 747 773 /* Intialize bitmangler to map from a byte value to the mangled word that 748 774 * must be output to program the Xilinx part through the DEBI port. ··· 769 799 for (num = 0; num < saa_num; num++) { 770 800 saa = &saa7146s[num]; 771 801 if (saa->boardcfg[0] > 20) 772 - continue; /* card was programmed */ 802 + continue; /* card was programmed */ 773 803 loadtwo = (saa->boardcfg[18] & 0x10); 774 804 if (!NewCard) /* we have an old board */ 775 805 for (i = 0; i < 256; i++) 776 - bitmangler[i] = ((i & 0x01) << 15) | 777 - ((i & 0x02) << 6) | ((i & 0x04) << 4) | 778 - ((i & 0x08) << 9) | ((i & 0x10) << 7) | 779 - ((i & 0x20) >> 3) | ((i & 0x40) >> 5) | 780 - ((i & 0x80) >> 7); 781 - else /* else we have a new board */ 806 + bitmangler[i] = ((i & 0x01) << 15) | 807 + ((i & 0x02) << 6) | ((i & 0x04) << 4) | 808 + ((i & 0x08) << 9) | ((i & 0x10) << 7) | 809 + ((i & 0x20) >> 3) | ((i & 0x40) >> 5) | 810 + ((i & 0x80) >> 7); 811 + else /* else we have a new board */ 782 812 for (i = 0; i < 256; i++) 783 - bitmangler[i] = ((i & 0x01) << 7) | 784 - ((i & 0x02) << 5) | ((i & 0x04) << 3) | 785 - ((i & 0x08) << 1) | ((i & 0x10) >> 1) | 786 - ((i & 0x20) >> 3) | ((i & 0x40) >> 5) | 787 - ((i & 0x80) >> 7); 813 + bitmangler[i] = ((i & 0x01) << 7) | 814 + ((i & 0x02) << 5) | ((i & 0x04) << 3) | 815 + ((i & 0x08) << 1) | ((i & 0x10) >> 1) | 816 + ((i & 0x20) >> 3) | ((i & 0x40) >> 5) | 817 + ((i & 0x80) >> 7); 788 818 789 819 dmabuf = (u16 *) saa->dmadebi; 790 820 newdma = (u8 *) saa->dmadebi; 791 821 if (NewCard) { /* SDM2xxx */ 792 822 if (!strncmp(bitdata->loadwhat, "decoder2", 8)) 793 823 continue; /* fpga not for this card */ 794 - if (!strncmp(&saa->boardcfg[42], 795 - bitdata->loadwhat, 8)) { 824 + if (!strncmp(&saa->boardcfg[42], bitdata->loadwhat, 8)) 796 825 loadfile = 1; 797 - } else if (loadtwo && !strncmp(&saa->boardcfg[19], 798 - bitdata->loadwhat, 8)) { 826 + else if (loadtwo && !strncmp(&saa->boardcfg[19], 827 + bitdata->loadwhat, 8)) 799 828 loadfile = 2; 800 - } else if (!saa->boardcfg[42] && /* special */ 801 - !strncmp("decxl", bitdata->loadwhat, 8)) { 802 - loadfile = 1; 803 - } else 829 + else if (!saa->boardcfg[42] && !strncmp("decxl", 830 + bitdata->loadwhat, 8)) 831 + loadfile = 1; /* special */ 832 + else 804 833 continue; /* fpga not for this card */ 805 - if (loadfile != 1 && loadfile != 2) { 834 + if (loadfile != 1 && loadfile != 2) 806 835 continue; /* skip to next card */ 807 - } 808 - if (saa->boardcfg[0] && loadfile == 1 ) 836 + if (saa->boardcfg[0] && loadfile == 1) 809 837 continue; /* skip to next card */ 810 838 if (saa->boardcfg[0] != 1 && loadfile == 2) 811 839 continue; /* skip to next card */ ··· 838 870 /* Release Xilinx INIT signal (WS2) */ 839 871 saawrite(0x00000000, SAA7146_GPIO_CTRL); 840 872 /* Wait for the INIT to go High */ 841 - for (i = 0; i < 10000 && 842 - !(saaread(SAA7146_PSR) & SAA7146_PSR_PIN2); i++) 873 + for (i = 0; 874 + i < 10000 && !(saaread(SAA7146_PSR) & SAA7146_PSR_PIN2); 875 + i++) 843 876 schedule(); 844 877 if (i == 1000) { 845 878 printk(KERN_INFO "stradis%d: no fpga INIT\n", saa->nr); ··· 850 881 if (NewCard) { 851 882 for (i = startindex; i < bitdata->datasize; i++) 852 883 newdma[i - startindex] = 853 - bitmangler[bitdata->data[i]]; 884 + bitmangler[bitdata->data[i]]; 854 885 debiwrite(saa, 0x01420000, 0, 0, 855 886 ((bitdata->datasize - startindex) + 5)); 856 - if (loadtwo) { 857 - if (loadfile == 1) { 858 - printk("stradis%d: " 859 - "awaiting 2nd FPGA bitfile\n", 860 - saa->nr); 861 - continue; /* skip to next card */ 862 - } 863 - 887 + if (loadtwo && loadfile == 1) { 888 + printk("stradis%d: awaiting 2nd FPGA bitfile\n", 889 + saa->nr); 890 + continue; /* skip to next card */ 864 891 } 865 892 } else { 866 893 for (i = startindex; i < bitdata->datasize; i++) ··· 865 900 debiwrite(saa, 0x014a0000, 0, 0, 866 901 ((bitdata->datasize - startindex) + 5) * 2); 867 902 } 868 - for (i = 0; i < 1000 && 869 - !(saaread(SAA7146_PSR) & SAA7146_PSR_PIN2); i++) 903 + for (i = 0; 904 + i < 1000 && !(saaread(SAA7146_PSR) & SAA7146_PSR_PIN2); 905 + i++) 870 906 schedule(); 871 907 if (i == 1000) { 872 908 printk(KERN_INFO "stradis%d: FPGA load failed\n", ··· 891 925 /* mute CS3310 */ 892 926 if (HaveCS3310) 893 927 debiwrite(saa, debNormal, XILINX_CS3310_CMPLT, 894 - 0, 2); 928 + 0, 2); 895 929 /* set VXCO to PWM mode, release reset, blank on */ 896 930 debiwrite(saa, debNormal, XILINX_CTL0, 0xffc4, 2); 897 931 mdelay(10); 898 932 /* unmute CS3310 */ 899 933 if (HaveCS3310) 900 934 debiwrite(saa, debNormal, XILINX_CTL0, 901 - 0x2020, 2); 935 + 0x2020, 2); 902 936 } 903 937 /* set source Black */ 904 938 debiwrite(saa, debNormal, XILINX_CTL0, 0x1707, 2); ··· 924 958 /* we must init CS8420 first since rev b pulls i2s */ 925 959 /* master clock low and CS4341 needs i2s master to */ 926 960 /* run the i2c port. */ 927 - if (HaveCS8420) { 961 + if (HaveCS8420) 928 962 /* 0=consumer, 1=pro */ 929 963 initialize_cs8420(saa, 0); 930 - } 964 + 931 965 mdelay(5); 932 966 if (HaveCS4341) 933 967 initialize_cs4341(saa); ··· 947 981 debiwrite(saa, debNormal, XILINX_CTL0, 0x8080, 2); 948 982 #endif 949 983 } 984 + 950 985 return failure; 951 986 } 952 987 ··· 988 1021 /* we must init CS8420 first since rev b pulls i2s */ 989 1022 /* master clock low and CS4341 needs i2s master to */ 990 1023 /* run the i2c port. */ 991 - if (HaveCS8420) { 1024 + if (HaveCS8420) 992 1025 /* 0=consumer, 1=pro */ 993 1026 initialize_cs8420(saa, 1); 994 - } 1027 + 995 1028 mdelay(5); 996 1029 if (HaveCS4341) 997 1030 initialize_cs4341(saa); ··· 1006 1039 debiwrite(saa, debNormal, IBM_MP2_OSD_SIZE, 0x2000, 2); 1007 1040 debiwrite(saa, debNormal, IBM_MP2_AUD_CTL, 0x4552, 2); 1008 1041 if (ibm_send_command(saa, IBM_MP2_CONFIG_DECODER, 1009 - (ChipControl == 0x43 ? 0xe800 : 0xe000), 1)) { 1042 + (ChipControl == 0x43 ? 0xe800 : 0xe000), 1)) { 1010 1043 printk(KERN_ERR "stradis%d: IBM config failed\n", saa->nr); 1011 1044 } 1012 1045 if (HaveCS3310) { 1013 1046 int i = CS3310MaxLvl; 1014 - debiwrite(saa, debNormal, XILINX_CS3310_CMPLT, ((i<<8)|i), 2); 1047 + debiwrite(saa, debNormal, XILINX_CS3310_CMPLT, ((i << 8)| i),2); 1015 1048 } 1016 1049 /* start video decoder */ 1017 1050 debiwrite(saa, debNormal, IBM_MP2_CHIP_CONTROL, ChipControl, 2); ··· 1024 1057 /* clear pending interrupts */ 1025 1058 debiread(saa, debNormal, IBM_MP2_HOST_INT, 2); 1026 1059 debiwrite(saa, debNormal, XILINX_CTL0, 0x1711, 2); 1060 + 1027 1061 return 0; 1028 1062 } 1029 1063 ··· 1038 1070 saa = &saa7146s[num]; 1039 1071 /* check that FPGA is loaded */ 1040 1072 debiwrite(saa, debNormal, IBM_MP2_OSD_SIZE, 0xa55a, 2); 1041 - if ((i = debiread(saa, debNormal, IBM_MP2_OSD_SIZE, 2)) != 1042 - 0xa55a) { 1073 + i = debiread(saa, debNormal, IBM_MP2_OSD_SIZE, 2); 1074 + if (i != 0xa55a) { 1043 1075 printk(KERN_INFO "stradis%d: %04x != 0xa55a\n", 1044 1076 saa->nr, i); 1045 1077 #if 0 ··· 1050 1082 if (saa->boardcfg[0] > 27) 1051 1083 continue; /* skip to next card */ 1052 1084 /* load video control store */ 1053 - saa->boardcfg[1] = 0x13; /* no-sync default */ 1085 + saa->boardcfg[1] = 0x13; /* no-sync default */ 1054 1086 debiwrite(saa, debNormal, IBM_MP2_WR_PROT, 1, 2); 1055 1087 debiwrite(saa, debNormal, IBM_MP2_PROC_IADDR, 0, 2); 1056 1088 for (i = 0; i < microcode->datasize / 2; i++) 1057 1089 debiwrite(saa, debNormal, IBM_MP2_PROC_IDATA, 1058 1090 (microcode->data[i * 2] << 8) | 1059 - microcode->data[i * 2 + 1], 2); 1091 + microcode->data[i * 2 + 1], 2); 1060 1092 debiwrite(saa, debNormal, IBM_MP2_PROC_IADDR, 0, 2); 1061 1093 debiwrite(saa, debNormal, IBM_MP2_WR_PROT, 0, 2); 1062 1094 debiwrite(saa, debNormal, IBM_MP2_CHIP_CONTROL, 1063 - ChipControl, 2); 1095 + ChipControl, 2); 1064 1096 saa->boardcfg[0] = 28; 1065 1097 } 1066 1098 if (!strncmp(microcode->loadwhat, "decoder.aud", 11)) { ··· 1077 1109 debiwrite(saa, debNormal, IBM_MP2_OSD_SIZE, 0x2000, 2); 1078 1110 debiwrite(saa, debNormal, IBM_MP2_AUD_CTL, 0x4552, 2); 1079 1111 if (ibm_send_command(saa, IBM_MP2_CONFIG_DECODER, 1080 - 0xe000, 1)) { 1081 - printk(KERN_ERR 1082 - "stradis%d: IBM config failed\n", 1083 - saa->nr); 1112 + 0xe000, 1)) { 1113 + printk(KERN_ERR "stradis%d: IBM config " 1114 + "failed\n", saa->nr); 1084 1115 return -1; 1085 1116 } 1086 1117 /* set PWM to center value */ 1087 1118 if (NewCard) { 1088 1119 debiwrite(saa, debNormal, XILINX_PWM, 1089 - saa->boardcfg[14] + 1090 - (saa->boardcfg[13]<<8), 2); 1120 + saa->boardcfg[14] + 1121 + (saa->boardcfg[13] << 8), 2); 1091 1122 } else 1092 - debiwrite(saa, debNormal, XILINX_PWM, 1093 - 0x46, 2); 1123 + debiwrite(saa, debNormal, XILINX_PWM, 0x46, 2); 1124 + 1094 1125 if (HaveCS3310) { 1095 1126 i = CS3310MaxLvl; 1096 - debiwrite(saa, debNormal, 1097 - XILINX_CS3310_CMPLT, ((i<<8)|i), 2); 1127 + debiwrite(saa, debNormal, XILINX_CS3310_CMPLT, 1128 + (i << 8) | i, 2); 1098 1129 } 1099 - printk(KERN_INFO 1100 - "stradis%d: IBM MPEGCD%d Initialized\n", 1101 - saa->nr, 18 + (debiread(saa, debNormal, 1102 - IBM_MP2_CHIP_CONTROL, 2) >> 12)); 1130 + printk(KERN_INFO "stradis%d: IBM MPEGCD%d Inited\n", 1131 + saa->nr, 18 + (debiread(saa, debNormal, 1132 + IBM_MP2_CHIP_CONTROL, 2) >> 12)); 1103 1133 /* start video decoder */ 1104 1134 debiwrite(saa, debNormal, IBM_MP2_CHIP_CONTROL, 1105 1135 ChipControl, 2); 1106 - debiwrite(saa, debNormal, IBM_MP2_RB_THRESHOLD, 1107 - 0x4037, 2); /* 256k vid, 3520 bytes aud */ 1136 + debiwrite(saa, debNormal, IBM_MP2_RB_THRESHOLD, 0x4037, 1137 + 2); /* 256k vid, 3520 bytes aud */ 1108 1138 debiwrite(saa, debNormal, IBM_MP2_AUD_CTL, 0x4573, 2); 1109 1139 ibm_send_command(saa, IBM_MP2_PLAY, 0, 0); 1110 1140 /* enable buffer threshold irq */ ··· 1115 1149 saa->boardcfg[0] = 37; 1116 1150 } 1117 1151 } 1152 + 1118 1153 return 0; 1119 1154 } 1120 1155 1121 - static u32 palette2fmt[] = 1122 - { /* some of these YUV translations are wrong */ 1123 - 0xffffffff, 0x86000000, 0x87000000, 0x80000000, 0x8100000, 0x82000000, 1124 - 0x83000000, 0x00000000, 0x03000000, 0x03000000, 0x0a00000, 0x03000000, 1125 - 0x06000000, 0x00000000, 0x03000000, 0x0a000000, 0x0300000 1156 + static u32 palette2fmt[] = { /* some of these YUV translations are wrong */ 1157 + 0xffffffff, 0x86000000, 0x87000000, 0x80000000, 0x8100000, 0x82000000, 1158 + 0x83000000, 0x00000000, 0x03000000, 0x03000000, 0x0a00000, 0x03000000, 1159 + 0x06000000, 0x00000000, 0x03000000, 0x0a000000, 0x0300000 1126 1160 }; 1127 - static int bpp2fmt[4] = 1128 - { 1161 + static int bpp2fmt[4] = { 1129 1162 VIDEO_PALETTE_HI240, VIDEO_PALETTE_RGB565, VIDEO_PALETTE_RGB24, 1130 1163 VIDEO_PALETTE_RGB32 1131 1164 }; 1132 1165 1133 1166 /* I wish I could find a formula to calculate these... */ 1134 - static u32 h_prescale[64] = 1135 - { 1136 - 0x10000000, 0x18040202, 0x18080000, 0x380c0606, 0x38100204, 0x38140808, 1137 - 0x38180000, 0x381c0000, 0x3820161c, 0x38242a3b, 0x38281230, 0x382c4460, 1138 - 0x38301040, 0x38340080, 0x38380000, 0x383c0000, 0x3840fefe, 0x3844ee9f, 1139 - 0x3848ee9f, 0x384cee9f, 0x3850ee9f, 0x38542a3b, 0x38581230, 0x385c0000, 1140 - 0x38600000, 0x38640000, 0x38680000, 0x386c0000, 0x38700000, 0x38740000, 1141 - 0x38780000, 0x387c0000, 0x30800000, 0x38840000, 0x38880000, 0x388c0000, 1142 - 0x38900000, 0x38940000, 0x38980000, 0x389c0000, 0x38a00000, 0x38a40000, 1143 - 0x38a80000, 0x38ac0000, 0x38b00000, 0x38b40000, 0x38b80000, 0x38bc0000, 1144 - 0x38c00000, 0x38c40000, 0x38c80000, 0x38cc0000, 0x38d00000, 0x38d40000, 1145 - 0x38d80000, 0x38dc0000, 0x38e00000, 0x38e40000, 0x38e80000, 0x38ec0000, 1146 - 0x38f00000, 0x38f40000, 0x38f80000, 0x38fc0000, 1167 + static u32 h_prescale[64] = { 1168 + 0x10000000, 0x18040202, 0x18080000, 0x380c0606, 0x38100204, 0x38140808, 1169 + 0x38180000, 0x381c0000, 0x3820161c, 0x38242a3b, 0x38281230, 0x382c4460, 1170 + 0x38301040, 0x38340080, 0x38380000, 0x383c0000, 0x3840fefe, 0x3844ee9f, 1171 + 0x3848ee9f, 0x384cee9f, 0x3850ee9f, 0x38542a3b, 0x38581230, 0x385c0000, 1172 + 0x38600000, 0x38640000, 0x38680000, 0x386c0000, 0x38700000, 0x38740000, 1173 + 0x38780000, 0x387c0000, 0x30800000, 0x38840000, 0x38880000, 0x388c0000, 1174 + 0x38900000, 0x38940000, 0x38980000, 0x389c0000, 0x38a00000, 0x38a40000, 1175 + 0x38a80000, 0x38ac0000, 0x38b00000, 0x38b40000, 0x38b80000, 0x38bc0000, 1176 + 0x38c00000, 0x38c40000, 0x38c80000, 0x38cc0000, 0x38d00000, 0x38d40000, 1177 + 0x38d80000, 0x38dc0000, 0x38e00000, 0x38e40000, 0x38e80000, 0x38ec0000, 1178 + 0x38f00000, 0x38f40000, 0x38f80000, 0x38fc0000, 1147 1179 }; 1148 - static u32 v_gain[64] = 1149 - { 1150 - 0x016000ff, 0x016100ff, 0x016100ff, 0x016200ff, 0x016200ff, 0x016200ff, 1151 - 0x016200ff, 0x016300ff, 0x016300ff, 0x016300ff, 0x016300ff, 0x016300ff, 1152 - 0x016300ff, 0x016300ff, 0x016300ff, 0x016400ff, 0x016400ff, 0x016400ff, 1153 - 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 1154 - 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 1155 - 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 1156 - 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 1157 - 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 1158 - 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 1159 - 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 1160 - 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 1180 + static u32 v_gain[64] = { 1181 + 0x016000ff, 0x016100ff, 0x016100ff, 0x016200ff, 0x016200ff, 0x016200ff, 1182 + 0x016200ff, 0x016300ff, 0x016300ff, 0x016300ff, 0x016300ff, 0x016300ff, 1183 + 0x016300ff, 0x016300ff, 0x016300ff, 0x016400ff, 0x016400ff, 0x016400ff, 1184 + 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 1185 + 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 1186 + 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 1187 + 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 1188 + 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 1189 + 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 1190 + 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 1191 + 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 1161 1192 }; 1162 - 1163 1193 1164 1194 static void saa7146_set_winsize(struct saa7146 *saa) 1165 1195 { ··· 1171 1209 saawrite(saa->win.vidadr + saa->win.bpl * saa->win.sheight, 1172 1210 SAA7146_PROT_ADDR1); 1173 1211 saawrite(0, SAA7146_PAGE1); 1174 - saawrite(format|0x60, SAA7146_CLIP_FORMAT_CTRL); 1212 + saawrite(format | 0x60, SAA7146_CLIP_FORMAT_CTRL); 1175 1213 offset = (704 / (saa->win.width - 1)) & 0x3f; 1176 1214 saawrite(h_prescale[offset], SAA7146_HPS_H_PRESCALE); 1177 1215 offset = (720896 / saa->win.width) / (offset + 1); 1178 - saawrite((offset<<12)|0x0c, SAA7146_HPS_H_SCALE); 1216 + saawrite((offset << 12) | 0x0c, SAA7146_HPS_H_SCALE); 1179 1217 if (CurrentMode == VIDEO_MODE_NTSC) { 1180 - yacl = /*(480 / saa->win.height - 1) & 0x3f*/ 0; 1218 + yacl = /*(480 / saa->win.height - 1) & 0x3f */ 0; 1181 1219 ysci = 1024 - (saa->win.height * 1024 / 480); 1182 1220 } else { 1183 - yacl = /*(576 / saa->win.height - 1) & 0x3f*/ 0; 1221 + yacl = /*(576 / saa->win.height - 1) & 0x3f */ 0; 1184 1222 ysci = 1024 - (saa->win.height * 1024 / 576); 1185 1223 } 1186 - saawrite((1<<31)|(ysci<<21)|(yacl<<15), SAA7146_HPS_V_SCALE); 1224 + saawrite((1 << 31) | (ysci << 21) | (yacl << 15), SAA7146_HPS_V_SCALE); 1187 1225 saawrite(v_gain[yacl], SAA7146_HPS_V_GAIN); 1188 1226 saawrite(((SAA7146_MC2_UPLD_DMA1 | SAA7146_MC2_UPLD_HPS_V | 1189 - SAA7146_MC2_UPLD_HPS_H) << 16) | (SAA7146_MC2_UPLD_DMA1 | 1190 - SAA7146_MC2_UPLD_HPS_V | SAA7146_MC2_UPLD_HPS_H), 1191 - SAA7146_MC2); 1227 + SAA7146_MC2_UPLD_HPS_H) << 16) | (SAA7146_MC2_UPLD_DMA1 | 1228 + SAA7146_MC2_UPLD_HPS_V | SAA7146_MC2_UPLD_HPS_H), SAA7146_MC2); 1192 1229 } 1193 1230 1194 1231 /* clip_draw_rectangle(cm,x,y,w,h) -- handle clipping an area ··· 1222 1261 startword = (x >> 5); 1223 1262 endword = ((x + w) >> 5); 1224 1263 bitsleft = (0xffffffff >> (x & 31)); 1225 - bitsright = (0xffffffff << (~((x + w) - (endword<<5)))); 1226 - temp = &clipmap[(y<<5) + startword]; 1264 + bitsright = (0xffffffff << (~((x + w) - (endword << 5)))); 1265 + temp = &clipmap[(y << 5) + startword]; 1227 1266 w = endword - startword; 1228 1267 if (!w) { 1229 1268 bitsleft |= bitsright; ··· 1248 1287 u32 *clipmap; 1249 1288 1250 1289 clipmap = saa->dmavid2; 1251 - if((width=saa->win.width)>1023) 1252 - width = 1023; /* sanity check */ 1253 - if((height=saa->win.height)>640) 1254 - height = 639; /* sanity check */ 1255 - if (ncr > 0) { /* rectangles pased */ 1290 + if ((width = saa->win.width) > 1023) 1291 + width = 1023; /* sanity check */ 1292 + if ((height = saa->win.height) > 640) 1293 + height = 639; /* sanity check */ 1294 + if (ncr > 0) { /* rectangles pased */ 1256 1295 /* convert rectangular clips to a bitmap */ 1257 - memset(clipmap, 0, VIDEO_CLIPMAP_SIZE); /* clear map */ 1296 + memset(clipmap, 0, VIDEO_CLIPMAP_SIZE); /* clear map */ 1258 1297 for (i = 0; i < ncr; i++) 1259 1298 clip_draw_rectangle(clipmap, cr[i].x, cr[i].y, 1260 1299 cr[i].width, cr[i].height); ··· 1262 1301 /* clip against viewing window AND screen 1263 1302 so we do not have to rely on the user program 1264 1303 */ 1265 - clip_draw_rectangle(clipmap,(saa->win.x+width>saa->win.swidth) ? 1266 - (saa->win.swidth-saa->win.x) : width, 0, 1024, 768); 1267 - clip_draw_rectangle(clipmap,0,(saa->win.y+height>saa->win.sheight) ? 1268 - (saa->win.sheight-saa->win.y) : height,1024,768); 1269 - if (saa->win.x<0) 1270 - clip_draw_rectangle(clipmap, 0, 0, -(saa->win.x), 768); 1271 - if (saa->win.y<0) 1272 - clip_draw_rectangle(clipmap, 0, 0, 1024, -(saa->win.y)); 1304 + clip_draw_rectangle(clipmap, (saa->win.x + width > saa->win.swidth) ? 1305 + (saa->win.swidth - saa->win.x) : width, 0, 1024, 768); 1306 + clip_draw_rectangle(clipmap, 0, 1307 + (saa->win.y + height > saa->win.sheight) ? 1308 + (saa->win.sheight - saa->win.y) : height, 1024, 768); 1309 + if (saa->win.x < 0) 1310 + clip_draw_rectangle(clipmap, 0, 0, -saa->win.x, 768); 1311 + if (saa->win.y < 0) 1312 + clip_draw_rectangle(clipmap, 0, 0, 1024, -saa->win.y); 1273 1313 } 1274 1314 1275 1315 static int saa_ioctl(struct inode *inode, struct file *file, ··· 1284 1322 { 1285 1323 struct video_capability b; 1286 1324 strcpy(b.name, saa->video_dev.name); 1287 - b.type = VID_TYPE_CAPTURE | 1288 - VID_TYPE_OVERLAY | 1289 - VID_TYPE_CLIPPING | 1290 - VID_TYPE_FRAMERAM | 1291 - VID_TYPE_SCALES; 1325 + b.type = VID_TYPE_CAPTURE | VID_TYPE_OVERLAY | 1326 + VID_TYPE_CLIPPING | VID_TYPE_FRAMERAM | 1327 + VID_TYPE_SCALES; 1292 1328 b.channels = 1; 1293 1329 b.audios = 1; 1294 1330 b.maxwidth = 768; ··· 1323 1363 if (p.palette < sizeof(palette2fmt) / sizeof(u32)) { 1324 1364 format = palette2fmt[p.palette]; 1325 1365 saa->win.color_fmt = format; 1326 - saawrite(format|0x60, SAA7146_CLIP_FORMAT_CTRL); 1366 + saawrite(format | 0x60, 1367 + SAA7146_CLIP_FORMAT_CTRL); 1327 1368 } 1328 1369 saawrite(((p.brightness & 0xff00) << 16) | 1329 - ((p.contrast & 0xfe00) << 7) | 1330 - ((p.colour & 0xfe00) >> 9), SAA7146_BCS_CTRL); 1370 + ((p.contrast & 0xfe00) << 7) | 1371 + ((p.colour & 0xfe00) >> 9), SAA7146_BCS_CTRL); 1331 1372 saa->picture = p; 1332 1373 /* upload changed registers */ 1333 1374 saawrite(((SAA7146_MC2_UPLD_HPS_H | 1334 - SAA7146_MC2_UPLD_HPS_V) << 16) | 1335 - SAA7146_MC2_UPLD_HPS_H | SAA7146_MC2_UPLD_HPS_V, 1336 - SAA7146_MC2); 1375 + SAA7146_MC2_UPLD_HPS_V) << 16) | 1376 + SAA7146_MC2_UPLD_HPS_H | 1377 + SAA7146_MC2_UPLD_HPS_V, SAA7146_MC2); 1337 1378 return 0; 1338 1379 } 1339 1380 case VIDIOCSWIN: ··· 1345 1384 if (copy_from_user(&vw, arg, sizeof(vw))) 1346 1385 return -EFAULT; 1347 1386 1348 - if (vw.flags || vw.width < 16 || vw.height < 16) { /* stop capture */ 1349 - saawrite((SAA7146_MC1_TR_E_1 << 16), SAA7146_MC1); 1387 + /* stop capture */ 1388 + if (vw.flags || vw.width < 16 || vw.height < 16) { 1389 + saawrite((SAA7146_MC1_TR_E_1 << 16), 1390 + SAA7146_MC1); 1350 1391 return -EINVAL; 1351 1392 } 1352 - if (saa->win.bpp < 4) { /* 32-bit align start and adjust width */ 1393 + /* 32-bit align start and adjust width */ 1394 + if (saa->win.bpp < 4) { 1353 1395 int i = vw.x; 1354 1396 vw.x = (vw.x + 3) & ~3; 1355 1397 i = vw.x - i; ··· 1381 1417 */ 1382 1418 if (vw.clipcount < 0) { 1383 1419 if (copy_from_user(saa->dmavid2, vw.clips, 1384 - VIDEO_CLIPMAP_SIZE)) 1420 + VIDEO_CLIPMAP_SIZE)) 1385 1421 return -EFAULT; 1386 - } 1387 - else if (vw.clipcount > 16384) { 1422 + } else if (vw.clipcount > 16384) { 1388 1423 return -EINVAL; 1389 1424 } else if (vw.clipcount > 0) { 1390 - if ((vcp = vmalloc(sizeof(struct video_clip) * 1391 - (vw.clipcount))) == NULL) 1392 - return -ENOMEM; 1425 + vcp = vmalloc(sizeof(struct video_clip) * 1426 + vw.clipcount); 1427 + if (vcp == NULL) 1428 + return -ENOMEM; 1393 1429 if (copy_from_user(vcp, vw.clips, 1394 - sizeof(struct video_clip) * 1395 - vw.clipcount)) { 1430 + sizeof(struct video_clip) * 1431 + vw.clipcount)) { 1396 1432 vfree(vcp); 1397 1433 return -EFAULT; 1398 1434 } 1399 1435 } else /* nothing clipped */ 1400 1436 memset(saa->dmavid2, 0, VIDEO_CLIPMAP_SIZE); 1437 + 1401 1438 make_clip_tab(saa, vcp, vw.clipcount); 1402 1439 if (vw.clipcount > 0) 1403 1440 vfree(vcp); ··· 1431 1466 if (v == 0) { 1432 1467 saa->cap &= ~1; 1433 1468 saawrite((SAA7146_MC1_TR_E_1 << 16), 1434 - SAA7146_MC1); 1469 + SAA7146_MC1); 1435 1470 } else { 1436 1471 if (saa->win.vidadr == 0 || saa->win.width == 0 1437 - || saa->win.height == 0) 1472 + || saa->win.height == 0) 1438 1473 return -EINVAL; 1439 1474 saa->cap |= 1; 1440 1475 saawrite((SAA7146_MC1_TR_E_1 << 16) | 0xffff, 1441 - SAA7146_MC1); 1476 + SAA7146_MC1); 1442 1477 } 1443 1478 return 0; 1444 1479 } 1445 1480 case VIDIOCGFBUF: 1446 1481 { 1447 1482 struct video_buffer v; 1448 - v.base = (void *) saa->win.vidadr; 1483 + v.base = (void *)saa->win.vidadr; 1449 1484 v.height = saa->win.sheight; 1450 1485 v.width = saa->win.swidth; 1451 1486 v.depth = saa->win.depth; ··· 1463 1498 if (copy_from_user(&v, arg, sizeof(v))) 1464 1499 return -EFAULT; 1465 1500 if (v.depth != 8 && v.depth != 15 && v.depth != 16 && 1466 - v.depth != 24 && v.depth != 32 && v.width > 16 && 1501 + v.depth != 24 && v.depth != 32 && v.width > 16 && 1467 1502 v.height > 16 && v.bytesperline > 16) 1468 1503 return -EINVAL; 1469 1504 if (v.base) 1470 - saa->win.vidadr = (unsigned long) v.base; 1505 + saa->win.vidadr = (unsigned long)v.base; 1471 1506 saa->win.sheight = v.height; 1472 1507 saa->win.swidth = v.width; 1473 1508 saa->win.bpp = ((v.depth + 7) & 0x38) / 8; 1474 1509 saa->win.depth = v.depth; 1475 1510 saa->win.bpl = v.bytesperline; 1476 1511 1477 - DEBUG(printk("Display at %p is %d by %d, bytedepth %d, bpl %d\n", 1478 - v.base, v.width, v.height, saa->win.bpp, saa->win.bpl)); 1512 + DEBUG(printk("Display at %p is %d by %d, bytedepth %d, " 1513 + "bpl %d\n", v.base, v.width, v.height, 1514 + saa->win.bpp, saa->win.bpl)); 1479 1515 saa7146_set_winsize(saa); 1480 1516 return 0; 1481 1517 } ··· 1504 1538 int i; 1505 1539 if (copy_from_user(&v, arg, sizeof(v))) 1506 1540 return -EFAULT; 1507 - i = (~(v.volume>>8))&0xff; 1541 + i = (~(v.volume >> 8)) & 0xff; 1508 1542 if (!HaveCS4341) { 1509 - if (v.flags & VIDEO_AUDIO_MUTE) { 1543 + if (v.flags & VIDEO_AUDIO_MUTE) 1510 1544 debiwrite(saa, debNormal, 1511 - IBM_MP2_FRNT_ATTEN, 1512 - 0xffff, 2); 1513 - } 1545 + IBM_MP2_FRNT_ATTEN, 0xffff, 2); 1514 1546 if (!(v.flags & VIDEO_AUDIO_MUTE)) 1515 1547 debiwrite(saa, debNormal, 1516 - IBM_MP2_FRNT_ATTEN, 1517 - 0x0000, 2); 1548 + IBM_MP2_FRNT_ATTEN, 0x0000, 2); 1518 1549 if (v.flags & VIDEO_AUDIO_VOLUME) 1519 1550 debiwrite(saa, debNormal, 1520 1551 IBM_MP2_FRNT_ATTEN, 1521 - (i<<8)|i, 2); 1552 + (i << 8) | i, 2); 1522 1553 } else { 1523 1554 if (v.flags & VIDEO_AUDIO_MUTE) 1524 1555 cs4341_setlevel(saa, 0xff, 0xff); ··· 1543 1580 case VIDIOCSPLAYMODE: 1544 1581 { 1545 1582 struct video_play_mode pmode; 1546 - if (copy_from_user((void *) &pmode, arg, 1547 - sizeof(struct video_play_mode))) 1583 + if (copy_from_user((void *)&pmode, arg, 1584 + sizeof(struct video_play_mode))) 1548 1585 return -EFAULT; 1549 1586 switch (pmode.mode) { 1550 - case VID_PLAY_VID_OUT_MODE: 1551 - if (pmode.p1 != VIDEO_MODE_NTSC && 1587 + case VID_PLAY_VID_OUT_MODE: 1588 + if (pmode.p1 != VIDEO_MODE_NTSC && 1552 1589 pmode.p1 != VIDEO_MODE_PAL) 1590 + return -EINVAL; 1591 + set_out_format(saa, pmode.p1); 1592 + return 0; 1593 + case VID_PLAY_GENLOCK: 1594 + debiwrite(saa, debNormal, XILINX_CTL0, 1595 + pmode.p1 ? 0x8000 : 0x8080, 2); 1596 + if (NewCard) 1597 + set_genlock_offset(saa, pmode.p2); 1598 + return 0; 1599 + case VID_PLAY_NORMAL: 1600 + debiwrite(saa, debNormal, 1601 + IBM_MP2_CHIP_CONTROL, ChipControl, 2); 1602 + ibm_send_command(saa, IBM_MP2_PLAY, 0, 0); 1603 + saa->playmode = pmode.mode; 1604 + return 0; 1605 + case VID_PLAY_PAUSE: 1606 + /* IBM removed the PAUSE command */ 1607 + /* they say use SINGLE_FRAME now */ 1608 + case VID_PLAY_SINGLE_FRAME: 1609 + ibm_send_command(saa, IBM_MP2_SINGLE_FRAME,0,0); 1610 + if (saa->playmode == pmode.mode) { 1611 + debiwrite(saa, debNormal, 1612 + IBM_MP2_CHIP_CONTROL, 1613 + ChipControl, 2); 1614 + } 1615 + saa->playmode = pmode.mode; 1616 + return 0; 1617 + case VID_PLAY_FAST_FORWARD: 1618 + ibm_send_command(saa, IBM_MP2_FAST_FORWARD,0,0); 1619 + saa->playmode = pmode.mode; 1620 + return 0; 1621 + case VID_PLAY_SLOW_MOTION: 1622 + ibm_send_command(saa, IBM_MP2_SLOW_MOTION, 1623 + pmode.p1, 0); 1624 + saa->playmode = pmode.mode; 1625 + return 0; 1626 + case VID_PLAY_IMMEDIATE_NORMAL: 1627 + /* ensure transfers resume */ 1628 + debiwrite(saa, debNormal, 1629 + IBM_MP2_CHIP_CONTROL, ChipControl, 2); 1630 + ibm_send_command(saa, IBM_MP2_IMED_NORM_PLAY, 1631 + 0, 0); 1632 + saa->playmode = VID_PLAY_NORMAL; 1633 + return 0; 1634 + case VID_PLAY_SWITCH_CHANNELS: 1635 + saa->audhead = saa->audtail = 0; 1636 + saa->vidhead = saa->vidtail = 0; 1637 + ibm_send_command(saa, IBM_MP2_FREEZE_FRAME,0,1); 1638 + ibm_send_command(saa, IBM_MP2_RESET_AUD_RATE, 1639 + 0, 1); 1640 + debiwrite(saa, debNormal, IBM_MP2_CHIP_CONTROL, 1641 + 0, 2); 1642 + ibm_send_command(saa, IBM_MP2_CHANNEL_SWITCH, 1643 + 0, 1); 1644 + debiwrite(saa, debNormal, IBM_MP2_CHIP_CONTROL, 1645 + ChipControl, 2); 1646 + ibm_send_command(saa, IBM_MP2_PLAY, 0, 0); 1647 + saa->playmode = VID_PLAY_NORMAL; 1648 + return 0; 1649 + case VID_PLAY_FREEZE_FRAME: 1650 + ibm_send_command(saa, IBM_MP2_FREEZE_FRAME,0,0); 1651 + saa->playmode = pmode.mode; 1652 + return 0; 1653 + case VID_PLAY_STILL_MODE: 1654 + ibm_send_command(saa, IBM_MP2_SET_STILL_MODE, 1655 + 0, 0); 1656 + saa->playmode = pmode.mode; 1657 + return 0; 1658 + case VID_PLAY_MASTER_MODE: 1659 + if (pmode.p1 == VID_PLAY_MASTER_NONE) 1660 + saa->boardcfg[1] = 0x13; 1661 + else if (pmode.p1 == VID_PLAY_MASTER_VIDEO) 1662 + saa->boardcfg[1] = 0x23; 1663 + else if (pmode.p1 == VID_PLAY_MASTER_AUDIO) 1664 + saa->boardcfg[1] = 0x43; 1665 + else 1666 + return -EINVAL; 1667 + debiwrite(saa, debNormal, 1668 + IBM_MP2_CHIP_CONTROL, ChipControl, 2); 1669 + return 0; 1670 + case VID_PLAY_ACTIVE_SCANLINES: 1671 + if (CurrentMode == VIDEO_MODE_PAL) { 1672 + if (pmode.p1 < 1 || pmode.p2 > 625) 1553 1673 return -EINVAL; 1554 - set_out_format(saa, pmode.p1); 1555 - return 0; 1556 - case VID_PLAY_GENLOCK: 1557 - debiwrite(saa, debNormal, 1558 - XILINX_CTL0, 1559 - (pmode.p1 ? 0x8000 : 0x8080), 1560 - 2); 1561 - if (NewCard) 1562 - set_genlock_offset(saa, 1563 - pmode.p2); 1564 - return 0; 1565 - case VID_PLAY_NORMAL: 1566 - debiwrite(saa, debNormal, 1567 - IBM_MP2_CHIP_CONTROL, 1568 - ChipControl, 2); 1569 - ibm_send_command(saa, 1570 - IBM_MP2_PLAY, 0, 0); 1571 - saa->playmode = pmode.mode; 1572 - return 0; 1573 - case VID_PLAY_PAUSE: 1574 - /* IBM removed the PAUSE command */ 1575 - /* they say use SINGLE_FRAME now */ 1576 - case VID_PLAY_SINGLE_FRAME: 1577 - ibm_send_command(saa, 1578 - IBM_MP2_SINGLE_FRAME, 1579 - 0, 0); 1580 - if (saa->playmode == pmode.mode) { 1581 - debiwrite(saa, debNormal, 1582 - IBM_MP2_CHIP_CONTROL, 1583 - ChipControl, 2); 1584 - } 1585 - saa->playmode = pmode.mode; 1586 - return 0; 1587 - case VID_PLAY_FAST_FORWARD: 1588 - ibm_send_command(saa, 1589 - IBM_MP2_FAST_FORWARD, 0, 0); 1590 - saa->playmode = pmode.mode; 1591 - return 0; 1592 - case VID_PLAY_SLOW_MOTION: 1593 - ibm_send_command(saa, 1594 - IBM_MP2_SLOW_MOTION, 1595 - pmode.p1, 0); 1596 - saa->playmode = pmode.mode; 1597 - return 0; 1598 - case VID_PLAY_IMMEDIATE_NORMAL: 1599 - /* ensure transfers resume */ 1600 - debiwrite(saa, debNormal, 1601 - IBM_MP2_CHIP_CONTROL, 1602 - ChipControl, 2); 1603 - ibm_send_command(saa, 1604 - IBM_MP2_IMED_NORM_PLAY, 0, 0); 1605 - saa->playmode = VID_PLAY_NORMAL; 1606 - return 0; 1607 - case VID_PLAY_SWITCH_CHANNELS: 1608 - saa->audhead = saa->audtail = 0; 1609 - saa->vidhead = saa->vidtail = 0; 1610 - ibm_send_command(saa, 1611 - IBM_MP2_FREEZE_FRAME, 0, 1); 1612 - ibm_send_command(saa, 1613 - IBM_MP2_RESET_AUD_RATE, 0, 1); 1614 - debiwrite(saa, debNormal, 1615 - IBM_MP2_CHIP_CONTROL, 0, 2); 1616 - ibm_send_command(saa, 1617 - IBM_MP2_CHANNEL_SWITCH, 0, 1); 1618 - debiwrite(saa, debNormal, 1619 - IBM_MP2_CHIP_CONTROL, 1620 - ChipControl, 2); 1621 - ibm_send_command(saa, 1622 - IBM_MP2_PLAY, 0, 0); 1623 - saa->playmode = VID_PLAY_NORMAL; 1624 - return 0; 1625 - case VID_PLAY_FREEZE_FRAME: 1626 - ibm_send_command(saa, 1627 - IBM_MP2_FREEZE_FRAME, 0, 0); 1628 - saa->playmode = pmode.mode; 1629 - return 0; 1630 - case VID_PLAY_STILL_MODE: 1631 - ibm_send_command(saa, 1632 - IBM_MP2_SET_STILL_MODE, 0, 0); 1633 - saa->playmode = pmode.mode; 1634 - return 0; 1635 - case VID_PLAY_MASTER_MODE: 1636 - if (pmode.p1 == VID_PLAY_MASTER_NONE) 1637 - saa->boardcfg[1] = 0x13; 1638 - else if (pmode.p1 == 1639 - VID_PLAY_MASTER_VIDEO) 1640 - saa->boardcfg[1] = 0x23; 1641 - else if (pmode.p1 == 1642 - VID_PLAY_MASTER_AUDIO) 1643 - saa->boardcfg[1] = 0x43; 1644 - else 1674 + saa->boardcfg[5] = pmode.p1; 1675 + saa->boardcfg[55] = (pmode.p1 + 1676 + (pmode.p2 / 2) - 1) & 0xff; 1677 + } else { 1678 + if (pmode.p1 < 4 || pmode.p2 > 525) 1645 1679 return -EINVAL; 1646 - debiwrite(saa, debNormal, 1647 - IBM_MP2_CHIP_CONTROL, 1648 - ChipControl, 2); 1649 - return 0; 1650 - case VID_PLAY_ACTIVE_SCANLINES: 1651 - if (CurrentMode == VIDEO_MODE_PAL) { 1652 - if (pmode.p1 < 1 || 1653 - pmode.p2 > 625) 1654 - return -EINVAL; 1655 - saa->boardcfg[5] = pmode.p1; 1656 - saa->boardcfg[55] = (pmode.p1 + 1657 - (pmode.p2/2) - 1) & 1658 - 0xff; 1659 - } else { 1660 - if (pmode.p1 < 4 || 1661 - pmode.p2 > 525) 1662 - return -EINVAL; 1663 - saa->boardcfg[4] = pmode.p1; 1664 - saa->boardcfg[54] = (pmode.p1 + 1665 - (pmode.p2/2) - 4) & 1666 - 0xff; 1667 - } 1668 - set_out_format(saa, CurrentMode); 1669 - case VID_PLAY_RESET: 1670 - return do_ibm_reset(saa); 1671 - case VID_PLAY_END_MARK: 1672 - if (saa->endmarktail < 1673 - saa->endmarkhead) { 1674 - if (saa->endmarkhead - 1680 + saa->boardcfg[4] = pmode.p1; 1681 + saa->boardcfg[54] = (pmode.p1 + 1682 + (pmode.p2 / 2) - 4) & 0xff; 1683 + } 1684 + set_out_format(saa, CurrentMode); 1685 + case VID_PLAY_RESET: 1686 + return do_ibm_reset(saa); 1687 + case VID_PLAY_END_MARK: 1688 + if (saa->endmarktail < saa->endmarkhead) { 1689 + if (saa->endmarkhead - 1675 1690 saa->endmarktail < 2) 1676 - return -ENOSPC; 1677 - } else if (saa->endmarkhead <= 1678 - saa->endmarktail) { 1679 - if (saa->endmarktail - 1680 - saa->endmarkhead > 1681 - (MAX_MARKS - 2)) 1682 - return -ENOSPC; 1683 - } else 1684 1691 return -ENOSPC; 1685 - saa->endmark[saa->endmarktail] = 1686 - saa->audtail; 1687 - saa->endmarktail++; 1688 - if (saa->endmarktail >= MAX_MARKS) 1689 - saa->endmarktail = 0; 1692 + } else if (saa->endmarkhead <=saa->endmarktail){ 1693 + if (saa->endmarktail - saa->endmarkhead 1694 + > (MAX_MARKS - 2)) 1695 + return -ENOSPC; 1696 + } else 1697 + return -ENOSPC; 1698 + saa->endmark[saa->endmarktail] = saa->audtail; 1699 + saa->endmarktail++; 1700 + if (saa->endmarktail >= MAX_MARKS) 1701 + saa->endmarktail = 0; 1690 1702 } 1691 1703 return -EINVAL; 1692 1704 } 1693 1705 case VIDIOCSWRITEMODE: 1694 1706 { 1695 1707 int mode; 1696 - if (copy_from_user((void *) &mode, arg, sizeof(int))) 1697 - return -EFAULT; 1708 + if (copy_from_user((void *)&mode, arg, sizeof(int))) 1709 + return -EFAULT; 1698 1710 if (mode == VID_WRITE_MPEG_AUD || 1699 - mode == VID_WRITE_MPEG_VID || 1700 - mode == VID_WRITE_CC || 1701 - mode == VID_WRITE_TTX || 1702 - mode == VID_WRITE_OSD) { 1711 + mode == VID_WRITE_MPEG_VID || 1712 + mode == VID_WRITE_CC || 1713 + mode == VID_WRITE_TTX || 1714 + mode == VID_WRITE_OSD) { 1703 1715 saa->writemode = mode; 1704 1716 return 0; 1705 1717 } ··· 1688 1750 if (copy_from_user(&ucode, arg, sizeof(ucode))) 1689 1751 return -EFAULT; 1690 1752 if (ucode.datasize > 65536 || ucode.datasize < 1024 || 1691 - strncmp(ucode.loadwhat, "dec", 3)) 1753 + strncmp(ucode.loadwhat, "dec", 3)) 1692 1754 return -EINVAL; 1693 1755 if ((udata = vmalloc(ucode.datasize)) == NULL) 1694 1756 return -ENOMEM; ··· 1697 1759 return -EFAULT; 1698 1760 } 1699 1761 ucode.data = udata; 1700 - if (!strncmp(ucode.loadwhat, "decoder.aud", 11) 1701 - || !strncmp(ucode.loadwhat, "decoder.vid", 11)) 1762 + if (!strncmp(ucode.loadwhat, "decoder.aud", 11) || 1763 + !strncmp(ucode.loadwhat, "decoder.vid", 11)) 1702 1764 i = initialize_ibmmpeg2(&ucode); 1703 1765 else 1704 1766 i = initialize_fpga(&ucode); ··· 1743 1805 return -EINVAL; 1744 1806 } 1745 1807 1746 - static ssize_t saa_read(struct file *file, char __user *buf, 1747 - size_t count, loff_t *ppos) 1808 + static ssize_t saa_read(struct file *file, char __user * buf, 1809 + size_t count, loff_t * ppos) 1748 1810 { 1749 1811 return -EINVAL; 1750 1812 } 1751 1813 1752 - static ssize_t saa_write(struct file *file, const char __user *buf, 1753 - size_t count, loff_t *ppos) 1814 + static ssize_t saa_write(struct file *file, const char __user * buf, 1815 + size_t count, loff_t * ppos) 1754 1816 { 1755 1817 struct saa7146 *saa = file->private_data; 1756 1818 unsigned long todo = count; ··· 1761 1823 if (saa->writemode == VID_WRITE_MPEG_AUD) { 1762 1824 spin_lock_irqsave(&saa->lock, flags); 1763 1825 if (saa->audhead <= saa->audtail) 1764 - blocksize = 65536-(saa->audtail - saa->audhead); 1826 + blocksize = 65536 - 1827 + (saa->audtail - saa->audhead); 1765 1828 else 1766 1829 blocksize = saa->audhead - saa->audtail; 1767 1830 spin_unlock_irqrestore(&saa->lock, flags); 1768 1831 if (blocksize < 16384) { 1769 1832 saawrite(SAA7146_PSR_DEBI_S | 1770 - SAA7146_PSR_PIN1, SAA7146_IER); 1833 + SAA7146_PSR_PIN1, SAA7146_IER); 1771 1834 saawrite(SAA7146_PSR_PIN1, SAA7146_PSR); 1772 1835 /* wait for buffer space to open */ 1773 1836 interruptible_sleep_on(&saa->audq); 1774 1837 } 1775 1838 spin_lock_irqsave(&saa->lock, flags); 1776 1839 if (saa->audhead <= saa->audtail) { 1777 - blocksize = 65536-(saa->audtail - saa->audhead); 1840 + blocksize = 65536 - 1841 + (saa->audtail - saa->audhead); 1778 1842 split = 65536 - saa->audtail; 1779 1843 } else { 1780 1844 blocksize = saa->audhead - saa->audtail; ··· 1791 1851 return -ENOSPC; 1792 1852 if (split < blocksize) { 1793 1853 if (copy_from_user(saa->audbuf + 1794 - saa->audtail, buf, split)) 1854 + saa->audtail, buf, split)) 1795 1855 return -EFAULT; 1796 1856 buf += split; 1797 1857 todo -= split; ··· 1799 1859 saa->audtail = 0; 1800 1860 } 1801 1861 if (copy_from_user(saa->audbuf + saa->audtail, buf, 1802 - blocksize)) 1862 + blocksize)) 1803 1863 return -EFAULT; 1804 1864 saa->audtail += blocksize; 1805 1865 todo -= blocksize; ··· 1808 1868 } else if (saa->writemode == VID_WRITE_MPEG_VID) { 1809 1869 spin_lock_irqsave(&saa->lock, flags); 1810 1870 if (saa->vidhead <= saa->vidtail) 1811 - blocksize=524288-(saa->vidtail - saa->vidhead); 1871 + blocksize = 524288 - 1872 + (saa->vidtail - saa->vidhead); 1812 1873 else 1813 1874 blocksize = saa->vidhead - saa->vidtail; 1814 1875 spin_unlock_irqrestore(&saa->lock, flags); 1815 1876 if (blocksize < 65536) { 1816 1877 saawrite(SAA7146_PSR_DEBI_S | 1817 - SAA7146_PSR_PIN1, SAA7146_IER); 1878 + SAA7146_PSR_PIN1, SAA7146_IER); 1818 1879 saawrite(SAA7146_PSR_PIN1, SAA7146_PSR); 1819 1880 /* wait for buffer space to open */ 1820 1881 interruptible_sleep_on(&saa->vidq); 1821 1882 } 1822 1883 spin_lock_irqsave(&saa->lock, flags); 1823 1884 if (saa->vidhead <= saa->vidtail) { 1824 - blocksize=524288-(saa->vidtail - saa->vidhead); 1885 + blocksize = 524288 - 1886 + (saa->vidtail - saa->vidhead); 1825 1887 split = 524288 - saa->vidtail; 1826 1888 } else { 1827 1889 blocksize = saa->vidhead - saa->vidtail; ··· 1838 1896 return -ENOSPC; 1839 1897 if (split < blocksize) { 1840 1898 if (copy_from_user(saa->vidbuf + 1841 - saa->vidtail, buf, split)) 1899 + saa->vidtail, buf, split)) 1842 1900 return -EFAULT; 1843 1901 buf += split; 1844 1902 todo -= split; ··· 1846 1904 saa->vidtail = 0; 1847 1905 } 1848 1906 if (copy_from_user(saa->vidbuf + saa->vidtail, buf, 1849 - blocksize)) 1907 + blocksize)) 1850 1908 return -EFAULT; 1851 1909 saa->vidtail += blocksize; 1852 1910 todo -= blocksize; ··· 1864 1922 debiwrite(saa, debNormal, IBM_MP2_OSD_LINK_ADDR, 0, 2); 1865 1923 debiwrite(saa, debNormal, IBM_MP2_MASK0, 0xc00d, 2); 1866 1924 debiwrite(saa, debNormal, IBM_MP2_DISP_MODE, 1867 - debiread(saa, debNormal, 1868 - IBM_MP2_DISP_MODE, 2) | 1, 2); 1925 + debiread(saa, debNormal, 1926 + IBM_MP2_DISP_MODE, 2) | 1, 2); 1869 1927 /* trigger osd data transfer */ 1870 1928 saawrite(SAA7146_PSR_DEBI_S | 1871 1929 SAA7146_PSR_PIN1, SAA7146_IER); ··· 1877 1935 1878 1936 static int saa_open(struct inode *inode, struct file *file) 1879 1937 { 1880 - struct saa7146 *saa = NULL; 1881 - unsigned int minor = iminor(inode); 1882 - int i; 1938 + struct video_device *vdev = video_devdata(file); 1939 + struct saa7146 *saa = container_of(vdev, struct saa7146, video_dev); 1883 1940 1884 - for (i = 0; i < SAA7146_MAX; i++) { 1885 - if (saa7146s[i].video_dev.minor == minor) { 1886 - saa = &saa7146s[i]; 1887 - } 1888 - } 1889 - if (saa == NULL) { 1890 - return -ENODEV; 1891 - } 1892 1941 file->private_data = saa; 1893 1942 1894 - //saa->video_dev.busy = 0; /* old hack to support multiple open */ 1895 1943 saa->user++; 1896 1944 if (saa->user > 1) 1897 1945 return 0; /* device open already, don't reset */ ··· 1893 1961 { 1894 1962 struct saa7146 *saa = file->private_data; 1895 1963 saa->user--; 1896 - //saa->video_dev.busy = 0; /* old hack to support multiple open */ 1964 + 1897 1965 if (saa->user > 0) /* still someone using device */ 1898 1966 return 0; 1899 1967 saawrite(0x007f0000, SAA7146_MC1); /* stop all overlay dma */ 1900 1968 return 0; 1901 1969 } 1902 1970 1903 - static struct file_operations saa_fops = 1904 - { 1905 - .owner = THIS_MODULE, 1906 - .open = saa_open, 1907 - .release = saa_release, 1908 - .ioctl = saa_ioctl, 1909 - .compat_ioctl = v4l_compat_ioctl32, 1910 - .read = saa_read, 1911 - .llseek = no_llseek, 1912 - .write = saa_write, 1913 - .mmap = saa_mmap, 1971 + static struct file_operations saa_fops = { 1972 + .owner = THIS_MODULE, 1973 + .open = saa_open, 1974 + .release = saa_release, 1975 + .ioctl = saa_ioctl, 1976 + .compat_ioctl = v4l_compat_ioctl32, 1977 + .read = saa_read, 1978 + .llseek = no_llseek, 1979 + .write = saa_write, 1980 + .mmap = saa_mmap, 1914 1981 }; 1915 1982 1916 1983 /* template for video_device-structure */ 1917 - static struct video_device saa_template = 1918 - { 1919 - .name = "SAA7146A", 1920 - .type = VID_TYPE_CAPTURE | VID_TYPE_OVERLAY, 1921 - .hardware = VID_HARDWARE_SAA7146, 1922 - .fops = &saa_fops, 1923 - .minor = -1, 1984 + static struct video_device saa_template = { 1985 + .name = "SAA7146A", 1986 + .type = VID_TYPE_CAPTURE | VID_TYPE_OVERLAY, 1987 + .hardware = VID_HARDWARE_SAA7146, 1988 + .fops = &saa_fops, 1989 + .minor = -1, 1924 1990 }; 1925 1991 1926 - static int configure_saa7146(struct pci_dev *dev, int num) 1992 + static int __devinit configure_saa7146(struct pci_dev *pdev, int num) 1927 1993 { 1928 - int result; 1929 - struct saa7146 *saa; 1994 + int retval; 1995 + struct saa7146 *saa = pci_get_drvdata(pdev); 1930 1996 1931 - saa = &saa7146s[num]; 1932 - 1933 1997 saa->endmarkhead = saa->endmarktail = 0; 1934 1998 saa->win.x = saa->win.y = 0; 1935 1999 saa->win.width = saa->win.cropwidth = 720; ··· 1941 2013 saa->picture.contrast = 38768; 1942 2014 saa->picture.colour = 32768; 1943 2015 saa->cap = 0; 1944 - saa->dev = dev; 1945 2016 saa->nr = num; 1946 2017 saa->playmode = VID_PLAY_NORMAL; 1947 2018 memset(saa->boardcfg, 0, 64); /* clear board config area */ ··· 1960 2033 init_waitqueue_head(&saa->vidq); 1961 2034 spin_lock_init(&saa->lock); 1962 2035 1963 - if (pci_enable_device(dev)) 1964 - return -EIO; 1965 - 1966 - saa->id = dev->device; 1967 - saa->irq = dev->irq; 2036 + retval = pci_enable_device(pdev); 2037 + if (retval) { 2038 + dev_err(&pdev->dev, "%d: pci_enable_device failed!\n", num); 2039 + goto err; 2040 + } 2041 + 2042 + saa->id = pdev->device; 2043 + saa->irq = pdev->irq; 1968 2044 saa->video_dev.minor = -1; 1969 - saa->saa7146_adr = pci_resource_start(dev, 0); 1970 - pci_read_config_byte(dev, PCI_CLASS_REVISION, &saa->revision); 2045 + saa->saa7146_adr = pci_resource_start(pdev, 0); 2046 + pci_read_config_byte(pdev, PCI_CLASS_REVISION, &saa->revision); 1971 2047 1972 2048 saa->saa7146_mem = ioremap(saa->saa7146_adr, 0x200); 1973 - if (!saa->saa7146_mem) 1974 - return -EIO; 2049 + if (saa->saa7146_mem == NULL) { 2050 + dev_err(&pdev->dev, "%d: ioremap failed!\n", num); 2051 + retval = -EIO; 2052 + goto err; 2053 + } 1975 2054 1976 2055 memcpy(&saa->video_dev, &saa_template, sizeof(saa_template)); 1977 2056 saawrite(0, SAA7146_IER); /* turn off all interrupts */ 1978 - result = request_irq(saa->irq, saa7146_irq, 1979 - SA_SHIRQ | SA_INTERRUPT, "stradis", (void *) saa); 1980 - if (result == -EINVAL) 1981 - printk(KERN_ERR "stradis%d: Bad irq number or handler\n", 1982 - num); 1983 - if (result == -EBUSY) 1984 - printk(KERN_ERR "stradis%d: IRQ %ld busy, change your PnP" 1985 - " config in BIOS\n", num, saa->irq); 1986 - if (result < 0) { 1987 - iounmap(saa->saa7146_mem); 1988 - return result; 2057 + 2058 + retval = request_irq(saa->irq, saa7146_irq, SA_SHIRQ | SA_INTERRUPT, 2059 + "stradis", saa); 2060 + if (retval == -EINVAL) 2061 + dev_err(&pdev->dev, "%d: Bad irq number or handler\n", num); 2062 + else if (retval == -EBUSY) 2063 + dev_err(&pdev->dev, "%d: IRQ %ld busy, change your PnP config " 2064 + "in BIOS\n", num, saa->irq); 2065 + if (retval < 0) 2066 + goto errio; 2067 + 2068 + pci_set_master(pdev); 2069 + retval = video_register_device(&saa->video_dev, VFL_TYPE_GRABBER, 2070 + video_nr); 2071 + if (retval < 0) { 2072 + dev_err(&pdev->dev, "%d: error in registering video device!\n", 2073 + num); 2074 + goto errio; 1989 2075 } 1990 - pci_set_master(dev); 1991 - if (video_register_device(&saa->video_dev, VFL_TYPE_GRABBER, video_nr) < 0) { 1992 - iounmap(saa->saa7146_mem); 1993 - return -1; 1994 - } 2076 + 1995 2077 return 0; 2078 + errio: 2079 + iounmap(saa->saa7146_mem); 2080 + err: 2081 + return retval; 1996 2082 } 1997 2083 1998 - static int init_saa7146(int i) 2084 + static int __devinit init_saa7146(struct pci_dev *pdev) 1999 2085 { 2000 - struct saa7146 *saa = &saa7146s[i]; 2086 + struct saa7146 *saa = pci_get_drvdata(pdev); 2001 2087 2088 + memset(saa, 0, sizeof(*saa)); 2002 2089 saa->user = 0; 2003 2090 /* reset the saa7146 */ 2004 2091 saawrite(0xffff0000, SAA7146_MC1); ··· 2030 2089 saawrite(0x00000000, SAA7146_DD1_STREAM_A); 2031 2090 saawrite(0x00000000, SAA7146_BRS_CTRL); 2032 2091 saawrite(0x80400040, SAA7146_BCS_CTRL); 2033 - saawrite(0x0000e000 /*| (1<<29)*/, SAA7146_HPS_CTRL); 2092 + saawrite(0x0000e000 /*| (1<<29) */ , SAA7146_HPS_CTRL); 2034 2093 saawrite(0x00000060, SAA7146_CLIP_FORMAT_CTRL); 2035 2094 saawrite(0x00000000, SAA7146_ACON1); 2036 2095 saawrite(0x00000000, SAA7146_ACON2); 2037 2096 saawrite(0x00000600, SAA7146_I2C_STATUS); 2038 2097 saawrite(((SAA7146_MC2_UPLD_D1_B | SAA7146_MC2_UPLD_D1_A | 2039 - SAA7146_MC2_UPLD_BRS | SAA7146_MC2_UPLD_HPS_H | 2040 - SAA7146_MC2_UPLD_HPS_V | SAA7146_MC2_UPLD_DMA2 | 2041 - SAA7146_MC2_UPLD_DMA1 | SAA7146_MC2_UPLD_I2C) << 16) | 0xffff, 2042 - SAA7146_MC2); 2098 + SAA7146_MC2_UPLD_BRS | SAA7146_MC2_UPLD_HPS_H | 2099 + SAA7146_MC2_UPLD_HPS_V | SAA7146_MC2_UPLD_DMA2 | 2100 + SAA7146_MC2_UPLD_DMA1 | SAA7146_MC2_UPLD_I2C) << 16) | 0xffff, 2101 + SAA7146_MC2); 2043 2102 /* setup arbitration control registers */ 2044 2103 saawrite(0x1412121a, SAA7146_PCI_BT_V1); 2045 2104 2046 2105 /* allocate 32k dma buffer + 4k for page table */ 2047 2106 if ((saa->dmadebi = kmalloc(32768 + 4096, GFP_KERNEL)) == NULL) { 2048 - printk(KERN_ERR "stradis%d: debi kmalloc failed\n", i); 2049 - return -1; 2107 + dev_err(&pdev->dev, "%d: debi kmalloc failed\n", saa->nr); 2108 + goto err; 2050 2109 } 2051 2110 #if 0 2052 2111 saa->pagedebi = saa->dmadebi + 32768; /* top 4k is for mmu */ ··· 2056 2115 #endif 2057 2116 saa->audhead = saa->vidhead = saa->osdhead = 0; 2058 2117 saa->audtail = saa->vidtail = saa->osdtail = 0; 2059 - if (saa->vidbuf == NULL) 2060 - if ((saa->vidbuf = vmalloc(524288)) == NULL) { 2061 - printk(KERN_ERR "stradis%d: malloc failed\n", saa->nr); 2062 - return -ENOMEM; 2063 - } 2064 - if (saa->audbuf == NULL) 2065 - if ((saa->audbuf = vmalloc(65536)) == NULL) { 2066 - printk(KERN_ERR "stradis%d: malloc failed\n", saa->nr); 2067 - vfree(saa->vidbuf); 2068 - saa->vidbuf = NULL; 2069 - return -ENOMEM; 2070 - } 2071 - if (saa->osdbuf == NULL) 2072 - if ((saa->osdbuf = vmalloc(131072)) == NULL) { 2073 - printk(KERN_ERR "stradis%d: malloc failed\n", saa->nr); 2074 - vfree(saa->vidbuf); 2075 - vfree(saa->audbuf); 2076 - saa->vidbuf = saa->audbuf = NULL; 2077 - return -ENOMEM; 2078 - } 2079 - /* allocate 81920 byte buffer for clipping */ 2080 - if ((saa->dmavid2 = kmalloc(VIDEO_CLIPMAP_SIZE, GFP_KERNEL)) == NULL) { 2081 - printk(KERN_ERR "stradis%d: clip kmalloc failed\n", saa->nr); 2082 - vfree(saa->vidbuf); 2083 - vfree(saa->audbuf); 2084 - vfree(saa->osdbuf); 2085 - saa->vidbuf = saa->audbuf = saa->osdbuf = NULL; 2086 - saa->dmavid2 = NULL; 2087 - return -1; 2118 + if (saa->vidbuf == NULL && (saa->vidbuf = vmalloc(524288)) == NULL) { 2119 + dev_err(&pdev->dev, "%d: malloc failed\n", saa->nr); 2120 + goto err; 2088 2121 } 2089 - memset(saa->dmavid2, 0x00, VIDEO_CLIPMAP_SIZE); /* clip everything */ 2122 + if (saa->audbuf == NULL && (saa->audbuf = vmalloc(65536)) == NULL) { 2123 + dev_err(&pdev->dev, "%d: malloc failed\n", saa->nr); 2124 + goto errvid; 2125 + } 2126 + if (saa->osdbuf == NULL && (saa->osdbuf = vmalloc(131072)) == NULL) { 2127 + dev_err(&pdev->dev, "%d: malloc failed\n", saa->nr); 2128 + goto erraud; 2129 + } 2130 + /* allocate 81920 byte buffer for clipping */ 2131 + if ((saa->dmavid2 = kzalloc(VIDEO_CLIPMAP_SIZE, GFP_KERNEL)) == NULL) { 2132 + dev_err(&pdev->dev, "%d: clip kmalloc failed\n", saa->nr); 2133 + goto errosd; 2134 + } 2090 2135 /* setup clipping registers */ 2091 2136 saawrite(virt_to_bus(saa->dmavid2), SAA7146_BASE_EVEN2); 2092 2137 saawrite(virt_to_bus(saa->dmavid2) + 128, SAA7146_BASE_ODD2); 2093 2138 saawrite(virt_to_bus(saa->dmavid2) + VIDEO_CLIPMAP_SIZE, 2094 - SAA7146_PROT_ADDR2); 2139 + SAA7146_PROT_ADDR2); 2095 2140 saawrite(256, SAA7146_PITCH2); 2096 - saawrite(4, SAA7146_PAGE2); /* dma direction: read, no byteswap */ 2141 + saawrite(4, SAA7146_PAGE2); /* dma direction: read, no byteswap */ 2097 2142 saawrite(((SAA7146_MC2_UPLD_DMA2) << 16) | SAA7146_MC2_UPLD_DMA2, 2098 2143 SAA7146_MC2); 2099 2144 I2CBusScan(saa); 2145 + 2100 2146 return 0; 2147 + errosd: 2148 + vfree(saa->osdbuf); 2149 + saa->osdbuf = NULL; 2150 + erraud: 2151 + vfree(saa->audbuf); 2152 + saa->audbuf = NULL; 2153 + errvid: 2154 + vfree(saa->vidbuf); 2155 + saa->vidbuf = NULL; 2156 + err: 2157 + return -ENOMEM; 2101 2158 } 2102 2159 2103 - static void release_saa(void) 2160 + static void stradis_release_saa(struct pci_dev *pdev) 2104 2161 { 2105 2162 u8 command; 2106 - int i; 2107 - struct saa7146 *saa; 2163 + struct saa7146 *saa = pci_get_drvdata(pdev); 2108 2164 2109 - for (i = 0; i < saa_num; i++) { 2110 - saa = &saa7146s[i]; 2165 + /* turn off all capturing, DMA and IRQs */ 2166 + saawrite(0xffff0000, SAA7146_MC1); /* reset chip */ 2167 + saawrite(0, SAA7146_MC2); 2168 + saawrite(0, SAA7146_IER); 2169 + saawrite(0xffffffffUL, SAA7146_ISR); 2111 2170 2112 - /* turn off all capturing, DMA and IRQs */ 2113 - saawrite(0xffff0000, SAA7146_MC1); /* reset chip */ 2114 - saawrite(0, SAA7146_MC2); 2115 - saawrite(0, SAA7146_IER); 2116 - saawrite(0xffffffffUL, SAA7146_ISR); 2171 + /* disable PCI bus-mastering */ 2172 + pci_read_config_byte(pdev, PCI_COMMAND, &command); 2173 + command &= ~PCI_COMMAND_MASTER; 2174 + pci_write_config_byte(pdev, PCI_COMMAND, command); 2117 2175 2118 - /* disable PCI bus-mastering */ 2119 - pci_read_config_byte(saa->dev, PCI_COMMAND, &command); 2120 - command &= ~PCI_COMMAND_MASTER; 2121 - pci_write_config_byte(saa->dev, PCI_COMMAND, command); 2122 - 2123 - /* unmap and free memory */ 2124 - saa->audhead = saa->audtail = saa->osdhead = 0; 2125 - saa->vidhead = saa->vidtail = saa->osdtail = 0; 2126 - vfree(saa->vidbuf); 2127 - vfree(saa->audbuf); 2128 - vfree(saa->osdbuf); 2129 - kfree(saa->dmavid2); 2130 - saa->audbuf = saa->vidbuf = saa->osdbuf = NULL; 2131 - saa->dmavid2 = NULL; 2132 - kfree(saa->dmadebi); 2133 - kfree(saa->dmavid1); 2134 - kfree(saa->dmavid3); 2135 - kfree(saa->dmaa1in); 2136 - kfree(saa->dmaa1out); 2137 - kfree(saa->dmaa2in); 2138 - kfree(saa->dmaa2out); 2139 - kfree(saa->dmaRPS1); 2140 - kfree(saa->dmaRPS2); 2141 - free_irq(saa->irq, saa); 2142 - if (saa->saa7146_mem) 2143 - iounmap(saa->saa7146_mem); 2144 - if (saa->video_dev.minor != -1) 2145 - video_unregister_device(&saa->video_dev); 2146 - } 2176 + /* unmap and free memory */ 2177 + saa->audhead = saa->audtail = saa->osdhead = 0; 2178 + saa->vidhead = saa->vidtail = saa->osdtail = 0; 2179 + vfree(saa->vidbuf); 2180 + vfree(saa->audbuf); 2181 + vfree(saa->osdbuf); 2182 + kfree(saa->dmavid2); 2183 + saa->audbuf = saa->vidbuf = saa->osdbuf = NULL; 2184 + saa->dmavid2 = NULL; 2185 + kfree(saa->dmadebi); 2186 + kfree(saa->dmavid1); 2187 + kfree(saa->dmavid3); 2188 + kfree(saa->dmaa1in); 2189 + kfree(saa->dmaa1out); 2190 + kfree(saa->dmaa2in); 2191 + kfree(saa->dmaa2out); 2192 + kfree(saa->dmaRPS1); 2193 + kfree(saa->dmaRPS2); 2194 + free_irq(saa->irq, saa); 2195 + if (saa->saa7146_mem) 2196 + iounmap(saa->saa7146_mem); 2197 + if (saa->video_dev.minor != -1) 2198 + video_unregister_device(&saa->video_dev); 2147 2199 } 2148 2200 2149 - 2150 - static int __init stradis_init (void) 2201 + static int __devinit stradis_probe(struct pci_dev *pdev, 2202 + const struct pci_device_id *ent) 2151 2203 { 2152 - struct pci_dev *dev = NULL; 2153 - int result = 0, i; 2204 + int retval = -EINVAL; 2205 + 2206 + if (saa_num >= SAA7146_MAX) 2207 + goto err; 2208 + 2209 + if (!pdev->subsystem_vendor) 2210 + dev_info(&pdev->dev, "%d: rev1 decoder\n", saa_num); 2211 + else 2212 + dev_info(&pdev->dev, "%d: SDM2xx found\n", saa_num); 2213 + 2214 + pci_set_drvdata(pdev, &saa7146s[saa_num]); 2215 + 2216 + retval = configure_saa7146(pdev, saa_num); 2217 + if (retval) { 2218 + dev_err(&pdev->dev, "%d: error in configuring\n", saa_num); 2219 + goto err; 2220 + } 2221 + 2222 + if (init_saa7146(pdev) < 0) { 2223 + dev_err(&pdev->dev, "%d: error in initialization\n", saa_num); 2224 + retval = -EIO; 2225 + goto errrel; 2226 + } 2227 + 2228 + saa_num++; 2229 + 2230 + return 0; 2231 + errrel: 2232 + stradis_release_saa(pdev); 2233 + err: 2234 + return retval; 2235 + } 2236 + 2237 + static void __devexit stradis_remove(struct pci_dev *pdev) 2238 + { 2239 + stradis_release_saa(pdev); 2240 + } 2241 + 2242 + static struct pci_device_id stradis_pci_tbl[] = { 2243 + { PCI_DEVICE(PCI_VENDOR_ID_PHILIPS, PCI_DEVICE_ID_PHILIPS_SAA7146) }, 2244 + { 0 } 2245 + }; 2246 + 2247 + MODULE_DEVICE_TABLE(pci, stradis_pci_tbl); 2248 + 2249 + static struct pci_driver stradis_driver = { 2250 + .name = "stradis", 2251 + .id_table = stradis_pci_tbl, 2252 + .probe = stradis_probe, 2253 + .remove = __devexit_p(stradis_remove) 2254 + }; 2255 + 2256 + int __init stradis_init(void) 2257 + { 2258 + int retval; 2154 2259 2155 2260 saa_num = 0; 2156 2261 2157 - while ((dev = pci_find_device(PCI_VENDOR_ID_PHILIPS, PCI_DEVICE_ID_PHILIPS_SAA7146, dev))) { 2158 - if (!dev->subsystem_vendor) 2159 - printk(KERN_INFO "stradis%d: rev1 decoder\n", saa_num); 2160 - else 2161 - printk(KERN_INFO "stradis%d: SDM2xx found\n", saa_num); 2162 - result = configure_saa7146(dev, saa_num++); 2163 - if (result) 2164 - return result; 2165 - } 2166 - if (saa_num) 2167 - printk(KERN_INFO "stradis: %d card(s) found.\n", saa_num); 2168 - else 2169 - return -EINVAL; 2170 - for (i = 0; i < saa_num; i++) 2171 - if (init_saa7146(i) < 0) { 2172 - release_saa(); 2173 - return -EIO; 2174 - } 2175 - return 0; 2262 + retval = pci_register_driver(&stradis_driver); 2263 + if (retval) 2264 + printk(KERN_ERR "stradis: Unable to register pci driver.\n"); 2265 + 2266 + return retval; 2176 2267 } 2177 2268 2178 - 2179 - static void __exit stradis_exit (void) 2269 + void __exit stradis_exit(void) 2180 2270 { 2181 - release_saa(); 2271 + pci_unregister_driver(&stradis_driver); 2182 2272 printk(KERN_INFO "stradis: module cleanup complete\n"); 2183 2273 } 2184 2274 2185 - 2186 2275 module_init(stradis_init); 2187 2276 module_exit(stradis_exit); 2188 -
+7 -8
drivers/media/video/tda7432.c
··· 227 227 static int tda7432_write(struct i2c_client *client, int subaddr, int val) 228 228 { 229 229 unsigned char buffer[2]; 230 - v4l_dbg(2,client,"In tda7432_write\n"); 231 - v4l_dbg(1,client,"Writing %d 0x%x\n", subaddr, val); 230 + v4l_dbg(2, debug,client,"In tda7432_write\n"); 231 + v4l_dbg(1, debug,client,"Writing %d 0x%x\n", subaddr, val); 232 232 buffer[0] = subaddr; 233 233 buffer[1] = val; 234 234 if (2 != i2c_master_send(client,buffer,2)) { ··· 245 245 { 246 246 struct tda7432 *t = i2c_get_clientdata(client); 247 247 unsigned char buf[16]; 248 - v4l_dbg(2,client,"In tda7432_set\n"); 248 + v4l_dbg(2, debug,client,"In tda7432_set\n"); 249 249 250 - v4l_dbg(1,client, 250 + v4l_dbg(1, debug,client, 251 251 "tda7432: 7432_set(0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x)\n", 252 252 t->input,t->volume,t->bass,t->treble,t->lf,t->lr,t->rf,t->rr,t->loud); 253 253 buf[0] = TDA7432_IN; ··· 271 271 static void do_tda7432_init(struct i2c_client *client) 272 272 { 273 273 struct tda7432 *t = i2c_get_clientdata(client); 274 - v4l_dbg(2,client,"In tda7432_init\n"); 274 + v4l_dbg(2, debug,client,"In tda7432_init\n"); 275 275 276 276 t->input = TDA7432_STEREO_IN | /* Main (stereo) input */ 277 277 TDA7432_BASS_SYM | /* Symmetric bass cut */ ··· 300 300 struct tda7432 *t; 301 301 struct i2c_client *client; 302 302 303 - t = kmalloc(sizeof *t,GFP_KERNEL); 303 + t = kzalloc(sizeof *t,GFP_KERNEL); 304 304 if (!t) 305 305 return -ENOMEM; 306 - memset(t,0,sizeof *t); 307 306 308 307 client = &t->c; 309 308 memcpy(client,&client_template,sizeof(struct i2c_client)); ··· 339 340 unsigned int cmd, void *arg) 340 341 { 341 342 struct tda7432 *t = i2c_get_clientdata(client); 342 - v4l_dbg(2,client,"In tda7432_command\n"); 343 + v4l_dbg(2, debug,client,"In tda7432_command\n"); 343 344 if (debug>1) 344 345 v4l_i2c_print_ioctl(client,cmd); 345 346
+1 -2
drivers/media/video/tda9875.c
··· 232 232 struct i2c_client *client; 233 233 dprintk("In tda9875_attach\n"); 234 234 235 - t = kmalloc(sizeof *t,GFP_KERNEL); 235 + t = kzalloc(sizeof *t,GFP_KERNEL); 236 236 if (!t) 237 237 return -ENOMEM; 238 - memset(t,0,sizeof *t); 239 238 240 239 client = &t->c; 241 240 memcpy(client,&client_template,sizeof(struct i2c_client));
+1 -2
drivers/media/video/tda9887.c
··· 696 696 client_template.adapter = adap; 697 697 client_template.addr = addr; 698 698 699 - if (NULL == (t = kmalloc(sizeof(*t), GFP_KERNEL))) 699 + if (NULL == (t = kzalloc(sizeof(*t), GFP_KERNEL))) 700 700 return -ENOMEM; 701 - memset(t,0,sizeof(*t)); 702 701 703 702 t->client = client_template; 704 703 t->std = 0;
+2 -2
drivers/media/video/tea5767.c
··· 18 18 #define PREFIX "TEA5767 " 19 19 20 20 /* from tuner-core.c */ 21 - extern int debug; 21 + extern int tuner_debug; 22 22 23 23 /*****************************************************************************/ 24 24 ··· 249 249 if (5 != (rc = i2c_master_send(c, buffer, 5))) 250 250 tuner_warn("i2c i/o error: rc == %d (should be 5)\n", rc); 251 251 252 - if (debug) { 252 + if (tuner_debug) { 253 253 if (5 != (rc = i2c_master_recv(c, buffer, 5))) 254 254 tuner_warn("i2c i/o error: rc == %d (should be 5)\n", rc); 255 255 else
+1 -2
drivers/media/video/tea6420.c
··· 99 99 } 100 100 101 101 /* allocate memory for client structure */ 102 - client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); 102 + client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); 103 103 if (0 == client) { 104 104 return -ENOMEM; 105 105 } 106 - memset(client, 0x0, sizeof(struct i2c_client)); 107 106 108 107 /* fill client structure */ 109 108 memcpy(client, &client_template, sizeof(struct i2c_client));
+1 -2
drivers/media/video/tuner-3036.c
··· 193 193 static int __init 194 194 tuner3036_init(void) 195 195 { 196 - i2c_add_driver(&i2c_driver_tuner); 197 - return 0; 196 + return i2c_add_driver(&i2c_driver_tuner); 198 197 } 199 198 200 199 static void __exit
+9 -10
drivers/media/video/tuner-core.c
··· 41 41 static unsigned int show_i2c = 0; 42 42 43 43 /* insmod options used at runtime => read/write */ 44 - static unsigned int tuner_debug = 0; 45 - int debug = 0; 44 + static unsigned int tuner_debug_old = 0; 45 + int tuner_debug = 0; 46 46 47 47 static unsigned int tv_range[2] = { 44, 958 }; 48 48 static unsigned int radio_range[2] = { 65, 108 }; ··· 51 51 static char secam[] = "--"; 52 52 static char ntsc[] = "-"; 53 53 54 + 54 55 module_param(addr, int, 0444); 55 56 module_param(no_autodetect, int, 0444); 56 57 module_param(show_i2c, int, 0444); 57 58 /* Note: tuner_debug is deprecated and will be removed in 2.6.17 */ 58 - module_param(tuner_debug, int, 0444); 59 - module_param(debug, int, 0644); 60 - 59 + module_param_named(tuner_debug,tuner_debug_old, int, 0444); 60 + module_param_named(debug,tuner_debug, int, 0644); 61 61 module_param_string(pal, pal, sizeof(pal), 0644); 62 62 module_param_string(secam, secam, sizeof(secam), 0644); 63 63 module_param_string(ntsc, ntsc, sizeof(ntsc), 0644); ··· 410 410 client_template.adapter = adap; 411 411 client_template.addr = addr; 412 412 413 - t = kmalloc(sizeof(struct tuner), GFP_KERNEL); 413 + t = kzalloc(sizeof(struct tuner), GFP_KERNEL); 414 414 if (NULL == t) 415 415 return -ENOMEM; 416 - memset(t, 0, sizeof(struct tuner)); 417 416 memcpy(&t->i2c, &client_template, sizeof(struct i2c_client)); 418 417 i2c_set_clientdata(&t->i2c, t); 419 418 t->type = UNSET; 420 419 t->radio_if2 = 10700 * 1000; /* 10.7MHz - FM radio */ 421 420 t->audmode = V4L2_TUNER_MODE_STEREO; 422 421 t->mode_mask = T_UNINITIALIZED; 423 - if (tuner_debug) { 424 - debug = tuner_debug; 422 + if (tuner_debug_old) { 423 + tuner_debug = tuner_debug_old; 425 424 printk(KERN_ERR "tuner: tuner_debug is deprecated and will be removed in 2.6.17.\n"); 426 425 printk(KERN_ERR "tuner: use the debug option instead.\n"); 427 426 } ··· 551 552 { 552 553 struct tuner *t = i2c_get_clientdata(client); 553 554 554 - if (debug>1) 555 + if (tuner_debug>1) 555 556 v4l_i2c_print_ioctl(&(t->i2c),cmd); 556 557 557 558 switch (cmd) {
+27 -28
drivers/media/video/tvaudio.c
··· 159 159 unsigned char buffer[2]; 160 160 161 161 if (-1 == subaddr) { 162 - v4l_dbg(1, &chip->c, "%s: chip_write: 0x%x\n", 162 + v4l_dbg(1, debug, &chip->c, "%s: chip_write: 0x%x\n", 163 163 chip->c.name, val); 164 164 chip->shadow.bytes[1] = val; 165 165 buffer[0] = val; ··· 169 169 return -1; 170 170 } 171 171 } else { 172 - v4l_dbg(1, &chip->c, "%s: chip_write: reg%d=0x%x\n", 172 + v4l_dbg(1, debug, &chip->c, "%s: chip_write: reg%d=0x%x\n", 173 173 chip->c.name, subaddr, val); 174 174 chip->shadow.bytes[subaddr+1] = val; 175 175 buffer[0] = subaddr; ··· 204 204 chip->c.name); 205 205 return -1; 206 206 } 207 - v4l_dbg(1, &chip->c, "%s: chip_read: 0x%x\n",chip->c.name, buffer); 207 + v4l_dbg(1, debug, &chip->c, "%s: chip_read: 0x%x\n",chip->c.name, buffer); 208 208 return buffer; 209 209 } 210 210 ··· 222 222 v4l_warn(&chip->c, "%s: I/O error (read2)\n", chip->c.name); 223 223 return -1; 224 224 } 225 - v4l_dbg(1, &chip->c, "%s: chip_read2: reg%d=0x%x\n", 225 + v4l_dbg(1, debug, &chip->c, "%s: chip_read2: reg%d=0x%x\n", 226 226 chip->c.name, subaddr,read[0]); 227 227 return read[0]; 228 228 } ··· 235 235 return 0; 236 236 237 237 /* update our shadow register set; print bytes if (debug > 0) */ 238 - v4l_dbg(1, &chip->c, "%s: chip_cmd(%s): reg=%d, data:", 238 + v4l_dbg(1, debug, &chip->c, "%s: chip_cmd(%s): reg=%d, data:", 239 239 chip->c.name, name,cmd->bytes[0]); 240 240 for (i = 1; i < cmd->count; i++) { 241 241 if (debug) ··· 274 274 275 275 daemonize("%s", chip->c.name); 276 276 allow_signal(SIGTERM); 277 - v4l_dbg(1, &chip->c, "%s: thread started\n", chip->c.name); 277 + v4l_dbg(1, debug, &chip->c, "%s: thread started\n", chip->c.name); 278 278 279 279 for (;;) { 280 280 add_wait_queue(&chip->wq, &wait); ··· 286 286 try_to_freeze(); 287 287 if (chip->done || signal_pending(current)) 288 288 break; 289 - v4l_dbg(1, &chip->c, "%s: thread wakeup\n", chip->c.name); 289 + v4l_dbg(1, debug, &chip->c, "%s: thread wakeup\n", chip->c.name); 290 290 291 291 /* don't do anything for radio or if mode != auto */ 292 292 if (chip->radio || chip->mode != 0) ··· 299 299 mod_timer(&chip->wt, jiffies+2*HZ); 300 300 } 301 301 302 - v4l_dbg(1, &chip->c, "%s: thread exiting\n", chip->c.name); 302 + v4l_dbg(1, debug, &chip->c, "%s: thread exiting\n", chip->c.name); 303 303 complete_and_exit(&chip->texit, 0); 304 304 return 0; 305 305 } ··· 312 312 if (mode == chip->prevmode) 313 313 return; 314 314 315 - v4l_dbg(1, &chip->c, "%s: thread checkmode\n", chip->c.name); 315 + v4l_dbg(1, debug, &chip->c, "%s: thread checkmode\n", chip->c.name); 316 316 chip->prevmode = mode; 317 317 318 318 if (mode & VIDEO_SOUND_STEREO) ··· 359 359 if (val & TDA9840_ST_STEREO) 360 360 mode |= VIDEO_SOUND_STEREO; 361 361 362 - v4l_dbg(1, &chip->c, "tda9840_getmode(): raw chip read: %d, return: %d\n", 362 + v4l_dbg(1, debug, &chip->c, "tda9840_getmode(): raw chip read: %d, return: %d\n", 363 363 val, mode); 364 364 return mode; 365 365 } ··· 655 655 mode |= VIDEO_SOUND_STEREO; 656 656 if (val & TDA9873_DUAL) 657 657 mode |= VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; 658 - v4l_dbg(1, &chip->c, "tda9873_getmode(): raw chip read: %d, return: %d\n", 658 + v4l_dbg(1, debug, &chip->c, "tda9873_getmode(): raw chip read: %d, return: %d\n", 659 659 val, mode); 660 660 return mode; 661 661 } ··· 666 666 /* int adj_data = chip->shadow.bytes[TDA9873_AD+1] ; */ 667 667 668 668 if ((sw_data & TDA9873_INP_MASK) != TDA9873_INTERNAL) { 669 - v4l_dbg(1, &chip->c, "tda9873_setmode(): external input\n"); 669 + v4l_dbg(1, debug, &chip->c, "tda9873_setmode(): external input\n"); 670 670 return; 671 671 } 672 672 673 - v4l_dbg(1, &chip->c, "tda9873_setmode(): chip->shadow.bytes[%d] = %d\n", TDA9873_SW+1, chip->shadow.bytes[TDA9873_SW+1]); 674 - v4l_dbg(1, &chip->c, "tda9873_setmode(): sw_data = %d\n", sw_data); 673 + v4l_dbg(1, debug, &chip->c, "tda9873_setmode(): chip->shadow.bytes[%d] = %d\n", TDA9873_SW+1, chip->shadow.bytes[TDA9873_SW+1]); 674 + v4l_dbg(1, debug, &chip->c, "tda9873_setmode(): sw_data = %d\n", sw_data); 675 675 676 676 switch (mode) { 677 677 case VIDEO_SOUND_MONO: ··· 692 692 } 693 693 694 694 chip_write(chip, TDA9873_SW, sw_data); 695 - v4l_dbg(1, &chip->c, "tda9873_setmode(): req. mode %d; chip_write: %d\n", 695 + v4l_dbg(1, debug, &chip->c, "tda9873_setmode(): req. mode %d; chip_write: %d\n", 696 696 mode, sw_data); 697 697 } 698 698 ··· 831 831 chip_write(chip, TDA9874A_SDACOSR, (tda9874a_mode) ? 0x81:0x80); 832 832 chip_write(chip, TDA9874A_AOSR, 0x00); /* or 0x10 */ 833 833 } 834 - v4l_dbg(1, &chip->c, "tda9874a_setup(): %s [0x%02X].\n", 834 + v4l_dbg(1, debug, &chip->c, "tda9874a_setup(): %s [0x%02X].\n", 835 835 tda9874a_modelist[tda9874a_STD].name,tda9874a_STD); 836 836 return 1; 837 837 } ··· 874 874 mode |= VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; 875 875 } 876 876 877 - v4l_dbg(1, &chip->c, "tda9874a_getmode(): DSR=0x%X, NSR=0x%X, NECR=0x%X, return: %d.\n", 877 + v4l_dbg(1, debug, &chip->c, "tda9874a_getmode(): DSR=0x%X, NSR=0x%X, NECR=0x%X, return: %d.\n", 878 878 dsr, nsr, necr, mode); 879 879 return mode; 880 880 } ··· 920 920 chip_write(chip, TDA9874A_AOSR, aosr); 921 921 chip_write(chip, TDA9874A_MDACOSR, mdacosr); 922 922 923 - v4l_dbg(1, &chip->c, "tda9874a_setmode(): req. mode %d; AOSR=0x%X, MDACOSR=0x%X.\n", 923 + v4l_dbg(1, debug, &chip->c, "tda9874a_setmode(): req. mode %d; AOSR=0x%X, MDACOSR=0x%X.\n", 924 924 mode, aosr, mdacosr); 925 925 926 926 } else { /* dic == 0x07 */ ··· 955 955 chip_write(chip, TDA9874A_FMMR, fmmr); 956 956 chip_write(chip, TDA9874A_AOSR, aosr); 957 957 958 - v4l_dbg(1, &chip->c, "tda9874a_setmode(): req. mode %d; FMMR=0x%X, AOSR=0x%X.\n", 958 + v4l_dbg(1, debug, &chip->c, "tda9874a_setmode(): req. mode %d; FMMR=0x%X, AOSR=0x%X.\n", 959 959 mode, fmmr, aosr); 960 960 } 961 961 } ··· 969 969 if(-1 == (sic = chip_read2(chip,TDA9874A_SIC))) 970 970 return 0; 971 971 972 - v4l_dbg(1, &chip->c, "tda9874a_checkit(): DIC=0x%X, SIC=0x%X.\n", dic, sic); 972 + v4l_dbg(1, debug, &chip->c, "tda9874a_checkit(): DIC=0x%X, SIC=0x%X.\n", dic, sic); 973 973 974 974 if((dic == 0x11)||(dic == 0x07)) { 975 975 v4l_info(&chip->c, "found tda9874%s.\n", (dic == 0x11) ? "a":"h"); ··· 1184 1184 }else if (!(val & TA8874Z_B0)){ 1185 1185 mode |= VIDEO_SOUND_STEREO; 1186 1186 } 1187 - /* v4l_dbg(1, &chip->c, "ta8874z_getmode(): raw chip read: 0x%02x, return: 0x%02x\n", val, mode); */ 1187 + /* v4l_dbg(1, debug, &chip->c, "ta8874z_getmode(): raw chip read: 0x%02x, return: 0x%02x\n", val, mode); */ 1188 1188 return mode; 1189 1189 } 1190 1190 ··· 1197 1197 { 1198 1198 int update = 1; 1199 1199 audiocmd *t = NULL; 1200 - v4l_dbg(1, &chip->c, "ta8874z_setmode(): mode: 0x%02x\n", mode); 1200 + v4l_dbg(1, debug, &chip->c, "ta8874z_setmode(): mode: 0x%02x\n", mode); 1201 1201 1202 1202 switch(mode){ 1203 1203 case VIDEO_SOUND_MONO: ··· 1468 1468 struct CHIPSTATE *chip; 1469 1469 struct CHIPDESC *desc; 1470 1470 1471 - chip = kmalloc(sizeof(*chip),GFP_KERNEL); 1471 + chip = kzalloc(sizeof(*chip),GFP_KERNEL); 1472 1472 if (!chip) 1473 1473 return -ENOMEM; 1474 - memset(chip,0,sizeof(*chip)); 1475 1474 memcpy(&chip->c,&client_template,sizeof(struct i2c_client)); 1476 1475 chip->c.adapter = adap; 1477 1476 chip->c.addr = addr; 1478 1477 i2c_set_clientdata(&chip->c, chip); 1479 1478 1480 1479 /* find description for the chip */ 1481 - v4l_dbg(1, &chip->c, "chip found @ 0x%x\n", addr<<1); 1480 + v4l_dbg(1, debug, &chip->c, "chip found @ 0x%x\n", addr<<1); 1482 1481 for (desc = chiplist; desc->name != NULL; desc++) { 1483 1482 if (0 == *(desc->insmodopt)) 1484 1483 continue; ··· 1489 1490 break; 1490 1491 } 1491 1492 if (desc->name == NULL) { 1492 - v4l_dbg(1, &chip->c, "no matching chip description found\n"); 1493 + v4l_dbg(1, debug, &chip->c, "no matching chip description found\n"); 1493 1494 return -EIO; 1494 1495 } 1495 1496 v4l_info(&chip->c, "%s found @ 0x%x (%s)\n", desc->name, addr<<1, adap->name); 1496 1497 if (desc->flags) { 1497 - v4l_dbg(1, &chip->c, "matches:%s%s%s.\n", 1498 + v4l_dbg(1, debug, &chip->c, "matches:%s%s%s.\n", 1498 1499 (desc->flags & CHIP_HAS_VOLUME) ? " volume" : "", 1499 1500 (desc->flags & CHIP_HAS_BASSTREBLE) ? " bass/treble" : "", 1500 1501 (desc->flags & CHIP_HAS_INPUTSEL) ? " audiomux" : ""); ··· 1582 1583 struct CHIPSTATE *chip = i2c_get_clientdata(client); 1583 1584 struct CHIPDESC *desc = chiplist + chip->type; 1584 1585 1585 - v4l_dbg(1, &chip->c, "%s: chip_command 0x%x\n", chip->c.name, cmd); 1586 + v4l_dbg(1, debug, &chip->c, "%s: chip_command 0x%x\n", chip->c.name, cmd); 1586 1587 1587 1588 switch (cmd) { 1588 1589 case AUDC_SET_INPUT:
+2 -4
drivers/media/video/tveeprom.c
··· 719 719 720 720 switch (cmd) { 721 721 case 0: 722 - buf = kmalloc(256,GFP_KERNEL); 723 - memset(buf,0,256); 722 + buf = kzalloc(256,GFP_KERNEL); 724 723 tveeprom_read(client,buf,256); 725 724 tveeprom_hauppauge_analog(client, &eeprom,buf); 726 725 kfree(buf); ··· 742 743 { 743 744 struct i2c_client *client; 744 745 745 - client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); 746 + client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); 746 747 if (NULL == client) 747 748 return -ENOMEM; 748 - memset(client, 0, sizeof(struct i2c_client)); 749 749 client->addr = address; 750 750 client->adapter = adapter; 751 751 client->driver = &i2c_driver_tveeprom;
+1 -2
drivers/media/video/tvp5150.c
··· 1074 1074 return -ENOMEM; 1075 1075 memcpy(c, &client_template, sizeof(struct i2c_client)); 1076 1076 1077 - core = kmalloc(sizeof(struct tvp5150), GFP_KERNEL); 1077 + core = kzalloc(sizeof(struct tvp5150), GFP_KERNEL); 1078 1078 if (core == 0) { 1079 1079 kfree(c); 1080 1080 return -ENOMEM; 1081 1081 } 1082 - memset(core, 0, sizeof(struct tvp5150)); 1083 1082 i2c_set_clientdata(c, core); 1084 1083 1085 1084 rv = i2c_attach_client(c);
+8 -16
drivers/media/video/v4l1-compat.c
··· 305 305 { 306 306 struct video_capability *cap = arg; 307 307 308 - cap2 = kmalloc(sizeof(*cap2),GFP_KERNEL); 308 + cap2 = kzalloc(sizeof(*cap2),GFP_KERNEL); 309 309 memset(cap, 0, sizeof(*cap)); 310 - memset(cap2, 0, sizeof(*cap2)); 311 310 memset(&fbuf2, 0, sizeof(fbuf2)); 312 311 313 312 err = drv(inode, file, VIDIOC_QUERYCAP, cap2); ··· 421 422 { 422 423 struct video_window *win = arg; 423 424 424 - fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL); 425 + fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL); 425 426 memset(win,0,sizeof(*win)); 426 - memset(fmt2,0,sizeof(*fmt2)); 427 427 428 428 fmt2->type = V4L2_BUF_TYPE_VIDEO_OVERLAY; 429 429 err = drv(inode, file, VIDIOC_G_FMT, fmt2); ··· 459 461 struct video_window *win = arg; 460 462 int err1,err2; 461 463 462 - fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL); 463 - memset(fmt2,0,sizeof(*fmt2)); 464 + fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL); 464 465 fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 465 466 drv(inode, file, VIDIOC_STREAMOFF, &fmt2->type); 466 467 err1 = drv(inode, file, VIDIOC_G_FMT, fmt2); ··· 592 595 pict->whiteness = get_v4l_control(inode, file, 593 596 V4L2_CID_WHITENESS, drv); 594 597 595 - fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL); 596 - memset(fmt2,0,sizeof(*fmt2)); 598 + fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL); 597 599 fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 598 600 err = drv(inode, file, VIDIOC_G_FMT, fmt2); 599 601 if (err < 0) { ··· 618 622 set_v4l_control(inode, file, 619 623 V4L2_CID_WHITENESS, pict->whiteness, drv); 620 624 621 - fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL); 622 - memset(fmt2,0,sizeof(*fmt2)); 625 + fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL); 623 626 fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 624 627 err = drv(inode, file, VIDIOC_G_FMT, fmt2); 625 628 if (err < 0) ··· 841 846 { 842 847 struct video_mmap *mm = arg; 843 848 844 - fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL); 849 + fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL); 845 850 memset(&buf2,0,sizeof(buf2)); 846 - memset(fmt2,0,sizeof(*fmt2)); 847 851 848 852 fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 849 853 err = drv(inode, file, VIDIOC_G_FMT, fmt2); ··· 936 942 { 937 943 struct vbi_format *fmt = arg; 938 944 939 - fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL); 940 - memset(fmt2, 0, sizeof(*fmt2)); 945 + fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL); 941 946 fmt2->type = V4L2_BUF_TYPE_VBI_CAPTURE; 942 947 943 948 err = drv(inode, file, VIDIOC_G_FMT, fmt2); ··· 968 975 break; 969 976 } 970 977 971 - fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL); 972 - memset(fmt2, 0, sizeof(*fmt2)); 978 + fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL); 973 979 974 980 fmt2->type = V4L2_BUF_TYPE_VBI_CAPTURE; 975 981 fmt2->fmt.vbi.samples_per_line = fmt->samples_per_line;
+3 -6
drivers/media/video/video-buf.c
··· 52 52 struct page *pg; 53 53 int i; 54 54 55 - sglist = kmalloc(sizeof(struct scatterlist)*nr_pages, GFP_KERNEL); 55 + sglist = kcalloc(nr_pages, sizeof(struct scatterlist), GFP_KERNEL); 56 56 if (NULL == sglist) 57 57 return NULL; 58 - memset(sglist,0,sizeof(struct scatterlist)*nr_pages); 59 58 for (i = 0; i < nr_pages; i++, virt += PAGE_SIZE) { 60 59 pg = vmalloc_to_page(virt); 61 60 if (NULL == pg) ··· 79 80 80 81 if (NULL == pages[0]) 81 82 return NULL; 82 - sglist = kmalloc(sizeof(*sglist) * nr_pages, GFP_KERNEL); 83 + sglist = kcalloc(nr_pages, sizeof(*sglist), GFP_KERNEL); 83 84 if (NULL == sglist) 84 85 return NULL; 85 - memset(sglist, 0, sizeof(*sglist) * nr_pages); 86 86 87 87 if (NULL == pages[0]) 88 88 goto nopage; ··· 282 284 { 283 285 struct videobuf_buffer *vb; 284 286 285 - vb = kmalloc(size,GFP_KERNEL); 287 + vb = kzalloc(size,GFP_KERNEL); 286 288 if (NULL != vb) { 287 - memset(vb,0,size); 288 289 videobuf_dma_init(&vb->dma); 289 290 init_waitqueue_head(&vb->done); 290 291 vb->magic = MAGIC_BUFFER;
+2 -9
drivers/media/video/videocodec.c
··· 124 124 if (res == 0) { 125 125 dprintk(3, "videocodec_attach '%s'\n", 126 126 codec->name); 127 - ptr = (struct attached_list *) 128 - kmalloc(sizeof(struct attached_list), 129 - GFP_KERNEL); 127 + ptr = kzalloc(sizeof(struct attached_list), GFP_KERNEL); 130 128 if (!ptr) { 131 129 dprintk(1, 132 130 KERN_ERR 133 131 "videocodec_attach: no memory\n"); 134 132 goto out_kfree; 135 133 } 136 - memset(ptr, 0, 137 - sizeof(struct attached_list)); 138 134 ptr->codec = codec; 139 135 140 136 a = h->list; ··· 245 249 "videocodec: register '%s', type: %x, flags %lx, magic %lx\n", 246 250 codec->name, codec->type, codec->flags, codec->magic); 247 251 248 - ptr = 249 - (struct codec_list *) kmalloc(sizeof(struct codec_list), 250 - GFP_KERNEL); 252 + ptr = kzalloc(sizeof(struct codec_list), GFP_KERNEL); 251 253 if (!ptr) { 252 254 dprintk(1, KERN_ERR "videocodec_register: no memory\n"); 253 255 return -ENOMEM; 254 256 } 255 - memset(ptr, 0, sizeof(struct codec_list)); 256 257 ptr->codec = codec; 257 258 258 259 if (!h) {
+1 -4
drivers/media/video/videodev.c
··· 52 52 { 53 53 struct video_device *vfd; 54 54 55 - vfd = kmalloc(sizeof(*vfd),GFP_KERNEL); 56 - if (NULL == vfd) 57 - return NULL; 58 - memset(vfd,0,sizeof(*vfd)); 55 + vfd = kzalloc(sizeof(*vfd),GFP_KERNEL); 59 56 return vfd; 60 57 } 61 58
+1 -3
drivers/media/video/vino.c
··· 4499 4499 dma_addr_t dma_dummy_address; 4500 4500 int i; 4501 4501 4502 - vino_drvdata = (struct vino_settings *) 4503 - kmalloc(sizeof(struct vino_settings), GFP_KERNEL); 4502 + vino_drvdata = kzalloc(sizeof(struct vino_settings), GFP_KERNEL); 4504 4503 if (!vino_drvdata) { 4505 4504 vino_module_cleanup(vino_init_stage); 4506 4505 return -ENOMEM; 4507 4506 } 4508 - memset(vino_drvdata, 0, sizeof(struct vino_settings)); 4509 4507 vino_init_stage++; 4510 4508 4511 4509 /* create a dummy dma descriptor */
+2 -5
drivers/media/video/vpx3220.c
··· 621 621 (adapter, I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA)) 622 622 return 0; 623 623 624 - client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); 624 + client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); 625 625 if (client == NULL) { 626 626 return -ENOMEM; 627 627 } 628 - 629 - memset(client, 0, sizeof(struct i2c_client)); 630 628 631 629 client->addr = address; 632 630 client->adapter = adapter; ··· 673 675 sizeof(I2C_NAME(client))); 674 676 } 675 677 676 - decoder = kmalloc(sizeof(struct vpx3220), GFP_KERNEL); 678 + decoder = kzalloc(sizeof(struct vpx3220), GFP_KERNEL); 677 679 if (decoder == NULL) { 678 680 kfree(client); 679 681 return -ENOMEM; 680 682 } 681 - memset(decoder, 0, sizeof(struct vpx3220)); 682 683 decoder->norm = VIDEO_MODE_PAL; 683 684 decoder->input = 0; 684 685 decoder->enable = 1;
+1 -2
drivers/media/video/wm8775.c
··· 166 166 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) 167 167 return 0; 168 168 169 - client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); 169 + client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); 170 170 if (client == 0) 171 171 return -ENOMEM; 172 172 173 - memset(client, 0, sizeof(struct i2c_client)); 174 173 client->addr = address; 175 174 client->adapter = adapter; 176 175 client->driver = &i2c_driver;
+1 -2
drivers/media/video/zoran_card.c
··· 1050 1050 /* allocate memory *before* doing anything to the hardware 1051 1051 * in case allocation fails */ 1052 1052 mem_needed = BUZ_NUM_STAT_COM * 4; 1053 - mem = (unsigned long) kmalloc(mem_needed, GFP_KERNEL); 1053 + mem = kzalloc(mem_needed, GFP_KERNEL); 1054 1054 vdev = (void *) kmalloc(sizeof(struct video_device), GFP_KERNEL); 1055 1055 if (!mem || !vdev) { 1056 1056 dprintk(1, ··· 1061 1061 kfree((void *)mem); 1062 1062 return -ENOMEM; 1063 1063 } 1064 - memset((void *) mem, 0, mem_needed); 1065 1064 zr->stat_com = (u32 *) mem; 1066 1065 for (j = 0; j < BUZ_NUM_STAT_COM; j++) { 1067 1066 zr->stat_com[j] = 1; /* mark as unavailable to zr36057 */
+1 -2
drivers/media/video/zoran_driver.c
··· 1345 1345 ZR_DEVNAME(zr), current->comm, current->pid, zr->user); 1346 1346 1347 1347 /* now, create the open()-specific file_ops struct */ 1348 - fh = kmalloc(sizeof(struct zoran_fh), GFP_KERNEL); 1348 + fh = kzalloc(sizeof(struct zoran_fh), GFP_KERNEL); 1349 1349 if (!fh) { 1350 1350 dprintk(1, 1351 1351 KERN_ERR ··· 1354 1354 res = -ENOMEM; 1355 1355 goto open_unlock_and_return; 1356 1356 } 1357 - memset(fh, 0, sizeof(struct zoran_fh)); 1358 1357 /* used to be BUZ_MAX_WIDTH/HEIGHT, but that gives overflows 1359 1358 * on norm-change! */ 1360 1359 fh->overlay_mask =
+1 -2
drivers/media/video/zr36016.c
··· 451 451 return -ENOSPC; 452 452 } 453 453 //mem structure init 454 - codec->data = ptr = kmalloc(sizeof(struct zr36016), GFP_KERNEL); 454 + codec->data = ptr = kzalloc(sizeof(struct zr36016), GFP_KERNEL); 455 455 if (NULL == ptr) { 456 456 dprintk(1, KERN_ERR "zr36016: Can't get enough memory!\n"); 457 457 return -ENOMEM; 458 458 } 459 - memset(ptr, 0, sizeof(struct zr36016)); 460 459 461 460 snprintf(ptr->name, sizeof(ptr->name), "zr36016[%d]", 462 461 zr36016_codecs);
+1 -2
drivers/media/video/zr36050.c
··· 813 813 return -ENOSPC; 814 814 } 815 815 //mem structure init 816 - codec->data = ptr = kmalloc(sizeof(struct zr36050), GFP_KERNEL); 816 + codec->data = ptr = kzalloc(sizeof(struct zr36050), GFP_KERNEL); 817 817 if (NULL == ptr) { 818 818 dprintk(1, KERN_ERR "zr36050: Can't get enough memory!\n"); 819 819 return -ENOMEM; 820 820 } 821 - memset(ptr, 0, sizeof(struct zr36050)); 822 821 823 822 snprintf(ptr->name, sizeof(ptr->name), "zr36050[%d]", 824 823 zr36050_codecs);
+1 -2
drivers/media/video/zr36060.c
··· 919 919 return -ENOSPC; 920 920 } 921 921 //mem structure init 922 - codec->data = ptr = kmalloc(sizeof(struct zr36060), GFP_KERNEL); 922 + codec->data = ptr = kzalloc(sizeof(struct zr36060), GFP_KERNEL); 923 923 if (NULL == ptr) { 924 924 dprintk(1, KERN_ERR "zr36060: Can't get enough memory!\n"); 925 925 return -ENOMEM; 926 926 } 927 - memset(ptr, 0, sizeof(struct zr36060)); 928 927 929 928 snprintf(ptr->name, sizeof(ptr->name), "zr36060[%d]", 930 929 zr36060_codecs);
+2 -2
include/media/tuner.h
··· 218 218 printk(KERN_INFO "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \ 219 219 i2c_adapter_id(t->i2c.adapter), t->i2c.addr , ##arg); } while (0) 220 220 #define tuner_dbg(fmt, arg...) do {\ 221 - extern int debug; \ 222 - if (debug) \ 221 + extern int tuner_debug; \ 222 + if (tuner_debug) \ 223 223 printk(KERN_DEBUG "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \ 224 224 i2c_adapter_id(t->i2c.adapter), t->i2c.addr , ##arg); } while (0) 225 225
+1 -2
include/media/v4l2-common.h
··· 49 49 50 50 /* These three macros assume that the debug level is set with a module 51 51 parameter called 'debug'. */ 52 - #define v4l_dbg(level, client, fmt, arg...) \ 52 + #define v4l_dbg(level, debug, client, fmt, arg...) \ 53 53 do { \ 54 - extern int debug; \ 55 54 if (debug >= (level)) \ 56 55 v4l_client_printk(KERN_DEBUG, client, fmt , ## arg); \ 57 56 } while (0)