Re: [PATCH 1/2] media: vivid: Don't explicitly set bus_info

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 29/11/2023 15:15, Sakari Ailus wrote:
> The bus_info field in both struct media_device and struct v4l2_capability
> is assigned by the framework for platform devices. Do not set it in the
> driver.

That doesn't work for vivid. The problem is that if you create multiple instances
(e.g. modprobe vivid n_devs=2), then each instance will report "platform:vivid.0"
as bus info, but they must give different bus_info names since that has to be unique.

It should be fine for vimc, though, since that's just a single instance.

So vivid is an exception to the rule. Rather than removing these snprintf lines,
adding a comment might be better.

For the record: I tried exactly the same thing myself some time ago, and then
discovered that that didn't fly.

Regards,

	Hans

> 
> Signed-off-by: Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx>
> ---
>  drivers/media/test-drivers/vivid/vivid-core.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/drivers/media/test-drivers/vivid/vivid-core.c b/drivers/media/test-drivers/vivid/vivid-core.c
> index 353f035fcd19..fdd070876a6d 100644
> --- a/drivers/media/test-drivers/vivid/vivid-core.c
> +++ b/drivers/media/test-drivers/vivid/vivid-core.c
> @@ -239,8 +239,6 @@ static int vidioc_querycap(struct file *file, void  *priv,
>  
>  	strscpy(cap->driver, "vivid", sizeof(cap->driver));
>  	strscpy(cap->card, "vivid", sizeof(cap->card));
> -	snprintf(cap->bus_info, sizeof(cap->bus_info),
> -		 "platform:%s-%03d", VIVID_MODULE_NAME, dev->inst);
>  
>  	cap->capabilities = dev->vid_cap_caps | dev->vid_out_caps |
>  		dev->vbi_cap_caps | dev->vbi_out_caps |
> @@ -1762,8 +1760,6 @@ static int vivid_create_instance(struct platform_device *pdev, int inst)
>  
>  	/* Initialize media device */
>  	strscpy(dev->mdev.model, VIVID_MODULE_NAME, sizeof(dev->mdev.model));
> -	snprintf(dev->mdev.bus_info, sizeof(dev->mdev.bus_info),
> -		 "platform:%s-%03d", VIVID_MODULE_NAME, inst);
>  	dev->mdev.dev = &pdev->dev;
>  	media_device_init(&dev->mdev);
>  	dev->mdev.ops = &vivid_media_ops;





[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux