--- zzzz-none-000/linux-3.10.107/drivers/media/radio/wl128x/fmdrv_v4l2.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/media/radio/wl128x/fmdrv_v4l2.c 2021-02-04 17:41:59.000000000 +0000 @@ -36,7 +36,7 @@ #include "fmdrv_rx.h" #include "fmdrv_tx.h" -static struct video_device *gradio_dev; +static struct video_device gradio_dev; static u8 radio_disconnected; /* -- V4L2 RADIO (/dev/radioX) device file operation interfaces --- */ @@ -198,10 +198,12 @@ strlcpy(capability->card, FM_DRV_CARD_SHORT_NAME, sizeof(capability->card)); sprintf(capability->bus_info, "UART"); - capability->capabilities = V4L2_CAP_HW_FREQ_SEEK | V4L2_CAP_TUNER | + capability->device_caps = V4L2_CAP_HW_FREQ_SEEK | V4L2_CAP_TUNER | V4L2_CAP_RADIO | V4L2_CAP_MODULATOR | V4L2_CAP_AUDIO | V4L2_CAP_READWRITE | V4L2_CAP_RDS_CAPTURE; + capability->capabilities = capability->device_caps | + V4L2_CAP_DEVICE_CAPS; return 0; } @@ -515,7 +517,7 @@ .fops = &fm_drv_fops, .ioctl_ops = &fm_drv_ioctl_ops, .name = FM_DRV_NAME, - .release = video_device_release, + .release = video_device_release_empty, /* * To ensure both the tuner and modulator ioctls are accessible we * set the vfl_dir to M2M to indicate this. @@ -533,31 +535,29 @@ struct v4l2_ctrl *ctrl; int ret; + strlcpy(fmdev->v4l2_dev.name, FM_DRV_NAME, sizeof(fmdev->v4l2_dev.name)); + ret = v4l2_device_register(NULL, &fmdev->v4l2_dev); + if (ret < 0) + return ret; + /* Init mutex for core locking */ mutex_init(&fmdev->mutex); - /* Allocate new video device */ - gradio_dev = video_device_alloc(); - if (NULL == gradio_dev) { - fmerr("Can't allocate video device\n"); - return -ENOMEM; - } - /* 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); + video_set_drvdata(&gradio_dev, fmdev); - gradio_dev->lock = &fmdev->mutex; + 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); + if (video_register_device(&gradio_dev, VFL_TYPE_RADIO, radio_nr)) { fmerr("Could not register video device\n"); return -ENOMEM; } - fmdev->radio_dev = gradio_dev; + fmdev->radio_dev = &gradio_dev; /* Register to v4l2 ctrl handler framework */ fmdev->radio_dev->ctrl_handler = &fmdev->ctrl_handler; @@ -603,13 +603,15 @@ struct fmdev *fmdev; - fmdev = video_get_drvdata(gradio_dev); + fmdev = video_get_drvdata(&gradio_dev); /* Unregister to v4l2 ctrl handler framework*/ v4l2_ctrl_handler_free(&fmdev->ctrl_handler); /* Unregister RADIO device from V4L2 subsystem */ - video_unregister_device(gradio_dev); + video_unregister_device(&gradio_dev); + + v4l2_device_unregister(&fmdev->v4l2_dev); return fmdev; }