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

usb: gadget: uvc: rename functions to avoid conflicts with host uvc

Prepare for separate compilation of uvc function's components.
Some symbols will have to be exported, so rename to avoid
conflicts with functions of the same name in host uvc.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Tested-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
[Rename uvc_video_pump and uvc_queue_head as well]
[Rename forgotten uvc_queue_cancel instance in a comment]
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>

authored by

Andrzej Pietrasiewicz and committed by
Felipe Balbi
7ea95b11 70aacc57

+56 -55
+1 -1
drivers/usb/gadget/function/f_uvc.c
··· 693 693 } 694 694 695 695 /* Initialise video. */ 696 - ret = uvc_video_init(&uvc->video); 696 + ret = uvcg_video_init(&uvc->video); 697 697 if (ret < 0) 698 698 goto error; 699 699
+25 -24
drivers/usb/gadget/function/uvc_queue.c
··· 28 28 /* ------------------------------------------------------------------------ 29 29 * Video buffers queue management. 30 30 * 31 - * Video queues is initialized by uvc_queue_init(). The function performs 31 + * Video queues is initialized by uvcg_queue_init(). The function performs 32 32 * basic initialization of the uvc_video_queue struct and never fails. 33 33 * 34 34 * Video buffers are managed by videobuf2. The driver uses a mutex to protect ··· 126 126 .wait_finish = uvc_wait_finish, 127 127 }; 128 128 129 - static int uvc_queue_init(struct uvc_video_queue *queue, 130 - enum v4l2_buf_type type) 129 + static int uvcg_queue_init(struct uvc_video_queue *queue, 130 + enum v4l2_buf_type type) 131 131 { 132 132 int ret; 133 133 ··· 154 154 /* 155 155 * Free the video buffers. 156 156 */ 157 - static void uvc_free_buffers(struct uvc_video_queue *queue) 157 + static void uvcg_free_buffers(struct uvc_video_queue *queue) 158 158 { 159 159 mutex_lock(&queue->mutex); 160 160 vb2_queue_release(&queue->queue); ··· 164 164 /* 165 165 * Allocate the video buffers. 166 166 */ 167 - static int uvc_alloc_buffers(struct uvc_video_queue *queue, 168 - struct v4l2_requestbuffers *rb) 167 + static int uvcg_alloc_buffers(struct uvc_video_queue *queue, 168 + struct v4l2_requestbuffers *rb) 169 169 { 170 170 int ret; 171 171 ··· 176 176 return ret ? ret : rb->count; 177 177 } 178 178 179 - static int uvc_query_buffer(struct uvc_video_queue *queue, 180 - struct v4l2_buffer *buf) 179 + static int uvcg_query_buffer(struct uvc_video_queue *queue, 180 + struct v4l2_buffer *buf) 181 181 { 182 182 int ret; 183 183 ··· 188 188 return ret; 189 189 } 190 190 191 - static int uvc_queue_buffer(struct uvc_video_queue *queue, 192 - struct v4l2_buffer *buf) 191 + static int uvcg_queue_buffer(struct uvc_video_queue *queue, 192 + struct v4l2_buffer *buf) 193 193 { 194 194 unsigned long flags; 195 195 int ret; ··· 213 213 * Dequeue a video buffer. If nonblocking is false, block until a buffer is 214 214 * available. 215 215 */ 216 - static int uvc_dequeue_buffer(struct uvc_video_queue *queue, 217 - struct v4l2_buffer *buf, int nonblocking) 216 + static int uvcg_dequeue_buffer(struct uvc_video_queue *queue, 217 + struct v4l2_buffer *buf, int nonblocking) 218 218 { 219 219 int ret; 220 220 ··· 231 231 * This function implements video queue polling and is intended to be used by 232 232 * the device poll handler. 233 233 */ 234 - static unsigned int uvc_queue_poll(struct uvc_video_queue *queue, 235 - struct file *file, poll_table *wait) 234 + static unsigned int uvcg_queue_poll(struct uvc_video_queue *queue, 235 + struct file *file, poll_table *wait) 236 236 { 237 237 unsigned int ret; 238 238 ··· 243 243 return ret; 244 244 } 245 245 246 - static int uvc_queue_mmap(struct uvc_video_queue *queue, 247 - struct vm_area_struct *vma) 246 + static int uvcg_queue_mmap(struct uvc_video_queue *queue, 247 + struct vm_area_struct *vma) 248 248 { 249 249 int ret; 250 250 ··· 261 261 * 262 262 * NO-MMU arch need this function to make mmap() work correctly. 263 263 */ 264 - static unsigned long uvc_queue_get_unmapped_area(struct uvc_video_queue *queue, 265 - unsigned long pgoff) 264 + static unsigned long uvcg_queue_get_unmapped_area( 265 + struct uvc_video_queue *queue, 266 + unsigned long pgoff) 266 267 { 267 268 unsigned long ret; 268 269 ··· 286 285 * This function acquires the irq spinlock and can be called from interrupt 287 286 * context. 288 287 */ 289 - static void uvc_queue_cancel(struct uvc_video_queue *queue, int disconnect) 288 + static void uvcg_queue_cancel(struct uvc_video_queue *queue, int disconnect) 290 289 { 291 290 struct uvc_buffer *buf; 292 291 unsigned long flags; ··· 325 324 * the main queue. 326 325 * 327 326 * This function can't be called from interrupt context. Use 328 - * uvc_queue_cancel() instead. 327 + * uvcg_queue_cancel() instead. 329 328 */ 330 - static int uvc_queue_enable(struct uvc_video_queue *queue, int enable) 329 + static int uvcg_queue_enable(struct uvc_video_queue *queue, int enable) 331 330 { 332 331 unsigned long flags; 333 332 int ret = 0; ··· 364 363 } 365 364 366 365 /* called with &queue_irqlock held.. */ 367 - static struct uvc_buffer *uvc_queue_next_buffer(struct uvc_video_queue *queue, 368 - struct uvc_buffer *buf) 366 + static struct uvc_buffer *uvcg_queue_next_buffer(struct uvc_video_queue *queue, 367 + struct uvc_buffer *buf) 369 368 { 370 369 struct uvc_buffer *nextbuf; 371 370 ··· 393 392 return nextbuf; 394 393 } 395 394 396 - static struct uvc_buffer *uvc_queue_head(struct uvc_video_queue *queue) 395 + static struct uvc_buffer *uvcg_queue_head(struct uvc_video_queue *queue) 397 396 { 398 397 struct uvc_buffer *buf = NULL; 399 398
+13 -13
drivers/usb/gadget/function/uvc_v4l2.c
··· 149 149 if (b->type != video->queue.queue.type) 150 150 return -EINVAL; 151 151 152 - return uvc_alloc_buffers(&video->queue, b); 152 + return uvcg_alloc_buffers(&video->queue, b); 153 153 } 154 154 155 155 static int ··· 159 159 struct uvc_device *uvc = video_get_drvdata(vdev); 160 160 struct uvc_video *video = &uvc->video; 161 161 162 - return uvc_query_buffer(&video->queue, b); 162 + return uvcg_query_buffer(&video->queue, b); 163 163 } 164 164 165 165 static int ··· 170 170 struct uvc_video *video = &uvc->video; 171 171 int ret; 172 172 173 - ret = uvc_queue_buffer(&video->queue, b); 173 + ret = uvcg_queue_buffer(&video->queue, b); 174 174 if (ret < 0) 175 175 return ret; 176 176 177 - return uvc_video_pump(video); 177 + return uvcg_video_pump(video); 178 178 } 179 179 180 180 static int ··· 184 184 struct uvc_device *uvc = video_get_drvdata(vdev); 185 185 struct uvc_video *video = &uvc->video; 186 186 187 - return uvc_dequeue_buffer(&video->queue, b, file->f_flags & O_NONBLOCK); 187 + return uvcg_dequeue_buffer(&video->queue, b, file->f_flags & O_NONBLOCK); 188 188 } 189 189 190 190 static int ··· 199 199 return -EINVAL; 200 200 201 201 /* Enable UVC video. */ 202 - ret = uvc_video_enable(video, 1); 202 + ret = uvcg_video_enable(video, 1); 203 203 if (ret < 0) 204 204 return ret; 205 205 ··· 223 223 if (type != video->queue.queue.type) 224 224 return -EINVAL; 225 225 226 - return uvc_video_enable(video, 0); 226 + return uvcg_video_enable(video, 0); 227 227 } 228 228 229 229 static int ··· 309 309 310 310 uvc_function_disconnect(uvc); 311 311 312 - uvc_video_enable(video, 0); 313 - uvc_free_buffers(&video->queue); 312 + uvcg_video_enable(video, 0); 313 + uvcg_free_buffers(&video->queue); 314 314 315 315 file->private_data = NULL; 316 316 v4l2_fh_del(&handle->vfh); ··· 326 326 struct video_device *vdev = video_devdata(file); 327 327 struct uvc_device *uvc = video_get_drvdata(vdev); 328 328 329 - return uvc_queue_mmap(&uvc->video.queue, vma); 329 + return uvcg_queue_mmap(&uvc->video.queue, vma); 330 330 } 331 331 332 332 static unsigned int ··· 335 335 struct video_device *vdev = video_devdata(file); 336 336 struct uvc_device *uvc = video_get_drvdata(vdev); 337 337 338 - return uvc_queue_poll(&uvc->video.queue, file, wait); 338 + return uvcg_queue_poll(&uvc->video.queue, file, wait); 339 339 } 340 340 341 341 #ifndef CONFIG_MMU ··· 346 346 struct video_device *vdev = video_devdata(file); 347 347 struct uvc_device *uvc = video_get_drvdata(vdev); 348 348 349 - return uvc_queue_get_unmapped_area(&uvc->video.queue, pgoff); 349 + return uvcg_queue_get_unmapped_area(&uvc->video.queue, pgoff); 350 350 } 351 351 #endif 352 352 ··· 358 358 .mmap = uvc_v4l2_mmap, 359 359 .poll = uvc_v4l2_poll, 360 360 #ifndef CONFIG_MMU 361 - .get_unmapped_area = uvc_v4l2_get_unmapped_area, 361 + .get_unmapped_area = uvcg_v4l2_get_unmapped_area, 362 362 #endif 363 363 }; 364 364
+17 -17
drivers/usb/gadget/function/uvc_video.c
··· 85 85 if (buf->bytesused == video->queue.buf_used) { 86 86 video->queue.buf_used = 0; 87 87 buf->state = UVC_BUF_STATE_DONE; 88 - uvc_queue_next_buffer(&video->queue, buf); 88 + uvcg_queue_next_buffer(&video->queue, buf); 89 89 video->fid ^= UVC_STREAM_FID; 90 90 91 91 video->payload_size = 0; ··· 118 118 if (buf->bytesused == video->queue.buf_used) { 119 119 video->queue.buf_used = 0; 120 120 buf->state = UVC_BUF_STATE_DONE; 121 - uvc_queue_next_buffer(&video->queue, buf); 121 + uvcg_queue_next_buffer(&video->queue, buf); 122 122 video->fid ^= UVC_STREAM_FID; 123 123 } 124 124 } ··· 172 172 173 173 case -ESHUTDOWN: /* disconnect from host. */ 174 174 printk(KERN_DEBUG "VS request cancelled.\n"); 175 - uvc_queue_cancel(queue, 1); 175 + uvcg_queue_cancel(queue, 1); 176 176 goto requeue; 177 177 178 178 default: 179 179 printk(KERN_INFO "VS request completed with status %d.\n", 180 180 req->status); 181 - uvc_queue_cancel(queue, 0); 181 + uvcg_queue_cancel(queue, 0); 182 182 goto requeue; 183 183 } 184 184 185 185 spin_lock_irqsave(&video->queue.irqlock, flags); 186 - buf = uvc_queue_head(&video->queue); 186 + buf = uvcg_queue_head(&video->queue); 187 187 if (buf == NULL) { 188 188 spin_unlock_irqrestore(&video->queue.irqlock, flags); 189 189 goto requeue; ··· 195 195 printk(KERN_INFO "Failed to queue request (%d).\n", ret); 196 196 usb_ep_set_halt(ep); 197 197 spin_unlock_irqrestore(&video->queue.irqlock, flags); 198 - uvc_queue_cancel(queue, 0); 198 + uvcg_queue_cancel(queue, 0); 199 199 goto requeue; 200 200 } 201 201 spin_unlock_irqrestore(&video->queue.irqlock, flags); ··· 274 274 */ 275 275 276 276 /* 277 - * uvc_video_pump - Pump video data into the USB requests 277 + * uvcg_video_pump - Pump video data into the USB requests 278 278 * 279 279 * This function fills the available USB requests (listed in req_free) with 280 280 * video data from the queued buffers. 281 281 */ 282 282 static int 283 - uvc_video_pump(struct uvc_video *video) 283 + uvcg_video_pump(struct uvc_video *video) 284 284 { 285 285 struct uvc_video_queue *queue = &video->queue; 286 286 struct usb_request *req; ··· 288 288 unsigned long flags; 289 289 int ret; 290 290 291 - /* FIXME TODO Race between uvc_video_pump and requests completion 291 + /* FIXME TODO Race between uvcg_video_pump and requests completion 292 292 * handler ??? 293 293 */ 294 294 ··· 310 310 * request, protected by the video queue irqlock. 311 311 */ 312 312 spin_lock_irqsave(&video->queue.irqlock, flags); 313 - buf = uvc_queue_head(&video->queue); 313 + buf = uvcg_queue_head(&video->queue); 314 314 if (buf == NULL) { 315 315 spin_unlock_irqrestore(&video->queue.irqlock, flags); 316 316 break; ··· 324 324 printk(KERN_INFO "Failed to queue request (%d)\n", ret); 325 325 usb_ep_set_halt(video->ep); 326 326 spin_unlock_irqrestore(&video->queue.irqlock, flags); 327 - uvc_queue_cancel(queue, 0); 327 + uvcg_queue_cancel(queue, 0); 328 328 break; 329 329 } 330 330 spin_unlock_irqrestore(&video->queue.irqlock, flags); ··· 340 340 * Enable or disable the video stream. 341 341 */ 342 342 static int 343 - uvc_video_enable(struct uvc_video *video, int enable) 343 + uvcg_video_enable(struct uvc_video *video, int enable) 344 344 { 345 345 unsigned int i; 346 346 int ret; ··· 356 356 usb_ep_dequeue(video->ep, video->req[i]); 357 357 358 358 uvc_video_free_requests(video); 359 - uvc_queue_enable(&video->queue, 0); 359 + uvcg_queue_enable(&video->queue, 0); 360 360 return 0; 361 361 } 362 362 363 - if ((ret = uvc_queue_enable(&video->queue, 1)) < 0) 363 + if ((ret = uvcg_queue_enable(&video->queue, 1)) < 0) 364 364 return ret; 365 365 366 366 if ((ret = uvc_video_alloc_requests(video)) < 0) ··· 372 372 } else 373 373 video->encode = uvc_video_encode_isoc; 374 374 375 - return uvc_video_pump(video); 375 + return uvcg_video_pump(video); 376 376 } 377 377 378 378 /* 379 379 * Initialize the UVC video stream. 380 380 */ 381 381 static int 382 - uvc_video_init(struct uvc_video *video) 382 + uvcg_video_init(struct uvc_video *video) 383 383 { 384 384 INIT_LIST_HEAD(&video->req_free); 385 385 spin_lock_init(&video->req_lock); ··· 391 391 video->imagesize = 320 * 240 * 2; 392 392 393 393 /* Initialize the video buffers queue. */ 394 - uvc_queue_init(&video->queue, V4L2_BUF_TYPE_VIDEO_OUTPUT); 394 + uvcg_queue_init(&video->queue, V4L2_BUF_TYPE_VIDEO_OUTPUT); 395 395 return 0; 396 396 } 397 397