On 04/12/2018 10:54 AM, Tomasz Figa wrote: > On Mon, Apr 9, 2018 at 11:21 PM Hans Verkuil <hverkuil@xxxxxxxxx> wrote: > >> From: Alexandre Courbot <acourbot@xxxxxxxxxxxx> > >> Request API requires a media node. Add one to the vim2m driver so we can >> use requests with it. > >> This probably needs a bit more work to correctly represent m2m >> hardware in the media topology. > [snip] >> @@ -1013,6 +1012,22 @@ static int vim2m_probe(struct platform_device > *pdev) >> vfd->lock = &dev->dev_mutex; >> vfd->v4l2_dev = &dev->v4l2_dev; > >> +#ifdef CONFIG_MEDIA_CONTROLLER >> + dev->mdev.dev = &pdev->dev; >> + strlcpy(dev->mdev.model, "vim2m", sizeof(dev->mdev.model)); >> + media_device_init(&dev->mdev); >> + dev->v4l2_dev.mdev = &dev->mdev; >> + dev->pad[0].flags = MEDIA_PAD_FL_SINK; >> + dev->pad[1].flags = MEDIA_PAD_FL_SOURCE; >> + ret = media_entity_pads_init(&vfd->entity, 2, dev->pad); >> + if (ret) >> + return ret; > > Hmm, what are these pads linked to? Nothing. It's a quick hack, needs more work. > > [snip] >> @@ -1050,6 +1076,13 @@ static int vim2m_remove(struct platform_device > *pdev) >> struct vim2m_dev *dev = platform_get_drvdata(pdev); > >> v4l2_info(&dev->v4l2_dev, "Removing " MEM2MEM_NAME); >> + >> +#ifdef CONFIG_MEDIA_CONTROLLER >> + if (media_devnode_is_registered(dev->mdev.devnode)) > > Do we need to check this? Probe seems to fail if media device fails to > register. This was copy-and-paste from somewhere. I agree, this can be dropped. Regards, Hans > > Best regards, > Tomasz >