media: uvcvideo: Abstract streaming object lifetime
authorKieran Bingham <kieran.bingham@ideasonboard.com>
Fri, 9 Nov 2018 14:26:10 +0000 (09:26 -0500)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Wed, 5 Dec 2018 08:13:48 +0000 (03:13 -0500)
commitece41454c6a5ed8f301ef1c37710ab222e577823
tree8d6eca34fc8e00de9a68e947efe6628b9ff53695
parent01e90464e42e51b118a95ebb0fb002af1e2e79af
media: uvcvideo: Abstract streaming object lifetime

The streaming object is a key part of handling the UVC device. Although
not critical, we are currently missing a call to destroy the mutex on
clean up paths, and we are due to extend the objects complexity in the
near future.

Facilitate easy management of a stream object by creating a pair of
functions to handle creating and destroying the allocation. The new
uvc_stream_delete() function also performs the missing mutex_destroy()
operation.

Previously a failed streaming object allocation would cause
uvc_parse_streaming() to return -EINVAL, which is inappropriate. If the
constructor failes, we will instead return -ENOMEM.

While we're here, fix the trivial spelling error in the function banner
of uvc_delete().

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/usb/uvc/uvc_driver.c