Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6

* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6: (25 commits)
em28xx: remove backward compat macro added on a previous fix
V4L/DVB (9748): em28xx: fix compile warning
V4L/DVB (9743): em28xx: fix oops audio
V4L/DVB (9742): em28xx-alsa: implement another locking schema
V4L/DVB (9732): sms1xxx: use new firmware for Hauppauge WinTV MiniStick
V4L/DVB (9691): gspca: Move the video device to a separate area.
V4L/DVB (9690): gspca: Lock the subdrivers via module_get/put.
V4L/DVB (9689): gspca: Memory leak when disconnect while streaming.
V4L/DVB (9668): em28xx: fix a race condition with hald
V4L/DVB (9664): af9015: don't reconnect device in USB-bus
V4L/DVB (9647): em28xx: void having two concurrent control URB's
V4L/DVB (9646): em28xx: avoid allocating/dealocating memory on every control urb
V4L/DVB (9645): em28xx: Avoid memory leaks if registration fails
V4L/DVB (9639): Make dib0700 remote control support work with firmware v1.20
V4L/DVB (9635): v4l: s2255drv fix firmware test on big-endian
V4L/DVB (9634): Make sure the i2c gate is open before powering down tuner
V4L/DVB (9632): make em28xx aux audio input work
V4L/DVB (9631): Make s2api work for ATSC support
V4L/DVB (9627): em28xx: Avoid i2c register error for boards without eeprom
V4L/DVB (9608): Fix section mismatch warning for dm1105 during make
...

