OSDN Git Service

media: uvcvideo: Abstract streaming object lifetime
authorKieran Bingham <kieran.bingham@ideasonboard.com>
Fri, 9 Nov 2018 14:26:10 +0000 (09:26 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 13 Dec 2019 07:52:27 +0000 (08:52 +0100)
commit5146add60adf31ae4d02cfac0150eb8f8d3aa9b7
tree4dc41d0141515ea432e2ad6098aeeef3fad6d16c
parent1ff89e6d4b2332801bfaf5ab3cfd6660b7096bd0
media: uvcvideo: Abstract streaming object lifetime

[ Upstream commit ece41454c6a5ed8f301ef1c37710ab222e577823 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/usb/uvc/uvc_driver.c