From patchwork Thu Jan 31 10:25:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 2072111 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id C99D13FD1A for ; Thu, 31 Jan 2013 10:26:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753917Ab3AaK0O (ORCPT ); Thu, 31 Jan 2013 05:26:14 -0500 Received: from smtp-vbr6.xs4all.nl ([194.109.24.26]:3591 "EHLO smtp-vbr6.xs4all.nl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752941Ab3AaKZs (ORCPT ); Thu, 31 Jan 2013 05:25:48 -0500 Received: from alastor.dyndns.org (166.80-203-20.nextgentel.com [80.203.20.166] (may be forged)) (authenticated bits=0) by smtp-vbr6.xs4all.nl (8.13.8/8.13.8) with ESMTP id r0VAPgvD009117 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Thu, 31 Jan 2013 11:25:43 +0100 (CET) (envelope-from hverkuil@xs4all.nl) Received: from tschai.lan (tschai.lan [192.168.1.10]) (Authenticated sender: hans) by alastor.dyndns.org (Postfix) with ESMTPSA id 6F3FE11E00CB; Thu, 31 Jan 2013 11:25:37 +0100 (CET) From: Hans Verkuil To: linux-media@vger.kernel.org Cc: Huang Shijie , Hans Verkuil Subject: [RFC PATCH 05/18] tlg2300: embed video_device instead of allocating it. Date: Thu, 31 Jan 2013 11:25:23 +0100 Message-Id: <6c7743bffce7a3cb8ea7b6c6f2ae92e79e81dcf4.1359627298.git.hans.verkuil@cisco.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1359627936-14918-1-git-send-email-hverkuil@xs4all.nl> References: <1359627936-14918-1-git-send-email-hverkuil@xs4all.nl> In-Reply-To: <608a45800f829b97fcc5c00b1decc64c829d71cb.1359627298.git.hans.verkuil@cisco.com> References: <608a45800f829b97fcc5c00b1decc64c829d71cb.1359627298.git.hans.verkuil@cisco.com> X-Virus-Scanned: by XS4ALL Virus Scanner Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Hans Verkuil Signed-off-by: Hans Verkuil Acked-by: Huang Shijie --- drivers/media/usb/tlg2300/pd-common.h | 2 +- drivers/media/usb/tlg2300/pd-radio.c | 20 ++++++-------------- 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 5dd73b7..3a89128 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 4c76e089..719c3da 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; }