+410 -149
+1 -1
drivers/media/dvb/dm1105/dm1105.c
··· 376 376 pci_free_consistent(dm1105dvb->pdev, 6*DM1105_DMA_BYTES, dm1105dvb->ts_buf, dm1105dvb->dma_addr); 377 377 } 378 378 379 - static void __devinit dm1105dvb_enable_irqs(struct dm1105dvb *dm1105dvb) 379 + static void dm1105dvb_enable_irqs(struct dm1105dvb *dm1105dvb) 380 380 { 381 381 outb(INTMAK_ALLMASK, dm_io_mem(DM1105_INTMAK)); 382 382 outb(1, dm_io_mem(DM1105_CR));
+4 -1
drivers/media/dvb/dvb-core/dvb_frontend.c
··· 585 585 if (fe->ops.set_voltage) 586 586 fe->ops.set_voltage(fe, SEC_VOLTAGE_OFF); 587 587 if (fe->ops.tuner_ops.sleep) { 588 + if (fe->ops.i2c_gate_ctrl) 589 + fe->ops.i2c_gate_ctrl(fe, 1); 588 590 fe->ops.tuner_ops.sleep(fe); 589 591 if (fe->ops.i2c_gate_ctrl) 590 592 fe->ops.i2c_gate_ctrl(fe, 0); ··· 936 934 int is_legacy_delivery_system(fe_delivery_system_t s) 937 935 { 938 936 if((s == SYS_UNDEFINED) || (s == SYS_DVBC_ANNEX_AC) || 939 - (s == SYS_DVBC_ANNEX_B) || (s == SYS_DVBT) || (s == SYS_DVBS)) 937 + (s == SYS_DVBC_ANNEX_B) || (s == SYS_DVBT) || (s == SYS_DVBS) || 938 + (s == SYS_ATSC)) 940 939 return 1; 941 940 942 941 return 0;
+2 -6
drivers/media/dvb/dvb-usb/af9015.c
··· 681 681 goto error; 682 682 } 683 683 684 - /* firmware is running, reconnect device in the usb bus */ 685 - req.cmd = RECONNECT_USB; 686 - ret = af9015_rw_udev(udev, &req); 687 - if (ret) 688 - err("reconnect failed: %d", ret); 689 - 690 684 error: 691 685 return ret; 692 686 } ··· 1202 1208 .usb_ctrl = DEVICE_SPECIFIC, 1203 1209 .download_firmware = af9015_download_firmware, 1204 1210 .firmware = "dvb-usb-af9015.fw", 1211 + .no_reconnect = 1, 1205 1212 1206 1213 .size_of_priv = sizeof(struct af9015_state), \ 1207 1214 ··· 1301 1306 .usb_ctrl = DEVICE_SPECIFIC, 1302 1307 .download_firmware = af9015_download_firmware, 1303 1308 .firmware = "dvb-usb-af9015.fw", 1309 + .no_reconnect = 1, 1304 1310 1305 1311 .size_of_priv = sizeof(struct af9015_state), \ 1306 1312
+4 -1
drivers/media/dvb/dvb-usb/dib0700.h
··· 22 22 23 23 #define REQUEST_I2C_READ 0x2 24 24 #define REQUEST_I2C_WRITE 0x3 25 - #define REQUEST_POLL_RC 0x4 25 + #define REQUEST_POLL_RC 0x4 /* deprecated in firmware v1.20 */ 26 26 #define REQUEST_JUMPRAM 0x8 27 27 #define REQUEST_SET_CLOCK 0xB 28 28 #define REQUEST_SET_GPIO 0xC ··· 40 40 u16 mt2060_if1[2]; 41 41 u8 rc_toggle; 42 42 u8 rc_counter; 43 + u8 rc_func_version; 43 44 u8 is_dib7000pc; 44 45 u8 fw_use_new_i2c_api; 45 46 u8 disable_streaming_master_mode; 46 47 }; 47 48 49 + extern int dib0700_get_version(struct dvb_usb_device *d, u32 *hwversion, 50 + u32 *romversion, u32 *ramversion, u32 *fwtype); 48 51 extern int dib0700_set_gpio(struct dvb_usb_device *, enum dib07x0_gpios gpio, u8 gpio_dir, u8 gpio_val); 49 52 extern int dib0700_ctrl_clock(struct dvb_usb_device *d, u32 clk_MHz, u8 clock_out_gp3); 50 53 extern int dib0700_ctrl_rd(struct dvb_usb_device *d, u8 *tx, u8 txlen, u8 *rx, u8 rxlen);
+16
drivers/media/dvb/dvb-usb/dib0700_core.c
··· 19 19 20 20 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); 21 21 22 + 23 + int dib0700_get_version(struct dvb_usb_device *d, u32 *hwversion, 24 + u32 *romversion, u32 *ramversion, u32 *fwtype) 25 + { 26 + u8 b[16]; 27 + int ret = usb_control_msg(d->udev, usb_rcvctrlpipe(d->udev, 0), 28 + REQUEST_GET_VERSION, 29 + USB_TYPE_VENDOR | USB_DIR_IN, 0, 0, 30 + b, sizeof(b), USB_CTRL_GET_TIMEOUT); 31 + *hwversion = (b[0] << 24) | (b[1] << 16) | (b[2] << 8) | b[3]; 32 + *romversion = (b[4] << 24) | (b[5] << 16) | (b[6] << 8) | b[7]; 33 + *ramversion = (b[8] << 24) | (b[9] << 16) | (b[10] << 8) | b[11]; 34 + *fwtype = (b[12] << 24) | (b[13] << 16) | (b[14] << 8) | b[15]; 35 + return ret; 36 + } 37 + 22 38 /* expecting rx buffer: request data[0] data[1] ... data[2] */ 23 39 static int dib0700_ctrl_wr(struct dvb_usb_device *d, u8 *tx, u8 txlen) 24 40 {
+138 -1
drivers/media/dvb/dvb-usb/dib0700_devices.c
··· 38 38 } 39 39 }; 40 40 41 + 41 42 static struct dibx000_agc_config bristol_dib3000p_mt2060_agc_config = { 42 43 .band_caps = BAND_VHF | BAND_UHF, 43 44 .setup = (1 << 8) | (5 << 5) | (0 << 4) | (0 << 3) | (0 << 2) | (2 << 0), ··· 452 451 453 452 /* Number of keypresses to ignore before start repeating */ 454 453 #define RC_REPEAT_DELAY 2 454 + #define RC_REPEAT_DELAY_V1_20 5 455 455 456 - static int dib0700_rc_query(struct dvb_usb_device *d, u32 *event, int *state) 456 + 457 + 458 + /* Used by firmware versions < 1.20 (deprecated) */ 459 + static int dib0700_rc_query_legacy(struct dvb_usb_device *d, u32 *event, 460 + int *state) 457 461 { 458 462 u8 key[4]; 459 463 int i; ··· 533 527 err("Unknown remote controller key: %2X %2X %2X %2X", (int) key[3-2], (int) key[3-3], (int) key[3-1], (int) key[3]); 534 528 d->last_event = 0; 535 529 return 0; 530 + } 531 + 532 + /* This is the structure of the RC response packet starting in firmware 1.20 */ 533 + struct dib0700_rc_response { 534 + u8 report_id; 535 + u8 data_state; 536 + u8 system_msb; 537 + u8 system_lsb; 538 + u8 data; 539 + u8 not_data; 540 + }; 541 + 542 + /* This supports the new IR response format for firmware v1.20 */ 543 + static int dib0700_rc_query_v1_20(struct dvb_usb_device *d, u32 *event, 544 + int *state) 545 + { 546 + struct dvb_usb_rc_key *keymap = d->props.rc_key_map; 547 + struct dib0700_state *st = d->priv; 548 + struct dib0700_rc_response poll_reply; 549 + u8 buf[6]; 550 + int i; 551 + int status; 552 + int actlen; 553 + int found = 0; 554 + 555 + /* Set initial results in case we exit the function early */ 556 + *event = 0; 557 + *state = REMOTE_NO_KEY_PRESSED; 558 + 559 + /* Firmware v1.20 provides RC data via bulk endpoint 1 */ 560 + status = usb_bulk_msg(d->udev, usb_rcvbulkpipe(d->udev, 1), buf, 561 + sizeof(buf), &actlen, 50); 562 + if (status < 0) { 563 + /* No data available (meaning no key press) */ 564 + return 0; 565 + } 566 + 567 + if (actlen != sizeof(buf)) { 568 + /* We didn't get back the 6 byte message we expected */ 569 + err("Unexpected RC response size [%d]", actlen); 570 + return -1; 571 + } 572 + 573 + poll_reply.report_id = buf[0]; 574 + poll_reply.data_state = buf[1]; 575 + poll_reply.system_msb = buf[2]; 576 + poll_reply.system_lsb = buf[3]; 577 + poll_reply.data = buf[4]; 578 + poll_reply.not_data = buf[5]; 579 + 580 + /* 581 + info("rid=%02x ds=%02x sm=%02x sl=%02x d=%02x nd=%02x\n", 582 + poll_reply.report_id, poll_reply.data_state, 583 + poll_reply.system_msb, poll_reply.system_lsb, 584 + poll_reply.data, poll_reply.not_data); 585 + */ 586 + 587 + if ((poll_reply.data + poll_reply.not_data) != 0xff) { 588 + /* Key failed integrity check */ 589 + err("key failed integrity check: %02x %02x %02x %02x", 590 + poll_reply.system_msb, poll_reply.system_lsb, 591 + poll_reply.data, poll_reply.not_data); 592 + return -1; 593 + } 594 + 595 + /* Find the key in the map */ 596 + for (i = 0; i < d->props.rc_key_map_size; i++) { 597 + if (keymap[i].custom == poll_reply.system_lsb && 598 + keymap[i].data == poll_reply.data) { 599 + *event = keymap[i].event; 600 + found = 1; 601 + break; 602 + } 603 + } 604 + 605 + if (found == 0) { 606 + err("Unknown remote controller key: %02x %02x %02x %02x", 607 + poll_reply.system_msb, poll_reply.system_lsb, 608 + poll_reply.data, poll_reply.not_data); 609 + d->last_event = 0; 610 + return 0; 611 + } 612 + 613 + if (poll_reply.data_state == 1) { 614 + /* New key hit */ 615 + st->rc_counter = 0; 616 + *event = keymap[i].event; 617 + *state = REMOTE_KEY_PRESSED; 618 + d->last_event = keymap[i].event; 619 + } else if (poll_reply.data_state == 2) { 620 + /* Key repeated */ 621 + st->rc_counter++; 622 + 623 + /* prevents unwanted double hits */ 624 + if (st->rc_counter > RC_REPEAT_DELAY_V1_20) { 625 + *event = d->last_event; 626 + *state = REMOTE_KEY_PRESSED; 627 + st->rc_counter = RC_REPEAT_DELAY_V1_20; 628 + } 629 + } else { 630 + err("Unknown data state [%d]", poll_reply.data_state); 631 + } 632 + 633 + return 0; 634 + } 635 + 636 + static int dib0700_rc_query(struct dvb_usb_device *d, u32 *event, int *state) 637 + { 638 + struct dib0700_state *st = d->priv; 639 + 640 + /* Because some people may have improperly named firmware files, 641 + let's figure out whether to use the new firmware call or the legacy 642 + call based on the firmware version embedded in the file */ 643 + if (st->rc_func_version == 0) { 644 + u32 hwver, romver, ramver, fwtype; 645 + int ret = dib0700_get_version(d, &hwver, &romver, &ramver, 646 + &fwtype); 647 + if (ret < 0) { 648 + err("Could not determine version info"); 649 + return -1; 650 + } 651 + if (ramver < 0x10200) 652 + st->rc_func_version = 1; 653 + else 654 + st->rc_func_version = 2; 655 + } 656 + 657 + if (st->rc_func_version == 2) 658 + return dib0700_rc_query_v1_20(d, event, state); 659 + else 660 + return dib0700_rc_query_legacy(d, event, state); 536 661 } 537 662 538 663 static struct dvb_usb_rc_key dib0700_rc_keys[] = {
+14 -5
drivers/media/dvb/dvb-usb/usb-urb.c
··· 135 135 136 136 static int usb_bulk_urb_init(struct usb_data_stream *stream) 137 137 { 138 - int i; 138 + int i, j; 139 139 140 140 if ((i = usb_allocate_stream_buffers(stream,stream->props.count, 141 141 stream->props.u.bulk.buffersize)) < 0) ··· 143 143 144 144 /* allocate the URBs */ 145 145 for (i = 0; i < stream->props.count; i++) { 146 - if ((stream->urb_list[i] = usb_alloc_urb(0,GFP_ATOMIC)) == NULL) 146 + stream->urb_list[i] = usb_alloc_urb(0, GFP_ATOMIC); 147 + if (!stream->urb_list[i]) { 148 + deb_mem("not enough memory for urb_alloc_urb!.\n"); 149 + for (j = 0; j < i; j++) 150 + usb_free_urb(stream->urb_list[i]); 147 151 return -ENOMEM; 148 - 152 + } 149 153 usb_fill_bulk_urb( stream->urb_list[i], stream->udev, 150 154 usb_rcvbulkpipe(stream->udev,stream->props.endpoint), 151 155 stream->buf_list[i], ··· 174 170 for (i = 0; i < stream->props.count; i++) { 175 171 struct urb *urb; 176 172 int frame_offset = 0; 177 - if ((stream->urb_list[i] = 178 - usb_alloc_urb(stream->props.u.isoc.framesperurb,GFP_ATOMIC)) == NULL) 173 + 174 + stream->urb_list[i] = usb_alloc_urb(stream->props.u.isoc.framesperurb, GFP_ATOMIC); 175 + if (!stream->urb_list[i]) { 176 + deb_mem("not enough memory for urb_alloc_urb!\n"); 177 + for (j = 0; j < i; j++) 178 + usb_free_urb(stream->urb_list[i]); 179 179 return -ENOMEM; 180 + } 180 181 181 182 urb = stream->urb_list[i]; 182 183
+1 -1
drivers/media/dvb/siano/sms-cards.c
··· 95 95 [SMS1XXX_BOARD_HAUPPAUGE_WINDHAM] = { 96 96 .name = "Hauppauge WinTV MiniStick", 97 97 .type = SMS_NOVA_B0, 98 - .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-hcw-55xxx-dvbt-01.fw", 98 + .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-hcw-55xxx-dvbt-02.fw", 99 99 }, 100 100 }; 101 101
+14 -1
drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
··· 808 808 ISO_BUF_COUNT, 809 809 &ttusb->iso_dma_handle); 810 810 811 + if (!ttusb->iso_buffer) { 812 + dprintk("%s: pci_alloc_consistent - not enough memory\n", 813 + __func__); 814 + return -ENOMEM; 815 + } 816 + 811 817 memset(ttusb->iso_buffer, 0, 812 818 ISO_FRAME_SIZE * FRAMES_PER_ISO_BUF * ISO_BUF_COUNT); 813 819 ··· 1665 1659 1666 1660 ttusb_setup_interfaces(ttusb); 1667 1661 1668 - ttusb_alloc_iso_urbs(ttusb); 1662 + result = ttusb_alloc_iso_urbs(ttusb); 1663 + if (result < 0) { 1664 + dprintk("%s: ttusb_alloc_iso_urbs - failed\n", __func__); 1665 + mutex_unlock(&ttusb->semi2c); 1666 + kfree(ttusb); 1667 + return result; 1668 + } 1669 + 1669 1670 if (ttusb_init_controller(ttusb)) 1670 1671 printk("ttusb_init_controller: error\n"); 1671 1672
+7
drivers/media/dvb/ttusb-dec/ttusb_dec.c
··· 1157 1157 ISO_BUF_COUNT), 1158 1158 &dec->iso_dma_handle); 1159 1159 1160 + if (!dec->iso_buffer) { 1161 + dprintk("%s: pci_alloc_consistent - not enough memory\n", 1162 + __func__); 1163 + return -ENOMEM; 1164 + } 1165 + 1160 1166 memset(dec->iso_buffer, 0, 1161 1167 ISO_FRAME_SIZE * (FRAMES_PER_ISO_BUF * ISO_BUF_COUNT)); 1162 1168 ··· 1260 1254 dec->irq_buffer = usb_buffer_alloc(dec->udev,IRQ_PACKET_SIZE, 1261 1255 GFP_ATOMIC, &dec->irq_dma_handle); 1262 1256 if(!dec->irq_buffer) { 1257 + usb_free_urb(dec->irq_urb); 1263 1258 return -ENOMEM; 1264 1259 } 1265 1260 usb_fill_int_urb(dec->irq_urb, dec->udev,dec->irq_pipe,
+16 -17
drivers/media/video/em28xx/em28xx-audio.c
··· 62 62 63 63 dprintk("Stopping isoc\n"); 64 64 for (i = 0; i < EM28XX_AUDIO_BUFS; i++) { 65 - usb_kill_urb(dev->adev->urb[i]); 65 + usb_unlink_urb(dev->adev->urb[i]); 66 66 usb_free_urb(dev->adev->urb[i]); 67 67 dev->adev->urb[i] = NULL; 68 68 } ··· 75 75 struct em28xx *dev = urb->context; 76 76 int i; 77 77 unsigned int oldptr; 78 - unsigned long flags; 79 78 int period_elapsed = 0; 80 79 int status; 81 80 unsigned char *cp; ··· 95 96 if (!length) 96 97 continue; 97 98 98 - spin_lock_irqsave(&dev->adev->slock, flags); 99 - 100 99 oldptr = dev->adev->hwptr_done_capture; 100 + if (oldptr + length >= runtime->buffer_size) { 101 + unsigned int cnt = 102 + runtime->buffer_size - oldptr; 103 + memcpy(runtime->dma_area + oldptr * stride, cp, 104 + cnt * stride); 105 + memcpy(runtime->dma_area, cp + cnt * stride, 106 + length * stride - cnt * stride); 107 + } else { 108 + memcpy(runtime->dma_area + oldptr * stride, cp, 109 + length * stride); 110 + } 111 + 112 + snd_pcm_stream_lock(substream); 113 + 101 114 dev->adev->hwptr_done_capture += length; 102 115 if (dev->adev->hwptr_done_capture >= 103 116 runtime->buffer_size) ··· 124 113 period_elapsed = 1; 125 114 } 126 115 127 - spin_unlock_irqrestore(&dev->adev->slock, flags); 128 - 129 - if (oldptr + length >= runtime->buffer_size) { 130 - unsigned int cnt = 131 - runtime->buffer_size - oldptr; 132 - memcpy(runtime->dma_area + oldptr * stride, cp, 133 - cnt * stride); 134 - memcpy(runtime->dma_area, cp + cnt * stride, 135 - length * stride - cnt * stride); 136 - } else { 137 - memcpy(runtime->dma_area + oldptr * stride, cp, 138 - length * stride); 139 - } 116 + snd_pcm_stream_unlock(substream); 140 117 } 141 118 if (period_elapsed) 142 119 snd_pcm_period_elapsed(substream);
+36 -22
drivers/media/video/em28xx/em28xx-core.c
··· 69 69 int ret, byte; 70 70 71 71 if (dev->state & DEV_DISCONNECTED) 72 - return(-ENODEV); 72 + return -ENODEV; 73 + 74 + if (len > URB_MAX_CTRL_SIZE) 75 + return -EINVAL; 73 76 74 77 em28xx_regdbg("req=%02x, reg=%02x ", req, reg); 75 78 79 + mutex_lock(&dev->ctrl_urb_lock); 76 80 ret = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), req, 77 81 USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 78 - 0x0000, reg, buf, len, HZ); 82 + 0x0000, reg, dev->urb_buf, len, HZ); 83 + if (ret < 0) { 84 + if (reg_debug) 85 + printk(" failed!\n"); 86 + mutex_unlock(&dev->ctrl_urb_lock); 87 + return ret; 88 + } 89 + 90 + if (len) 91 + memcpy(buf, dev->urb_buf, len); 92 + 93 + mutex_unlock(&dev->ctrl_urb_lock); 79 94 80 95 if (reg_debug) { 81 - printk(ret < 0 ? " failed!\n" : "%02x values: ", ret); 96 + printk("%02x values: ", ret); 82 97 for (byte = 0; byte < len; byte++) 83 98 printk(" %02x", (unsigned char)buf[byte]); 84 - 85 99 printk("\n"); 86 100 } 87 101 ··· 116 102 117 103 em28xx_regdbg("req=%02x, reg=%02x:", req, reg); 118 104 105 + mutex_lock(&dev->ctrl_urb_lock); 119 106 ret = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), req, 120 107 USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 121 - 0x0000, reg, &val, 1, HZ); 108 + 0x0000, reg, dev->urb_buf, 1, HZ); 109 + val = dev->urb_buf[0]; 110 + mutex_unlock(&dev->ctrl_urb_lock); 111 + 112 + if (ret < 0) { 113 + printk(" failed!\n"); 114 + return ret; 115 + } 122 116 123 117 if (reg_debug) 124 - printk(ret < 0 ? " failed!\n" : 125 - "%02x\n", (unsigned char) val); 126 - 127 - if (ret < 0) 128 - return ret; 118 + printk("%02x\n", (unsigned char) val); 129 119 130 120 return val; 131 121 } ··· 148 130 { 149 131 int ret; 150 132 151 - /*usb_control_msg seems to expect a kmalloced buffer */ 152 - unsigned char *bufs; 153 - 154 133 if (dev->state & DEV_DISCONNECTED) 155 134 return -ENODEV; 156 135 157 - if (len < 1) 136 + if ((len < 1) || (len > URB_MAX_CTRL_SIZE)) 158 137 return -EINVAL; 159 138 160 - bufs = kmalloc(len, GFP_KERNEL); 161 - 162 139 em28xx_regdbg("req=%02x reg=%02x:", req, reg); 163 - 164 140 if (reg_debug) { 165 141 int i; 166 142 for (i = 0; i < len; ++i) ··· 162 150 printk("\n"); 163 151 } 164 152 165 - if (!bufs) 166 - return -ENOMEM; 167 - memcpy(bufs, buf, len); 153 + mutex_lock(&dev->ctrl_urb_lock); 154 + memcpy(dev->urb_buf, buf, len); 168 155 ret = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), req, 169 156 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 170 - 0x0000, reg, bufs, len, HZ); 157 + 0x0000, reg, dev->urb_buf, len, HZ); 158 + mutex_unlock(&dev->ctrl_urb_lock); 159 + 171 160 if (dev->wait_after_write) 172 161 msleep(dev->wait_after_write); 173 162 174 - kfree(bufs); 175 163 return ret; 176 164 } 177 165 ··· 282 270 break; 283 271 case EM28XX_AMUX_LINE_IN: 284 272 input = EM28XX_AUDIO_SRC_LINE; 273 + video = disable; 274 + line = enable; 285 275 break; 286 276 case EM28XX_AMUX_AC97_VIDEO: 287 277 input = EM28XX_AUDIO_SRC_LINE;
+6 -4
drivers/media/video/em28xx/em28xx-i2c.c
··· 337 337 /* Check if board has eeprom */ 338 338 err = i2c_master_recv(&dev->i2c_client, &buf, 0); 339 339 if (err < 0) { 340 - em28xx_errdev("%s: i2c_master_recv failed! err [%d]\n", 341 - __func__, err); 342 - return err; 340 + em28xx_errdev("board has no eeprom\n"); 341 + memset(eedata, 0, len); 342 + return -ENODEV; 343 343 } 344 344 345 345 buf = 0; ··· 609 609 dev->i2c_client.adapter = &dev->i2c_adap; 610 610 611 611 retval = em28xx_i2c_eeprom(dev, dev->eedata, sizeof(dev->eedata)); 612 - if (retval < 0) { 612 + if ((retval < 0) && (retval != -ENODEV)) { 613 613 em28xx_errdev("%s: em28xx_i2_eeprom failed! retval [%d]\n", 614 614 __func__, retval); 615 + 615 616 return retval; 616 617 } 617 618 618 619 if (i2c_scan) 619 620 em28xx_do_i2c_scan(dev); 621 + 620 622 return 0; 621 623 } 622 624
+81 -59
drivers/media/video/em28xx/em28xx-video.c
··· 73 73 MODULE_LICENSE("GPL"); 74 74 75 75 static LIST_HEAD(em28xx_devlist); 76 + static DEFINE_MUTEX(em28xx_devlist_mutex); 76 77 77 78 static unsigned int card[] = {[0 ... (EM28XX_MAXBOARDS - 1)] = UNSET }; 78 79 static unsigned int video_nr[] = {[0 ... (EM28XX_MAXBOARDS - 1)] = UNSET }; ··· 1520 1519 struct em28xx_fh *fh; 1521 1520 enum v4l2_buf_type fh_type = 0; 1522 1521 1523 - lock_kernel(); 1522 + mutex_lock(&em28xx_devlist_mutex); 1524 1523 list_for_each_entry(h, &em28xx_devlist, devlist) { 1525 1524 if (h->vdev->minor == minor) { 1526 1525 dev = h; ··· 1536 1535 dev = h; 1537 1536 } 1538 1537 } 1539 - if (NULL == dev) { 1540 - unlock_kernel(); 1538 + mutex_unlock(&em28xx_devlist_mutex); 1539 + if (NULL == dev) 1541 1540 return -ENODEV; 1542 - } 1541 + 1542 + mutex_lock(&dev->lock); 1543 1543 1544 1544 em28xx_videodbg("open minor=%d type=%s users=%d\n", 1545 1545 minor, v4l2_type_names[fh_type], dev->users); ··· 1549 1547 fh = kzalloc(sizeof(struct em28xx_fh), GFP_KERNEL); 1550 1548 if (!fh) { 1551 1549 em28xx_errdev("em28xx-video.c: Out of memory?!\n"); 1552 - unlock_kernel(); 1550 + mutex_unlock(&dev->lock); 1553 1551 return -ENOMEM; 1554 1552 } 1555 - mutex_lock(&dev->lock); 1556 1553 fh->dev = dev; 1557 1554 fh->radio = radio; 1558 1555 fh->type = fh_type; ··· 1585 1584 sizeof(struct em28xx_buffer), fh); 1586 1585 1587 1586 mutex_unlock(&dev->lock); 1588 - unlock_kernel(); 1589 1587 1590 1588 return errCode; 1591 1589 } ··· 1871 1871 { 1872 1872 struct em28xx *dev = NULL; 1873 1873 1874 + mutex_lock(&em28xx_devlist_mutex); 1874 1875 mutex_lock(&em28xx_extension_devlist_lock); 1875 1876 list_add_tail(&ops->next, &em28xx_extension_devlist); 1876 1877 list_for_each_entry(dev, &em28xx_devlist, devlist) { ··· 1880 1879 } 1881 1880 printk(KERN_INFO "Em28xx: Initialized (%s) extension\n", ops->name); 1882 1881 mutex_unlock(&em28xx_extension_devlist_lock); 1882 + mutex_unlock(&em28xx_devlist_mutex); 1883 1883 return 0; 1884 1884 } 1885 1885 EXPORT_SYMBOL(em28xx_register_extension); ··· 1889 1887 { 1890 1888 struct em28xx *dev = NULL; 1891 1889 1890 + mutex_lock(&em28xx_devlist_mutex); 1892 1891 list_for_each_entry(dev, &em28xx_devlist, devlist) { 1893 1892 if (dev) 1894 1893 ops->fini(dev); ··· 1899 1896 printk(KERN_INFO "Em28xx: Removed (%s) extension\n", ops->name); 1900 1897 list_del(&ops->next); 1901 1898 mutex_unlock(&em28xx_extension_devlist_lock); 1899 + mutex_unlock(&em28xx_devlist_mutex); 1902 1900 } 1903 1901 EXPORT_SYMBOL(em28xx_unregister_extension); 1904 1902 ··· 1925 1921 } 1926 1922 1927 1923 1924 + static int register_analog_devices(struct em28xx *dev) 1925 + { 1926 + int ret; 1927 + 1928 + /* allocate and fill video video_device struct */ 1929 + dev->vdev = em28xx_vdev_init(dev, &em28xx_video_template, "video"); 1930 + if (!dev->vdev) { 1931 + em28xx_errdev("cannot allocate video_device.\n"); 1932 + return -ENODEV; 1933 + } 1934 + 1935 + /* register v4l2 video video_device */ 1936 + ret = video_register_device(dev->vdev, VFL_TYPE_GRABBER, 1937 + video_nr[dev->devno]); 1938 + if (ret) { 1939 + em28xx_errdev("unable to register video device (error=%i).\n", 1940 + ret); 1941 + return ret; 1942 + } 1943 + 1944 + /* Allocate and fill vbi video_device struct */ 1945 + dev->vbi_dev = em28xx_vdev_init(dev, &em28xx_video_template, "vbi"); 1946 + 1947 + /* register v4l2 vbi video_device */ 1948 + ret = video_register_device(dev->vbi_dev, VFL_TYPE_VBI, 1949 + vbi_nr[dev->devno]); 1950 + if (ret < 0) { 1951 + em28xx_errdev("unable to register vbi device\n"); 1952 + return ret; 1953 + } 1954 + 1955 + if (em28xx_boards[dev->model].radio.type == EM28XX_RADIO) { 1956 + dev->radio_dev = em28xx_vdev_init(dev, &em28xx_radio_template, "radio"); 1957 + if (!dev->radio_dev) { 1958 + em28xx_errdev("cannot allocate video_device.\n"); 1959 + return -ENODEV; 1960 + } 1961 + ret = video_register_device(dev->radio_dev, VFL_TYPE_RADIO, 1962 + radio_nr[dev->devno]); 1963 + if (ret < 0) { 1964 + em28xx_errdev("can't register radio device\n"); 1965 + return ret; 1966 + } 1967 + em28xx_info("Registered radio device as /dev/radio%d\n", 1968 + dev->radio_dev->num); 1969 + } 1970 + 1971 + em28xx_info("V4L2 device registered as /dev/video%d and /dev/vbi%d\n", 1972 + dev->vdev->num, dev->vbi_dev->num); 1973 + 1974 + return 0; 1975 + } 1976 + 1977 + 1928 1978 /* 1929 1979 * em28xx_init_dev() 1930 1980 * allocates and inits the device structs, registers i2c bus and v4l device ··· 1994 1936 1995 1937 dev->udev = udev; 1996 1938 mutex_init(&dev->lock); 1939 + mutex_init(&dev->ctrl_urb_lock); 1997 1940 spin_lock_init(&dev->slock); 1998 1941 init_waitqueue_head(&dev->open); 1999 1942 init_waitqueue_head(&dev->wait_frame); ··· 2012 1953 errCode = em28xx_config(dev); 2013 1954 if (errCode) { 2014 1955 em28xx_errdev("error configuring device\n"); 2015 - em28xx_devused &= ~(1<<dev->devno); 2016 - kfree(dev); 2017 1956 return -ENOMEM; 2018 1957 } 2019 1958 ··· 2058 2001 return errCode; 2059 2002 } 2060 2003 2061 - list_add_tail(&dev->devlist, &em28xx_devlist); 2062 - 2063 - /* allocate and fill video video_device struct */ 2064 - dev->vdev = em28xx_vdev_init(dev, &em28xx_video_template, "video"); 2065 - if (NULL == dev->vdev) { 2066 - em28xx_errdev("cannot allocate video_device.\n"); 2067 - goto fail_unreg; 2068 - } 2069 - 2070 - /* register v4l2 video video_device */ 2071 - retval = video_register_device(dev->vdev, VFL_TYPE_GRABBER, 2072 - video_nr[dev->devno]); 2073 - if (retval) { 2074 - em28xx_errdev("unable to register video device (error=%i).\n", 2075 - retval); 2076 - goto fail_unreg; 2077 - } 2078 - 2079 - /* Allocate and fill vbi video_device struct */ 2080 - dev->vbi_dev = em28xx_vdev_init(dev, &em28xx_video_template, "vbi"); 2081 - /* register v4l2 vbi video_device */ 2082 - if (video_register_device(dev->vbi_dev, VFL_TYPE_VBI, 2083 - vbi_nr[dev->devno]) < 0) { 2084 - em28xx_errdev("unable to register vbi device\n"); 2085 - retval = -ENODEV; 2086 - goto fail_unreg; 2087 - } 2088 - 2089 - if (em28xx_boards[dev->model].radio.type == EM28XX_RADIO) { 2090 - dev->radio_dev = em28xx_vdev_init(dev, &em28xx_radio_template, "radio"); 2091 - if (NULL == dev->radio_dev) { 2092 - em28xx_errdev("cannot allocate video_device.\n"); 2093 - goto fail_unreg; 2094 - } 2095 - retval = video_register_device(dev->radio_dev, VFL_TYPE_RADIO, 2096 - radio_nr[dev->devno]); 2097 - if (retval < 0) { 2098 - em28xx_errdev("can't register radio device\n"); 2099 - goto fail_unreg; 2100 - } 2101 - em28xx_info("Registered radio device as /dev/radio%d\n", 2102 - dev->radio_dev->num); 2103 - } 2104 - 2105 2004 /* init video dma queues */ 2106 2005 INIT_LIST_HEAD(&dev->vidq.active); 2107 2006 INIT_LIST_HEAD(&dev->vidq.queued); ··· 2084 2071 2085 2072 video_mux(dev, 0); 2086 2073 2087 - em28xx_info("V4L2 device registered as /dev/video%d and /dev/vbi%d\n", 2088 - dev->vdev->num, dev->vbi_dev->num); 2074 + mutex_lock(&em28xx_devlist_mutex); 2075 + list_add_tail(&dev->devlist, &em28xx_devlist); 2076 + retval = register_analog_devices(dev); 2077 + if (retval < 0) { 2078 + em28xx_release_resources(dev); 2079 + mutex_unlock(&em28xx_devlist_mutex); 2080 + goto fail_reg_devices; 2081 + } 2089 2082 2090 2083 mutex_lock(&em28xx_extension_devlist_lock); 2091 2084 if (!list_empty(&em28xx_extension_devlist)) { ··· 2101 2082 } 2102 2083 } 2103 2084 mutex_unlock(&em28xx_extension_devlist_lock); 2085 + mutex_unlock(&em28xx_devlist_mutex); 2104 2086 2105 2087 return 0; 2106 2088 2107 - fail_unreg: 2108 - em28xx_release_resources(dev); 2089 + fail_reg_devices: 2109 2090 mutex_unlock(&dev->lock); 2110 - kfree(dev); 2111 2091 return retval; 2112 2092 } 2113 2093 ··· 2249 2231 2250 2232 /* allocate device struct */ 2251 2233 retval = em28xx_init_dev(&dev, udev, nr); 2252 - if (retval) 2234 + if (retval) { 2235 + em28xx_devused &= ~(1<<dev->devno); 2236 + kfree(dev); 2237 + 2253 2238 return retval; 2239 + } 2254 2240 2255 2241 em28xx_info("Found %s\n", em28xx_boards[dev->model].name); 2256 2242
+6
drivers/media/video/em28xx/em28xx.h
··· 102 102 #define EM28XX_MIN_BUF 4 103 103 #define EM28XX_DEF_BUF 8 104 104 105 + /*Limits the max URB message size */ 106 + #define URB_MAX_CTRL_SIZE 80 107 + 105 108 /* Params for validated field */ 106 109 #define EM28XX_BOARD_NOT_VALIDATED 1 107 110 #define EM28XX_BOARD_VALIDATED 0 ··· 433 430 434 431 /* locks */ 435 432 struct mutex lock; 433 + struct mutex ctrl_urb_lock; /* protects urb_buf */ 436 434 /* spinlock_t queue_lock; */ 437 435 struct list_head inqueue, outqueue; 438 436 wait_queue_head_t open, wait_frame, wait_stream; ··· 455 451 unsigned int *alt_max_pkt_size; /* array of wMaxPacketSize */ 456 452 struct urb *urb[EM28XX_NUM_BUFS]; /* urb for isoc transfers */ 457 453 char *transfer_buffer[EM28XX_NUM_BUFS]; /* transfer buffers for isoc transfer */ 454 + char urb_buf[URB_MAX_CTRL_SIZE]; /* urb control msg buffer */ 455 + 458 456 /* helper funcs that call usb_control_msg */ 459 457 int (*em28xx_write_regs) (struct em28xx *dev, u16 reg, 460 458 char *buf, int len);
+3
drivers/media/video/gspca/conex.c
··· 846 846 return 0; 847 847 } 848 848 849 + /* called on streamoff with alt 0 and on disconnect */ 849 850 static void sd_stop0(struct gspca_dev *gspca_dev) 850 851 { 851 852 int retry = 50; 852 853 854 + if (!gspca_dev->present) 855 + return; 853 856 reg_w_val(gspca_dev, 0x0000, 0x00); 854 857 reg_r(gspca_dev, 0x0002, 1); 855 858 reg_w_val(gspca_dev, 0x0053, 0x00);
+8
drivers/media/video/gspca/finepix.c
··· 276 276 /* Stop the state machine */ 277 277 if (dev->state != FPIX_NOP) 278 278 wait_for_completion(&dev->can_close); 279 + } 280 + 281 + /* called on streamoff with alt 0 and disconnect */ 282 + static void sd_stop0(struct gspca_dev *gspca_dev) 283 + { 284 + struct usb_fpix *dev = (struct usb_fpix *) gspca_dev; 279 285 280 286 usb_free_urb(dev->control_urb); 281 287 dev->control_urb = NULL; ··· 391 385 error: 392 386 /* Free the ressources */ 393 387 sd_stopN(gspca_dev); 388 + sd_stop0(gspca_dev); 394 389 return ret; 395 390 } 396 391 ··· 432 425 .init = sd_init, 433 426 .start = sd_start, 434 427 .stopN = sd_stopN, 428 + .stop0 = sd_stop0, 435 429 }; 436 430 437 431 /* -- device connect -- */
+30 -26
drivers/media/video/gspca/gspca.c
··· 646 646 { 647 647 gspca_dev->streaming = 0; 648 648 atomic_set(&gspca_dev->nevent, 0); 649 - if (gspca_dev->present) { 650 - if (gspca_dev->sd_desc->stopN) 651 - gspca_dev->sd_desc->stopN(gspca_dev); 652 - destroy_urbs(gspca_dev); 653 - gspca_set_alt0(gspca_dev); 654 - if (gspca_dev->sd_desc->stop0) 655 - gspca_dev->sd_desc->stop0(gspca_dev); 656 - PDEBUG(D_STREAM, "stream off OK"); 657 - } 649 + if (gspca_dev->present 650 + && gspca_dev->sd_desc->stopN) 651 + gspca_dev->sd_desc->stopN(gspca_dev); 652 + destroy_urbs(gspca_dev); 653 + gspca_set_alt0(gspca_dev); 654 + if (gspca_dev->sd_desc->stop0) 655 + gspca_dev->sd_desc->stop0(gspca_dev); 656 + PDEBUG(D_STREAM, "stream off OK"); 658 657 } 659 658 660 659 static void gspca_set_default_mode(struct gspca_dev *gspca_dev) ··· 862 863 int ret; 863 864 864 865 PDEBUG(D_STREAM, "%s open", current->comm); 865 - gspca_dev = (struct gspca_dev *) video_devdata(file); 866 + gspca_dev = video_drvdata(file); 866 867 if (mutex_lock_interruptible(&gspca_dev->queue_lock)) 867 868 return -ERESTARTSYS; 868 869 if (!gspca_dev->present) { ··· 874 875 ret = -EBUSY; 875 876 goto out; 876 877 } 878 + 879 + /* protect the subdriver against rmmod */ 880 + if (!try_module_get(gspca_dev->module)) { 881 + ret = -ENODEV; 882 + goto out; 883 + } 884 + 877 885 gspca_dev->users++; 878 886 879 887 /* one more user */ ··· 890 884 #ifdef GSPCA_DEBUG 891 885 /* activate the v4l2 debug */ 892 886 if (gspca_debug & D_V4L2) 893 - gspca_dev->vdev.debug |= V4L2_DEBUG_IOCTL 887 + gspca_dev->vdev->debug |= V4L2_DEBUG_IOCTL 894 888 | V4L2_DEBUG_IOCTL_ARG; 895 889 else 896 - gspca_dev->vdev.debug &= ~(V4L2_DEBUG_IOCTL 890 + gspca_dev->vdev->debug &= ~(V4L2_DEBUG_IOCTL 897 891 | V4L2_DEBUG_IOCTL_ARG); 898 892 #endif 899 893 ret = 0; ··· 927 921 gspca_dev->memory = GSPCA_MEMORY_NO; 928 922 } 929 923 file->private_data = NULL; 924 + module_put(gspca_dev->module); 930 925 mutex_unlock(&gspca_dev->queue_lock); 931 926 932 927 PDEBUG(D_STREAM, "close done"); ··· 1755 1748 return ret; 1756 1749 } 1757 1750 1758 - static void dev_release(struct video_device *vfd) 1759 - { 1760 - /* nothing */ 1761 - } 1762 - 1763 1751 static struct file_operations dev_fops = { 1764 1752 .owner = THIS_MODULE, 1765 1753 .open = dev_open, ··· 1802 1800 .name = "gspca main driver", 1803 1801 .fops = &dev_fops, 1804 1802 .ioctl_ops = &dev_ioctl_ops, 1805 - .release = dev_release, /* mandatory */ 1803 + .release = video_device_release, 1806 1804 .minor = -1, 1807 1805 }; 1808 1806 ··· 1871 1869 init_waitqueue_head(&gspca_dev->wq); 1872 1870 1873 1871 /* init video stuff */ 1874 - memcpy(&gspca_dev->vdev, &gspca_template, sizeof gspca_template); 1875 - gspca_dev->vdev.parent = &dev->dev; 1876 - memcpy(&gspca_dev->fops, &dev_fops, sizeof gspca_dev->fops); 1877 - gspca_dev->vdev.fops = &gspca_dev->fops; 1878 - gspca_dev->fops.owner = module; /* module protection */ 1872 + gspca_dev->vdev = video_device_alloc(); 1873 + memcpy(gspca_dev->vdev, &gspca_template, sizeof gspca_template); 1874 + gspca_dev->vdev->parent = &dev->dev; 1875 + gspca_dev->module = module; 1879 1876 gspca_dev->present = 1; 1880 - ret = video_register_device(&gspca_dev->vdev, 1877 + video_set_drvdata(gspca_dev->vdev, gspca_dev); 1878 + ret = video_register_device(gspca_dev->vdev, 1881 1879 VFL_TYPE_GRABBER, 1882 1880 video_nr); 1883 1881 if (ret < 0) { 1884 1882 err("video_register_device err %d", ret); 1883 + video_device_release(gspca_dev->vdev); 1885 1884 goto out; 1886 1885 } 1887 1886 ··· 1890 1887 PDEBUG(D_PROBE, "probe ok"); 1891 1888 return 0; 1892 1889 out: 1893 - kref_put(&gspca_dev->kref, gspca_delete); 1890 + kfree(gspca_dev->usb_buf); 1891 + kfree(gspca_dev); 1894 1892 return ret; 1895 1893 } 1896 1894 EXPORT_SYMBOL(gspca_dev_probe); ··· 1909 1905 usb_set_intfdata(intf, NULL); 1910 1906 1911 1907 /* We don't want people trying to open up the device */ 1912 - video_unregister_device(&gspca_dev->vdev); 1908 + video_unregister_device(gspca_dev->vdev); 1913 1909 1914 1910 gspca_dev->present = 0; 1915 1911 gspca_dev->streaming = 0;
+3 -3
drivers/media/video/gspca/gspca.h
··· 97 97 cam_pkt_op pkt_scan; 98 98 /* optional operations */ 99 99 cam_v_op stopN; /* called on stream off - main alt */ 100 - cam_v_op stop0; /* called on stream off - alt 0 */ 100 + cam_v_op stop0; /* called on stream off & disconnect - alt 0 */ 101 101 cam_v_op dq_callback; /* called when a frame has been dequeued */ 102 102 cam_jpg_op get_jcomp; 103 103 cam_jpg_op set_jcomp; ··· 120 120 }; 121 121 122 122 struct gspca_dev { 123 - struct video_device vdev; /* !! must be the first item */ 124 - struct file_operations fops; 123 + struct video_device *vdev; 124 + struct module *module; /* subdriver handling the device */ 125 125 struct usb_device *dev; 126 126 struct kref kref; 127 127 struct file *capt_file; /* file doing video capture */
+3
drivers/media/video/gspca/pac7311.c
··· 749 749 reg_w(gspca_dev, 0x78, 0x44); /* Bit_0=start stream, Bit_6=LED */ 750 750 } 751 751 752 + /* called on streamoff with alt 0 and on disconnect */ 752 753 static void sd_stop0(struct gspca_dev *gspca_dev) 753 754 { 754 755 struct sd *sd = (struct sd *) gspca_dev; 755 756 757 + if (!gspca_dev->present) 758 + return; 756 759 if (sd->sensor == SENSOR_PAC7302) { 757 760 reg_w(gspca_dev, 0xff, 0x01); 758 761 reg_w(gspca_dev, 0x78, 0x40);
+3
drivers/media/video/gspca/spca501.c
··· 2022 2022 reg_write(gspca_dev->dev, SPCA501_REG_CTLRL, 0x01, 0x00); 2023 2023 } 2024 2024 2025 + /* called on streamoff with alt 0 and on disconnect */ 2025 2026 static void sd_stop0(struct gspca_dev *gspca_dev) 2026 2027 { 2028 + if (!gspca_dev->present) 2029 + return; 2027 2030 reg_write(gspca_dev->dev, SPCA501_REG_CTLRL, 0x05, 0x00); 2028 2031 } 2029 2032
+4
drivers/media/video/gspca/spca505.c
··· 742 742 reg_write(gspca_dev->dev, 0x02, 0x00, 0x00); 743 743 } 744 744 745 + /* called on streamoff with alt 0 and on disconnect */ 745 746 static void sd_stop0(struct gspca_dev *gspca_dev) 746 747 { 748 + if (!gspca_dev->present) 749 + return; 750 + 747 751 /* This maybe reset or power control */ 748 752 reg_write(gspca_dev->dev, 0x03, 0x03, 0x20); 749 753 reg_write(gspca_dev->dev, 0x03, 0x01, 0x0);
+3
drivers/media/video/gspca/spca561.c
··· 766 766 } 767 767 } 768 768 769 + /* called on streamoff with alt 0 and on disconnect */ 769 770 static void sd_stop0(struct gspca_dev *gspca_dev) 770 771 { 771 772 struct sd *sd = (struct sd *) gspca_dev; 772 773 774 + if (!gspca_dev->present) 775 + return; 773 776 if (sd->chip_revision == Rev012A) { 774 777 reg_w_val(gspca_dev->dev, 0x8118, 0x29); 775 778 reg_w_val(gspca_dev->dev, 0x8114, 0x08);
+3
drivers/media/video/gspca/vc032x.c
··· 1633 1633 reg_w(dev, 0xa0, 0x09, 0xb003); 1634 1634 } 1635 1635 1636 + /* called on streamoff with alt 0 and on disconnect */ 1636 1637 static void sd_stop0(struct gspca_dev *gspca_dev) 1637 1638 { 1638 1639 struct usb_device *dev = gspca_dev->dev; 1639 1640 1641 + if (!gspca_dev->present) 1642 + return; 1640 1643 reg_w(dev, 0x89, 0xffff, 0xffff); 1641 1644 } 1642 1645
+3
drivers/media/video/gspca/zc3xx.c
··· 7336 7336 return 0; 7337 7337 } 7338 7338 7339 + /* called on streamoff with alt 0 and on disconnect */ 7339 7340 static void sd_stop0(struct gspca_dev *gspca_dev) 7340 7341 { 7341 7342 struct sd *sd = (struct sd *) gspca_dev; 7342 7343 7344 + if (!gspca_dev->present) 7345 + return; 7343 7346 send_unknown(gspca_dev->dev, sd->sensor); 7344 7347 } 7345 7348
+1 -1
drivers/media/video/s2255drv.c
··· 192 192 #define S2255_FW_FAILED 3 193 193 #define S2255_FW_DISCONNECTING 4 194 194 195 - #define S2255_FW_MARKER 0x22552f2f 195 + #define S2255_FW_MARKER cpu_to_le32(0x22552f2f) 196 196 /* 2255 read states */ 197 197 #define S2255_READ_IDLE 0 198 198 #define S2255_READ_FRAME 1