Commit 87562287 authored by Steve Longerbeam's avatar Steve Longerbeam Committed by Mauro Carvalho Chehab

media: staging/imx: Don't set driver data for v4l2_dev

The media device is already available via multiple methods, there is no
need to set driver data for v4l2_dev to the media device.

In imx_media_link_notify(), get media device from link->graph_obj.mdev.

In imx_media_capture_device_register(), get media device from
v4l2_dev->mdev.
Signed-off-by: default avatarSteve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 3ef46bc9
...@@ -729,15 +729,16 @@ int imx_media_capture_device_register(struct imx_media_video_dev *vdev) ...@@ -729,15 +729,16 @@ int imx_media_capture_device_register(struct imx_media_video_dev *vdev)
{ {
struct capture_priv *priv = to_capture_priv(vdev); struct capture_priv *priv = to_capture_priv(vdev);
struct v4l2_subdev *sd = priv->src_sd; struct v4l2_subdev *sd = priv->src_sd;
struct v4l2_device *v4l2_dev = sd->v4l2_dev;
struct video_device *vfd = vdev->vfd; struct video_device *vfd = vdev->vfd;
struct vb2_queue *vq = &priv->q; struct vb2_queue *vq = &priv->q;
struct v4l2_subdev_format fmt_src; struct v4l2_subdev_format fmt_src;
int ret; int ret;
/* get media device */ /* get media device */
priv->md = dev_get_drvdata(sd->v4l2_dev->dev); priv->md = container_of(v4l2_dev->mdev, struct imx_media_dev, md);
vfd->v4l2_dev = sd->v4l2_dev; vfd->v4l2_dev = v4l2_dev;
ret = video_register_device(vfd, VFL_TYPE_GRABBER, -1); ret = video_register_device(vfd, VFL_TYPE_GRABBER, -1);
if (ret) { if (ret) {
......
...@@ -260,10 +260,11 @@ static int imx_media_inherit_controls(struct imx_media_dev *imxmd, ...@@ -260,10 +260,11 @@ static int imx_media_inherit_controls(struct imx_media_dev *imxmd,
static int imx_media_link_notify(struct media_link *link, u32 flags, static int imx_media_link_notify(struct media_link *link, u32 flags,
unsigned int notification) unsigned int notification)
{ {
struct imx_media_dev *imxmd = container_of(link->graph_obj.mdev,
struct imx_media_dev, md);
struct media_entity *source = link->source->entity; struct media_entity *source = link->source->entity;
struct imx_media_pad_vdev *pad_vdev; struct imx_media_pad_vdev *pad_vdev;
struct list_head *pad_vdev_list; struct list_head *pad_vdev_list;
struct imx_media_dev *imxmd;
struct video_device *vfd; struct video_device *vfd;
struct v4l2_subdev *sd; struct v4l2_subdev *sd;
int pad_idx, ret; int pad_idx, ret;
...@@ -279,8 +280,6 @@ static int imx_media_link_notify(struct media_link *link, u32 flags, ...@@ -279,8 +280,6 @@ static int imx_media_link_notify(struct media_link *link, u32 flags,
sd = media_entity_to_v4l2_subdev(source); sd = media_entity_to_v4l2_subdev(source);
pad_idx = link->source->index; pad_idx = link->source->index;
imxmd = dev_get_drvdata(sd->v4l2_dev->dev);
pad_vdev_list = to_pad_vdev_list(sd, pad_idx); pad_vdev_list = to_pad_vdev_list(sd, pad_idx);
if (!pad_vdev_list) { if (!pad_vdev_list) {
/* nothing to do if source sd has no pad vdev list */ /* nothing to do if source sd has no pad vdev list */
...@@ -384,8 +383,6 @@ struct imx_media_dev *imx_media_dev_init(struct device *dev, ...@@ -384,8 +383,6 @@ struct imx_media_dev *imx_media_dev_init(struct device *dev,
goto cleanup; goto cleanup;
} }
dev_set_drvdata(imxmd->v4l2_dev.dev, imxmd);
INIT_LIST_HEAD(&imxmd->vdev_list); INIT_LIST_HEAD(&imxmd->vdev_list);
v4l2_async_notifier_init(&imxmd->notifier); v4l2_async_notifier_init(&imxmd->notifier);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment