media: v4l2-subdev: handle module refcounting here
The module ownership refcounting was done in media_entity_get/put, but that was very confusing and it did not work either in case an application had a v4l-subdevX device open and the module was unbound. When the v4l-subdevX device was closed the media_entity_put was never called and the module refcount was left one too high, making it impossible to unload it. Since v4l2-subdev.c was the only place where media_entity_get/put was called, just move the functionality to v4l2-subdev.c and drop those confusing entity functions. Store the module in subdev_fh so module_put no longer depends on the media_entity struct. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
This commit is contained in:

committed by
Mauro Carvalho Chehab

parent
0e43734d4c
commit
218bf10e39
@@ -910,9 +910,11 @@ struct v4l2_subdev {
|
||||
*
|
||||
* @vfh: pointer to &struct v4l2_fh
|
||||
* @pad: pointer to &struct v4l2_subdev_pad_config
|
||||
* @owner: module pointer to the owner of this file handle
|
||||
*/
|
||||
struct v4l2_subdev_fh {
|
||||
struct v4l2_fh vfh;
|
||||
struct module *owner;
|
||||
#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
|
||||
struct v4l2_subdev_pad_config *pad;
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user