summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2012-07-12 12:39:58 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-03-04 17:31:59 -0300
commit6fef490706c327469fe5688ca65d5239b717960d (patch)
treee71676ef67bdc0c57b19d5a99f1cf3a42b96a633
parent8f0829460507e68c4f41f4beedd6823411504a33 (diff)
downloadlinux-6fef490706c327469fe5688ca65d5239b717960d.tar.bz2
[media] tlg2300: embed video_device instead of allocating it
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Huang Shijie <shijie8@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/usb/tlg2300/pd-common.h2
-rw-r--r--drivers/media/usb/tlg2300/pd-radio.c20
2 files changed, 7 insertions, 15 deletions
diff --git a/drivers/media/usb/tlg2300/pd-common.h b/drivers/media/usb/tlg2300/pd-common.h
index 5dd73b7857d1..3a89128c3fc5 100644
--- a/drivers/media/usb/tlg2300/pd-common.h
+++ b/drivers/media/usb/tlg2300/pd-common.h
@@ -118,7 +118,7 @@ struct radio_data {
int users;
unsigned int is_radio_streaming;
int pre_emphasis;
- struct video_device *fm_dev;
+ struct video_device fm_dev;
};
#define DVB_SBUF_NUM 4
diff --git a/drivers/media/usb/tlg2300/pd-radio.c b/drivers/media/usb/tlg2300/pd-radio.c
index 4c76e0894d9e..719c3da22193 100644
--- a/drivers/media/usb/tlg2300/pd-radio.c
+++ b/drivers/media/usb/tlg2300/pd-radio.c
@@ -369,31 +369,23 @@ static struct video_device poseidon_fm_template = {
.name = "Telegent-Radio",
.fops = &poseidon_fm_fops,
.minor = -1,
- .release = video_device_release,
+ .release = video_device_release_empty,
.ioctl_ops = &poseidon_fm_ioctl_ops,
};
int poseidon_fm_init(struct poseidon *p)
{
- struct video_device *fm_dev;
- int err;
+ struct video_device *vfd = &p->radio_data.fm_dev;
- fm_dev = vdev_init(p, &poseidon_fm_template);
- if (fm_dev == NULL)
- return -ENOMEM;
+ *vfd = poseidon_fm_template;
+ vfd->v4l2_dev = &p->v4l2_dev;
+ video_set_drvdata(vfd, p);
- p->radio_data.fm_dev = fm_dev;
set_frequency(p, TUNER_FREQ_MIN_FM);
- err = video_register_device(fm_dev, VFL_TYPE_RADIO, -1);
- if (err < 0) {
- video_device_release(fm_dev);
- return err;
- }
- return 0;
+ return video_register_device(vfd, VFL_TYPE_RADIO, -1);
}
int poseidon_fm_exit(struct poseidon *p)
{
- destroy_video_device(&p->radio_data.fm_dev);
return 0;
}