]> git.baikalelectronics.ru Git - kernel.git/commit
media: selftests: media_dev_allocator api test
authorShuah Khan <shuah@kernel.org>
Tue, 2 Apr 2019 00:40:24 +0000 (20:40 -0400)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Mon, 22 Apr 2019 15:23:14 +0000 (11:23 -0400)
commit71a73a9d312693933120ebe28ed5ac130a4620d0
treef9d8ef8ab3feb5db611678ecc6178e5d3787e4cf
parent3065f00389ec1f2a157be32aa97372e63ff5ae4a
media: selftests: media_dev_allocator api test

Add a new test for Media Device Allocator API.

Media Device Allocator API to allows multiple drivers share a media device.
This API solves a very common use-case for media devices where one physical
device (an USB stick) provides both audio and video. When such media device
exposes a standard USB Audio class, a proprietary Video class, two or more
independent drivers will share a single physical USB bridge. In such cases,
it is necessary to coordinate access to the shared resource.

Using this API, drivers can allocate a media device with the shared struct
device as the key. Once the media device is allocated by a driver, other
drivers can get a reference to it. The media device is released when all
the references are released.

This test does a series of unbind/bind tests to make sure media device
is released correctly when it is no longer is use and when the last
driver releases the reference.

Signed-off-by: Shuah Khan <shuah@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
tools/testing/selftests/media_tests/media_dev_allocator.sh [new file with mode: 0755]