aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2013-06-22 11:46:50 +0200
committerHans Verkuil <hans.verkuil@cisco.com>2013-06-22 11:56:45 +0200
commita38dc19c141c6b777f7044981c82f63cd01639a1 (patch)
tree32acf7c62eaa39d8b97ee731d8b2052e2b956c39
parenta04864981d0f9a7eaefab595471cb36168cd4f00 (diff)
wl128x: call video_register_device last, enable prio handling
video_register_device must be called last. This patch also sets the prio flag, allowing the core to handle priorities. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
-rw-r--r--drivers/media/radio/wl128x/fmdrv_v4l2.c39
1 files changed, 23 insertions, 16 deletions
diff --git a/drivers/media/radio/wl128x/fmdrv_v4l2.c b/drivers/media/radio/wl128x/fmdrv_v4l2.c
index 337068d763df..65663647bfd9 100644
--- a/drivers/media/radio/wl128x/fmdrv_v4l2.c
+++ b/drivers/media/radio/wl128x/fmdrv_v4l2.c
@@ -518,35 +518,25 @@ int fm_v4l2_init_video_device(struct fmdev *fmdev, int radio_nr)
gradio_dev = video_device_alloc();
if (NULL == gradio_dev) {
fmerr("Can't allocate video device\n");
- return -ENOMEM;
+ ret = -ENOMEM;
+ goto unreg_v4l2;
}
/* Setup FM driver's V4L2 properties */
- memcpy(gradio_dev, &fm_viddev_template, sizeof(fm_viddev_template));
+ *gradio_dev = fm_viddev_template;
video_set_drvdata(gradio_dev, fmdev);
gradio_dev->lock = &fmdev->mutex;
gradio_dev->v4l2_dev = &fmdev->v4l2_dev;
-
- /* Register with V4L2 subsystem as RADIO device */
- if (video_register_device(gradio_dev, VFL_TYPE_RADIO, radio_nr)) {
- video_device_release(gradio_dev);
- fmerr("Could not register video device\n");
- return -ENOMEM;
- }
+ set_bit(V4L2_FL_USE_FH_PRIO, &gradio_dev->flags);
fmdev->radio_dev = gradio_dev;
/* Register to v4l2 ctrl handler framework */
fmdev->radio_dev->ctrl_handler = &fmdev->ctrl_handler;
- ret = v4l2_ctrl_handler_init(&fmdev->ctrl_handler, 5);
- if (ret < 0) {
- fmerr("(fmdev): Can't init ctrl handler\n");
- v4l2_ctrl_handler_free(&fmdev->ctrl_handler);
- return -EBUSY;
- }
+ v4l2_ctrl_handler_init(&fmdev->ctrl_handler, 5);
/*
* Following controls are handled by V4L2 control framework.
@@ -573,15 +563,32 @@ int fm_v4l2_init_video_device(struct fmdev *fmdev, int radio_nr)
if (ctrl)
ctrl->flags |= V4L2_CTRL_FLAG_VOLATILE;
+ ret = fmdev->ctrl_handler.error;
+ if (ret < 0) {
+ fmerr("(fmdev): Can't init ctrl handler\n");
+ goto free_hdl;
+ }
+ /* Register with V4L2 subsystem as RADIO device */
+ ret = video_register_device(gradio_dev, VFL_TYPE_RADIO, radio_nr);
+ if (ret < 0) {
+ fmerr("Could not register video device\n");
+ goto free_hdl;
+ }
return 0;
+
+free_hdl:
+ v4l2_ctrl_handler_free(&fmdev->ctrl_handler);
+ video_device_release(gradio_dev);
+unreg_v4l2:
+ v4l2_device_unregister(&fmdev->v4l2_dev);
+ return ret;
}
void *fm_v4l2_deinit_video_device(void)
{
struct fmdev *fmdev;
-
fmdev = video_get_drvdata(gradio_dev);
/* Unregister to v4l2 ctrl handler framework*/

Privacy Policy