Commit e83ce300 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab
Browse files

media: media/radio: set device_caps in struct video_device



Instead of filling in the struct v4l2_capability device_caps
field, fill in the struct video_device device_caps field.

That way the V4L2 core knows what the capabilities of the
video device are.

But this only really works if all drivers use this, so convert
all radio drivers in this patch.

Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 7e98b7b5
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -177,8 +177,6 @@ static int vidioc_querycap(struct file *file, void *priv,
	strscpy(v->driver, "dsbr100", sizeof(v->driver));
	strscpy(v->card, "D-Link R-100 USB FM Radio", sizeof(v->card));
	usb_make_path(radio->usbdev, v->bus_info, sizeof(v->bus_info));
	v->device_caps = V4L2_CAP_RADIO | V4L2_CAP_TUNER;
	v->capabilities = v->device_caps | V4L2_CAP_DEVICE_CAPS;
	return 0;
}

@@ -387,6 +385,7 @@ static int usb_dsbr100_probe(struct usb_interface *intf,
	radio->videodev.release = video_device_release_empty;
	radio->videodev.lock = &radio->v4l2_lock;
	radio->videodev.ctrl_handler = &radio->hdl;
	radio->videodev.device_caps = V4L2_CAP_RADIO | V4L2_CAP_TUNER;

	radio->usbdev = interface_to_usbdev(intf);
	radio->curfreq = FREQ_MIN * FREQ_MUL;
+2 −3
Original line number Diff line number Diff line
@@ -357,9 +357,6 @@ static int vidioc_querycap(struct file *file, void *priv,
	strscpy(v->driver, "ADS Cadet", sizeof(v->driver));
	strscpy(v->card, "ADS Cadet", sizeof(v->card));
	strscpy(v->bus_info, "ISA:radio-cadet", sizeof(v->bus_info));
	v->device_caps = V4L2_CAP_TUNER | V4L2_CAP_RADIO |
			  V4L2_CAP_READWRITE | V4L2_CAP_RDS_CAPTURE;
	v->capabilities = v->device_caps | V4L2_CAP_DEVICE_CAPS;
	return 0;
}

@@ -646,6 +643,8 @@ static int __init cadet_init(void)
	dev->vdev.ioctl_ops = &cadet_ioctl_ops;
	dev->vdev.release = video_device_release_empty;
	dev->vdev.lock = &dev->lock;
	dev->vdev.device_caps = V4L2_CAP_TUNER | V4L2_CAP_RADIO |
				V4L2_CAP_READWRITE | V4L2_CAP_RDS_CAPTURE;
	video_set_drvdata(&dev->vdev, dev);

	res = video_register_device(&dev->vdev, VFL_TYPE_RADIO, radio_nr);
+1 −3
Original line number Diff line number Diff line
@@ -45,9 +45,6 @@ static int radio_isa_querycap(struct file *file, void *priv,
	strscpy(v->driver, isa->drv->driver.driver.name, sizeof(v->driver));
	strscpy(v->card, isa->drv->card, sizeof(v->card));
	snprintf(v->bus_info, sizeof(v->bus_info), "ISA:%s", isa->v4l2_dev.name);

	v->device_caps = V4L2_CAP_TUNER | V4L2_CAP_RADIO;
	v->capabilities = v->device_caps | V4L2_CAP_DEVICE_CAPS;
	return 0;
}

@@ -248,6 +245,7 @@ static int radio_isa_common_probe(struct radio_isa_card *isa,
	isa->vdev.fops = &radio_isa_fops;
	isa->vdev.ioctl_ops = &radio_isa_ioctl_ops;
	isa->vdev.release = video_device_release_empty;
	isa->vdev.device_caps = V4L2_CAP_TUNER | V4L2_CAP_RADIO;
	video_set_drvdata(&isa->vdev, isa);
	isa->freq = FREQ_LOW;
	isa->stereo = drv->has_stereo;
+1 −2
Original line number Diff line number Diff line
@@ -177,8 +177,6 @@ static int vidioc_querycap(struct file *file, void *priv,
	strscpy(v->driver, "radio-keene", sizeof(v->driver));
	strscpy(v->card, "Keene FM Transmitter", sizeof(v->card));
	usb_make_path(radio->usbdev, v->bus_info, sizeof(v->bus_info));
	v->device_caps = V4L2_CAP_RADIO | V4L2_CAP_MODULATOR;
	v->capabilities = v->device_caps | V4L2_CAP_DEVICE_CAPS;
	return 0;
}

@@ -370,6 +368,7 @@ static int usb_keene_probe(struct usb_interface *intf,
	radio->vdev.lock = &radio->lock;
	radio->vdev.release = video_device_release_empty;
	radio->vdev.vfl_dir = VFL_DIR_TX;
	radio->vdev.device_caps = V4L2_CAP_RADIO | V4L2_CAP_MODULATOR;

	radio->usbdev = interface_to_usbdev(intf);
	radio->intf = intf;
+1 −2
Original line number Diff line number Diff line
@@ -200,8 +200,6 @@ static int vidioc_querycap(struct file *file, void *priv,
	strscpy(v->driver, "radio-ma901", sizeof(v->driver));
	strscpy(v->card, "Masterkit MA901 USB FM Radio", sizeof(v->card));
	usb_make_path(radio->usbdev, v->bus_info, sizeof(v->bus_info));
	v->device_caps = V4L2_CAP_RADIO | V4L2_CAP_TUNER;
	v->capabilities = v->device_caps | V4L2_CAP_DEVICE_CAPS;
	return 0;
}

@@ -407,6 +405,7 @@ static int usb_ma901radio_probe(struct usb_interface *intf,
	radio->vdev.ioctl_ops = &usb_ma901radio_ioctl_ops;
	radio->vdev.release = video_device_release_empty;
	radio->vdev.lock = &radio->lock;
	radio->vdev.device_caps = V4L2_CAP_RADIO | V4L2_CAP_TUNER;

	radio->usbdev = interface_to_usbdev(intf);
	radio->intf = intf;
Loading