--- zzzz-none-000/linux-3.10.107/drivers/media/usb/usbvision/usbvision-core.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/media/usb/usbvision/usbvision-core.c 2021-02-04 17:41:59.000000000 +0000 @@ -1367,7 +1367,7 @@ int usbvision_read_reg(struct usb_usbvision *usbvision, unsigned char reg) { int err_code = 0; - unsigned char buffer[1]; + unsigned char *buffer = usbvision->ctrl_urb_buffer; if (!USBVISION_IS_OPERATIONAL(usbvision)) return -1; @@ -1401,10 +1401,12 @@ if (!USBVISION_IS_OPERATIONAL(usbvision)) return 0; + usbvision->ctrl_urb_buffer[0] = value; err_code = usb_control_msg(usbvision->dev, usb_sndctrlpipe(usbvision->dev, 1), USBVISION_OP_CODE, USB_DIR_OUT | USB_TYPE_VENDOR | - USB_RECIP_ENDPOINT, 0, (__u16) reg, &value, 1, HZ); + USB_RECIP_ENDPOINT, 0, (__u16) reg, + usbvision->ctrl_urb_buffer, 1, HZ); if (err_code < 0) { dev_err(&usbvision->dev->dev, @@ -1463,8 +1465,6 @@ static int usbvision_init_compression(struct usb_usbvision *usbvision) { - int err_code = 0; - usbvision->last_isoc_frame_num = -1; usbvision->isoc_data_count = 0; usbvision->isoc_packet_count = 0; @@ -1475,7 +1475,7 @@ usbvision->request_intra = 1; usbvision->isoc_measure_bandwidth_count = 0; - return err_code; + return 0; } /* this function measures the used bandwidth since last call @@ -1484,11 +1484,9 @@ */ static int usbvision_measure_bandwidth(struct usb_usbvision *usbvision) { - int err_code = 0; - if (usbvision->isoc_measure_bandwidth_count < 2) { /* this gives an average bandwidth of 3 frames */ usbvision->isoc_measure_bandwidth_count++; - return err_code; + return 0; } if ((usbvision->isoc_packet_size > 0) && (usbvision->isoc_packet_count > 0)) { usbvision->used_bandwidth = usbvision->isoc_data_count / @@ -1499,7 +1497,7 @@ usbvision->isoc_data_count = 0; usbvision->isoc_packet_count = 0; usbvision->isoc_skip_count = 0; - return err_code; + return 0; } static int usbvision_adjust_compression(struct usb_usbvision *usbvision) @@ -1546,26 +1544,24 @@ static int usbvision_request_intra(struct usb_usbvision *usbvision) { - int err_code = 0; unsigned char buffer[1]; PDEBUG(DBG_IRQ, ""); usbvision->request_intra = 1; buffer[0] = 1; usbvision_write_reg_irq(usbvision, USBVISION_FORCE_INTRA, buffer, 1); - return err_code; + return 0; } static int usbvision_unrequest_intra(struct usb_usbvision *usbvision) { - int err_code = 0; unsigned char buffer[1]; PDEBUG(DBG_IRQ, ""); usbvision->request_intra = 0; buffer[0] = 0; usbvision_write_reg_irq(usbvision, USBVISION_FORCE_INTRA, buffer, 1); - return err_code; + return 0; } /******************************* @@ -1602,7 +1598,7 @@ { 0x27, 0x00, 0x00 }, { 0x28, 0x00, 0x00 }, { 0x29, 0x00, 0x00 }, { 0x08, 0x80, 0x60 }, { 0x0f, 0x2d, 0x24 }, { 0x0c, 0x80, 0x80 } }; - char value[3]; + unsigned char *value = usbvision->ctrl_urb_buffer; /* the only difference between PAL and NTSC init_values */ if (usbvision_device_data[usbvision->dev_model].video_norm == V4L2_STD_NTSC) @@ -1641,8 +1637,8 @@ static int usbvision_set_video_format(struct usb_usbvision *usbvision, int format) { static const char proc[] = "usbvision_set_video_format"; + unsigned char *value = usbvision->ctrl_urb_buffer; int rc; - unsigned char value[2]; if (!USBVISION_IS_OPERATIONAL(usbvision)) return 0; @@ -1683,7 +1679,7 @@ int err_code = 0; int usb_width, usb_height; unsigned int frame_rate = 0, frame_drop = 0; - unsigned char value[4]; + unsigned char *value = usbvision->ctrl_urb_buffer; if (!USBVISION_IS_OPERATIONAL(usbvision)) return 0; @@ -1795,10 +1791,6 @@ usbvision->num_frames--; } - spin_lock_init(&usbvision->queue_lock); - init_waitqueue_head(&usbvision->wait_frame); - init_waitqueue_head(&usbvision->wait_stream); - /* Allocate all buffers */ for (i = 0; i < usbvision->num_frames; i++) { usbvision->frame[i].index = i; @@ -1878,7 +1870,7 @@ { static const char proc[] = "usbvision_set_compresion_params: "; int rc; - unsigned char value[6]; + unsigned char *value = usbvision->ctrl_urb_buffer; value[0] = 0x0F; /* Intra-Compression cycle */ value[1] = 0x01; /* Reg.45 one line per strip */ @@ -1952,7 +1944,7 @@ { static const char proc[] = "usbvision_set_input: "; int rc; - unsigned char value[8]; + unsigned char *value = usbvision->ctrl_urb_buffer; unsigned char dvi_yuv_value; if (!USBVISION_IS_OPERATIONAL(usbvision)) @@ -2068,8 +2060,8 @@ static int usbvision_set_dram_settings(struct usb_usbvision *usbvision) { + unsigned char *value = usbvision->ctrl_urb_buffer; int rc; - unsigned char value[8]; if (usbvision->isoc_mode == ISOC_MODE_COMPRESS) { value[0] = 0x42; @@ -2167,56 +2159,6 @@ /* - * usbvision timer stuff - */ - -/* to call usbvision_power_off from task queue */ -static void call_usbvision_power_off(struct work_struct *work) -{ - struct usb_usbvision *usbvision = container_of(work, struct usb_usbvision, power_off_work); - - PDEBUG(DBG_FUNC, ""); - if (mutex_lock_interruptible(&usbvision->v4l2_lock)) - return; - - if (usbvision->user == 0) { - usbvision_i2c_unregister(usbvision); - - usbvision_power_off(usbvision); - usbvision->initialized = 0; - } - mutex_unlock(&usbvision->v4l2_lock); -} - -static void usbvision_power_off_timer(unsigned long data) -{ - struct usb_usbvision *usbvision = (void *)data; - - PDEBUG(DBG_FUNC, ""); - del_timer(&usbvision->power_off_timer); - INIT_WORK(&usbvision->power_off_work, call_usbvision_power_off); - (void) schedule_work(&usbvision->power_off_work); -} - -void usbvision_init_power_off_timer(struct usb_usbvision *usbvision) -{ - init_timer(&usbvision->power_off_timer); - usbvision->power_off_timer.data = (long)usbvision; - usbvision->power_off_timer.function = usbvision_power_off_timer; -} - -void usbvision_set_power_off_timer(struct usb_usbvision *usbvision) -{ - mod_timer(&usbvision->power_off_timer, jiffies + USBVISION_POWEROFF_TIME); -} - -void usbvision_reset_power_off_timer(struct usb_usbvision *usbvision) -{ - if (timer_pending(&usbvision->power_off_timer)) - del_timer(&usbvision->power_off_timer); -} - -/* * usbvision_begin_streaming() * Sure you have to put bit 7 to 0, if not incoming frames are droped, but no * idea about the rest @@ -2397,8 +2339,8 @@ /* Submit all URBs */ for (buf_idx = 0; buf_idx < USBVISION_NUMSBUF; buf_idx++) { - err_code = usb_submit_urb(usbvision->sbuf[buf_idx].urb, - GFP_KERNEL); + err_code = usb_submit_urb(usbvision->sbuf[buf_idx].urb, + GFP_KERNEL); if (err_code) { dev_err(&usbvision->dev->dev, "%s: usb_submit_urb(%d) failed: error %d\n", @@ -2508,11 +2450,3 @@ usbvision_set_audio(usbvision, audio[channel]); return 0; } - -/* - * Overrides for Emacs so that we follow Linus's tabbing style. - * --------------------------------------------------------------------------- - * Local variables: - * c-basic-offset: 8 - * End: - */