*/
 
 #include <linux/bitmap.h>
-#include <linux/module.h>
 #include <linux/property.h>
 #include <linux/slab.h>
 #include <media/media-entity.h>
 }
 EXPORT_SYMBOL_GPL(media_pipeline_stop);
 
-/* -----------------------------------------------------------------------------
- * Module use count
- */
-
-struct media_entity *media_entity_get(struct media_entity *entity)
-{
-       if (entity == NULL)
-               return NULL;
-
-       if (entity->graph_obj.mdev->dev &&
-           !try_module_get(entity->graph_obj.mdev->dev->driver->owner))
-               return NULL;
-
-       return entity;
-}
-EXPORT_SYMBOL_GPL(media_entity_get);
-
-void media_entity_put(struct media_entity *entity)
-{
-       if (entity == NULL)
-               return;
-
-       if (entity->graph_obj.mdev->dev)
-               module_put(entity->graph_obj.mdev->dev->driver->owner);
-}
-EXPORT_SYMBOL_GPL(media_entity_put);
-
 /* -----------------------------------------------------------------------------
  * Links management
  */
 
 
 #include <linux/ioctl.h>
 #include <linux/mm.h>
+#include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/types.h>
 #include <linux/videodev2.h>
        struct video_device *vdev = video_devdata(file);
        struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev);
        struct v4l2_subdev_fh *subdev_fh;
-#if defined(CONFIG_MEDIA_CONTROLLER)
-       struct media_entity *entity = NULL;
-#endif
        int ret;
 
        subdev_fh = kzalloc(sizeof(*subdev_fh), GFP_KERNEL);
        v4l2_fh_add(&subdev_fh->vfh);
        file->private_data = &subdev_fh->vfh;
 #if defined(CONFIG_MEDIA_CONTROLLER)
-       if (sd->v4l2_dev->mdev) {
-               entity = media_entity_get(&sd->entity);
-               if (!entity) {
+       if (sd->v4l2_dev->mdev && sd->entity.graph_obj.mdev->dev) {
+               struct module *owner;
+
+               owner = sd->entity.graph_obj.mdev->dev->driver->owner;
+               if (!try_module_get(owner)) {
                        ret = -EBUSY;
                        goto err;
                }
+               subdev_fh->owner = owner;
        }
 #endif
 
        return 0;
 
 err:
-#if defined(CONFIG_MEDIA_CONTROLLER)
-       media_entity_put(entity);
-#endif
+       module_put(subdev_fh->owner);
        v4l2_fh_del(&subdev_fh->vfh);
        v4l2_fh_exit(&subdev_fh->vfh);
        subdev_fh_free(subdev_fh);
 
        if (sd->internal_ops && sd->internal_ops->close)
                sd->internal_ops->close(sd, subdev_fh);
-#if defined(CONFIG_MEDIA_CONTROLLER)
-       if (sd->v4l2_dev->mdev)
-               media_entity_put(&sd->entity);
-#endif
+       module_put(subdev_fh->owner);
        v4l2_fh_del(vfh);
        v4l2_fh_exit(vfh);
        subdev_fh_free(subdev_fh);
 
  */
 struct media_pad *media_entity_remote_pad(const struct media_pad *pad);
 
-/**
- * media_entity_get - Get a reference to the parent module
- *
- * @entity: The entity
- *
- * Get a reference to the parent media device module.
- *
- * The function will return immediately if @entity is %NULL.
- *
- * Return: returns a pointer to the entity on success or %NULL on failure.
- */
-struct media_entity *media_entity_get(struct media_entity *entity);
-
 /**
  * media_entity_get_fwnode_pad - Get pad number from fwnode
  *
  */
 void media_graph_walk_cleanup(struct media_graph *graph);
 
-/**
- * media_entity_put - Release the reference to the parent module
- *
- * @entity: The entity
- *
- * Release the reference count acquired by media_entity_get().
- *
- * The function will return immediately if @entity is %NULL.
- */
-void media_entity_put(struct media_entity *entity);
-
 /**
  * media_graph_walk_start - Start walking the media graph at a
  *     given entity
 
  *
  * @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