stk1160-v4l.c (ead5d1f4d877e92c051e1a1ade623d0d30e71619) | stk1160-v4l.c (fbe04b49a54e31f4321d632270207f0e6304cd16) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * STK1160 driver 4 * 5 * Copyright (C) 2012 Ezequiel Garcia 6 * <elezegarcia--a.t--gmail.com> 7 * 8 * Based on Easycap driver by R.M. Thomas --- 244 unchanged lines hidden (view full) --- 253 mutex_unlock(&dev->v4l_lock); 254 255 return 0; 256 257out_uninit: 258 stk1160_uninit_isoc(dev); 259out_stop_hw: 260 usb_set_interface(dev->udev, 0, 0); | 1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * STK1160 driver 4 * 5 * Copyright (C) 2012 Ezequiel Garcia 6 * <elezegarcia--a.t--gmail.com> 7 * 8 * Based on Easycap driver by R.M. Thomas --- 244 unchanged lines hidden (view full) --- 253 mutex_unlock(&dev->v4l_lock); 254 255 return 0; 256 257out_uninit: 258 stk1160_uninit_isoc(dev); 259out_stop_hw: 260 usb_set_interface(dev->udev, 0, 0); |
261 stk1160_clear_queue(dev); | 261 stk1160_clear_queue(dev, VB2_BUF_STATE_QUEUED); |
262 263 mutex_unlock(&dev->v4l_lock); 264 265 return rc; 266} 267 268/* Must be called with v4l_lock hold */ 269static void stk1160_stop_hw(struct stk1160 *dev) --- 31 unchanged lines hidden (view full) --- 301 * It is possible to keep buffers around using a module parameter. 302 * This is intended to avoid memory fragmentation. 303 */ 304 if (!keep_buffers) 305 stk1160_free_isoc(dev); 306 307 stk1160_stop_hw(dev); 308 | 262 263 mutex_unlock(&dev->v4l_lock); 264 265 return rc; 266} 267 268/* Must be called with v4l_lock hold */ 269static void stk1160_stop_hw(struct stk1160 *dev) --- 31 unchanged lines hidden (view full) --- 301 * It is possible to keep buffers around using a module parameter. 302 * This is intended to avoid memory fragmentation. 303 */ 304 if (!keep_buffers) 305 stk1160_free_isoc(dev); 306 307 stk1160_stop_hw(dev); 308 |
309 stk1160_clear_queue(dev); | 309 stk1160_clear_queue(dev, VB2_BUF_STATE_ERROR); |
310 311 stk1160_dbg("streaming stopped\n"); 312 313 mutex_unlock(&dev->v4l_lock); 314 315 return 0; 316} 317 --- 422 unchanged lines hidden (view full) --- 740 .fops = &stk1160_fops, 741 .ioctl_ops = &stk1160_ioctl_ops, 742 .release = video_device_release_empty, 743}; 744 745/********************************************************************/ 746 747/* Must be called with both v4l_lock and vb_queue_lock hold */ | 310 311 stk1160_dbg("streaming stopped\n"); 312 313 mutex_unlock(&dev->v4l_lock); 314 315 return 0; 316} 317 --- 422 unchanged lines hidden (view full) --- 740 .fops = &stk1160_fops, 741 .ioctl_ops = &stk1160_ioctl_ops, 742 .release = video_device_release_empty, 743}; 744 745/********************************************************************/ 746 747/* Must be called with both v4l_lock and vb_queue_lock hold */ |
748void stk1160_clear_queue(struct stk1160 *dev) | 748void stk1160_clear_queue(struct stk1160 *dev, enum vb2_buffer_state vb2_state) |
749{ 750 struct stk1160_buffer *buf; 751 unsigned long flags; 752 753 /* Release all active buffers */ 754 spin_lock_irqsave(&dev->buf_lock, flags); 755 while (!list_empty(&dev->avail_bufs)) { 756 buf = list_first_entry(&dev->avail_bufs, 757 struct stk1160_buffer, list); 758 list_del(&buf->list); | 749{ 750 struct stk1160_buffer *buf; 751 unsigned long flags; 752 753 /* Release all active buffers */ 754 spin_lock_irqsave(&dev->buf_lock, flags); 755 while (!list_empty(&dev->avail_bufs)) { 756 buf = list_first_entry(&dev->avail_bufs, 757 struct stk1160_buffer, list); 758 list_del(&buf->list); |
759 vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR); | 759 vb2_buffer_done(&buf->vb.vb2_buf, vb2_state); |
760 stk1160_dbg("buffer [%p/%d] aborted\n", 761 buf, buf->vb.vb2_buf.index); 762 } 763 764 /* It's important to release the current buffer */ 765 if (dev->isoc_ctl.buf) { 766 buf = dev->isoc_ctl.buf; 767 dev->isoc_ctl.buf = NULL; 768 | 760 stk1160_dbg("buffer [%p/%d] aborted\n", 761 buf, buf->vb.vb2_buf.index); 762 } 763 764 /* It's important to release the current buffer */ 765 if (dev->isoc_ctl.buf) { 766 buf = dev->isoc_ctl.buf; 767 dev->isoc_ctl.buf = NULL; 768 |
769 vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR); | 769 vb2_buffer_done(&buf->vb.vb2_buf, vb2_state); |
770 stk1160_dbg("buffer [%p/%d] aborted\n", 771 buf, buf->vb.vb2_buf.index); 772 } 773 spin_unlock_irqrestore(&dev->buf_lock, flags); 774} 775 776int stk1160_vb2_setup(struct stk1160 *dev) 777{ --- 66 unchanged lines hidden --- | 770 stk1160_dbg("buffer [%p/%d] aborted\n", 771 buf, buf->vb.vb2_buf.index); 772 } 773 spin_unlock_irqrestore(&dev->buf_lock, flags); 774} 775 776int stk1160_vb2_setup(struct stk1160 *dev) 777{ --- 66 unchanged lines hidden --- |