diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2015-03-09 12:34:07 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-04-02 22:35:52 -0400 |
commit | cab9bf11f8ef433151a15b9519e3e0a56302c9a4 (patch) | |
tree | db5b9947561de60d2206bfa0f9fac2d626a557d5 /drivers/media/radio | |
parent | 650e629bf7a782ce3c646f12a0ec381147b2c9b9 (diff) |
[media] wl128x: embed video_device
Embed the video_device struct to simplify the error handling and in
order to (eventually) get rid of video_device_alloc/release.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/radio')
-rw-r--r-- | drivers/media/radio/wl128x/fmdrv_v4l2.c | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/drivers/media/radio/wl128x/fmdrv_v4l2.c b/drivers/media/radio/wl128x/fmdrv_v4l2.c index a5bd3f674bbd..fb42f0fd0c1f 100644 --- a/drivers/media/radio/wl128x/fmdrv_v4l2.c +++ b/drivers/media/radio/wl128x/fmdrv_v4l2.c | |||
@@ -36,7 +36,7 @@ | |||
36 | #include "fmdrv_rx.h" | 36 | #include "fmdrv_rx.h" |
37 | #include "fmdrv_tx.h" | 37 | #include "fmdrv_tx.h" |
38 | 38 | ||
39 | static struct video_device *gradio_dev; | 39 | static struct video_device gradio_dev; |
40 | static u8 radio_disconnected; | 40 | static u8 radio_disconnected; |
41 | 41 | ||
42 | /* -- V4L2 RADIO (/dev/radioX) device file operation interfaces --- */ | 42 | /* -- V4L2 RADIO (/dev/radioX) device file operation interfaces --- */ |
@@ -517,7 +517,7 @@ static struct video_device fm_viddev_template = { | |||
517 | .fops = &fm_drv_fops, | 517 | .fops = &fm_drv_fops, |
518 | .ioctl_ops = &fm_drv_ioctl_ops, | 518 | .ioctl_ops = &fm_drv_ioctl_ops, |
519 | .name = FM_DRV_NAME, | 519 | .name = FM_DRV_NAME, |
520 | .release = video_device_release, | 520 | .release = video_device_release_empty, |
521 | /* | 521 | /* |
522 | * To ensure both the tuner and modulator ioctls are accessible we | 522 | * To ensure both the tuner and modulator ioctls are accessible we |
523 | * set the vfl_dir to M2M to indicate this. | 523 | * set the vfl_dir to M2M to indicate this. |
@@ -543,29 +543,21 @@ int fm_v4l2_init_video_device(struct fmdev *fmdev, int radio_nr) | |||
543 | /* Init mutex for core locking */ | 543 | /* Init mutex for core locking */ |
544 | mutex_init(&fmdev->mutex); | 544 | mutex_init(&fmdev->mutex); |
545 | 545 | ||
546 | /* Allocate new video device */ | ||
547 | gradio_dev = video_device_alloc(); | ||
548 | if (NULL == gradio_dev) { | ||
549 | fmerr("Can't allocate video device\n"); | ||
550 | return -ENOMEM; | ||
551 | } | ||
552 | |||
553 | /* Setup FM driver's V4L2 properties */ | 546 | /* Setup FM driver's V4L2 properties */ |
554 | memcpy(gradio_dev, &fm_viddev_template, sizeof(fm_viddev_template)); | 547 | gradio_dev = fm_viddev_template; |
555 | 548 | ||
556 | video_set_drvdata(gradio_dev, fmdev); | 549 | video_set_drvdata(&gradio_dev, fmdev); |
557 | 550 | ||
558 | gradio_dev->lock = &fmdev->mutex; | 551 | gradio_dev.lock = &fmdev->mutex; |
559 | gradio_dev->v4l2_dev = &fmdev->v4l2_dev; | 552 | gradio_dev.v4l2_dev = &fmdev->v4l2_dev; |
560 | 553 | ||
561 | /* Register with V4L2 subsystem as RADIO device */ | 554 | /* Register with V4L2 subsystem as RADIO device */ |
562 | if (video_register_device(gradio_dev, VFL_TYPE_RADIO, radio_nr)) { | 555 | if (video_register_device(&gradio_dev, VFL_TYPE_RADIO, radio_nr)) { |
563 | video_device_release(gradio_dev); | ||
564 | fmerr("Could not register video device\n"); | 556 | fmerr("Could not register video device\n"); |
565 | return -ENOMEM; | 557 | return -ENOMEM; |
566 | } | 558 | } |
567 | 559 | ||
568 | fmdev->radio_dev = gradio_dev; | 560 | fmdev->radio_dev = &gradio_dev; |
569 | 561 | ||
570 | /* Register to v4l2 ctrl handler framework */ | 562 | /* Register to v4l2 ctrl handler framework */ |
571 | fmdev->radio_dev->ctrl_handler = &fmdev->ctrl_handler; | 563 | fmdev->radio_dev->ctrl_handler = &fmdev->ctrl_handler; |
@@ -611,13 +603,13 @@ void *fm_v4l2_deinit_video_device(void) | |||
611 | struct fmdev *fmdev; | 603 | struct fmdev *fmdev; |
612 | 604 | ||
613 | 605 | ||
614 | fmdev = video_get_drvdata(gradio_dev); | 606 | fmdev = video_get_drvdata(&gradio_dev); |
615 | 607 | ||
616 | /* Unregister to v4l2 ctrl handler framework*/ | 608 | /* Unregister to v4l2 ctrl handler framework*/ |
617 | v4l2_ctrl_handler_free(&fmdev->ctrl_handler); | 609 | v4l2_ctrl_handler_free(&fmdev->ctrl_handler); |
618 | 610 | ||
619 | /* Unregister RADIO device from V4L2 subsystem */ | 611 | /* Unregister RADIO device from V4L2 subsystem */ |
620 | video_unregister_device(gradio_dev); | 612 | video_unregister_device(&gradio_dev); |
621 | 613 | ||
622 | v4l2_device_unregister(&fmdev->v4l2_dev); | 614 | v4l2_device_unregister(&fmdev->v4l2_dev); |
623 | 615 | ||