On 6/13/19 2:44 AM, Hans Verkuil wrote:
On 5/24/19 5:31 AM, Shuah Khan wrote:
media_device is embedded in struct vimc_device and when vimc is removed
vimc_device and the embedded media_device goes with it, while the active
stream and vimc_capture continue to access it.
Fix the media_device lifetime problem by changing vimc to create shared
media_device using Media Device Allocator API and vimc_capture getting
a reference to vimc module. With this change, vimc module can be removed
only when the references are gone. vimc can be removed after vimc_capture
is removed.
Media Device Allocator API supports just USB devices. Enhance it
adding a genetic device allocate interface to support other media
drivers.
The new interface takes pointer to struct device instead and creates
media device. This interface allows a group of drivers that have a
common root device to share media device resource and ensure media
device doesn't get deleted as long as one of the drivers holds its
reference.
The new interface has been tested with vimc component driver to fix
panics when vimc module is removed while streaming is in progress.
Helen, can you review this series? I'm not sure this is the right approach
for a driver like vimc, and even if it is, then it is odd that vimc-capture
is the only vimc module that's handled here.
Hi Hans,
Yes, I can take a look. Sorry, I've been a bit busy these days but I'll
try to take a look at this patch series (and the others) asap.
Helen
My gut feeling is that this should be handled inside vimc directly and not
using the media-dev-allocator.