linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Huang Shijie <shijie8@gmail.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: linux-media@vger.kernel.org, Hans Verkuil <hans.verkuil@cisco.com>
Subject: Re: [RFC PATCH 10/18] tlg2300: embed video_device.
Date: Sun, 03 Feb 2013 23:39:20 -0500	[thread overview]
Message-ID: <510F3B78.3020700@gmail.com> (raw)
In-Reply-To: <b7465542a57ac28f1c9d54bfb11766e8c8f35e64.1359627298.git.hans.verkuil@cisco.com>

于 2013年01月31日 05:25, Hans Verkuil 写道:
> From: Hans Verkuil <hans.verkuil@cisco.com>
>
> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
> ---
>  drivers/media/usb/tlg2300/pd-common.h |    6 ++--
>  drivers/media/usb/tlg2300/pd-video.c  |   55 +++++++--------------------------
>  2 files changed, 13 insertions(+), 48 deletions(-)
>
> diff --git a/drivers/media/usb/tlg2300/pd-common.h b/drivers/media/usb/tlg2300/pd-common.h
> index 67ad065..052cb0c 100644
> --- a/drivers/media/usb/tlg2300/pd-common.h
> +++ b/drivers/media/usb/tlg2300/pd-common.h
> @@ -40,7 +40,7 @@
>  #define TUNER_FREQ_MAX		(862000000)
>  
>  struct vbi_data {
> -	struct video_device	*v_dev;
> +	struct video_device	v_dev;
>  	struct video_data	*video;
>  	struct front_face	*front;
>  
> @@ -63,7 +63,7 @@ struct running_context {
>  
>  struct video_data {
>  	/* v4l2 video device */
> -	struct video_device	*v_dev;
> +	struct video_device	v_dev;
>  
>  	/* the working context */
>  	struct running_context	context;
> @@ -234,7 +234,6 @@ void dvb_stop_streaming(struct pd_dvb_adapter *);
>  /* FM */
>  int poseidon_fm_init(struct poseidon *);
>  int poseidon_fm_exit(struct poseidon *);
> -struct video_device *vdev_init(struct poseidon *, struct video_device *);
>  
>  /* vendor command ops */
>  int send_set_req(struct poseidon*, u8, s32, s32*);
> @@ -250,7 +249,6 @@ void free_all_urb_generic(struct urb **urb_array, int num);
>  
>  /* misc */
>  void poseidon_delete(struct kref *kref);
> -void destroy_video_device(struct video_device **v_dev);
>  extern int debug_mode;
>  void set_debug_mode(struct video_device *vfd, int debug_mode);
>  
> diff --git a/drivers/media/usb/tlg2300/pd-video.c b/drivers/media/usb/tlg2300/pd-video.c
> index 2172337..312809a 100644
> --- a/drivers/media/usb/tlg2300/pd-video.c
> +++ b/drivers/media/usb/tlg2300/pd-video.c
> @@ -1590,48 +1590,18 @@ static struct video_device pd_video_template = {
>  	.name = "Telegent-Video",
>  	.fops = &pd_video_fops,
>  	.minor = -1,
> -	.release = video_device_release,
> +	.release = video_device_release_empty,
>  	.tvnorms = V4L2_STD_ALL,
>  	.ioctl_ops = &pd_video_ioctl_ops,
>  };
>  
> -struct video_device *vdev_init(struct poseidon *pd, struct video_device *tmp)
> -{
> -	struct video_device *vfd;
> -
> -	vfd = video_device_alloc();
> -	if (vfd == NULL)
> -		return NULL;
> -	*vfd		= *tmp;
> -	vfd->minor	= -1;
> -	vfd->v4l2_dev	= &pd->v4l2_dev;
> -	/*vfd->parent	= &(pd->udev->dev); */
> -	vfd->release	= video_device_release;
> -	video_set_drvdata(vfd, pd);
> -	return vfd;
> -}
> -
> -void destroy_video_device(struct video_device **v_dev)
> -{
> -	struct video_device *dev = *v_dev;
> -
> -	if (dev == NULL)
> -		return;
> -
> -	if (video_is_registered(dev))
> -		video_unregister_device(dev);
> -	else
> -		video_device_release(dev);
> -	*v_dev = NULL;
> -}
> -
>  void pd_video_exit(struct poseidon *pd)
>  {
>  	struct video_data *video = &pd->video_data;
>  	struct vbi_data *vbi = &pd->vbi_data;
>  
> -	destroy_video_device(&video->v_dev);
> -	destroy_video_device(&vbi->v_dev);
> +	video_unregister_device(&video->v_dev);
> +	video_unregister_device(&vbi->v_dev);
>  	log();
>  }
>  
> @@ -1641,21 +1611,19 @@ int pd_video_init(struct poseidon *pd)
>  	struct vbi_data *vbi	= &pd->vbi_data;
>  	int ret = -ENOMEM;
>  
> -	video->v_dev = vdev_init(pd, &pd_video_template);
> -	if (video->v_dev == NULL)
> -		goto out;
> +	video->v_dev = pd_video_template;
> +	video->v_dev.v4l2_dev = &pd->v4l2_dev;
> +	video_set_drvdata(&video->v_dev, pd);
>  
> -	ret = video_register_device(video->v_dev, VFL_TYPE_GRABBER, -1);
> +	ret = video_register_device(&video->v_dev, VFL_TYPE_GRABBER, -1);
>  	if (ret != 0)
>  		goto out;
>  
>  	/* VBI uses the same template as video */
> -	vbi->v_dev = vdev_init(pd, &pd_video_template);
> -	if (vbi->v_dev == NULL) {
> -		ret = -ENOMEM;
> -		goto out;
> -	}
> -	ret = video_register_device(vbi->v_dev, VFL_TYPE_VBI, -1);
> +	vbi->v_dev = pd_video_template;
> +	vbi->v_dev.v4l2_dev = &pd->v4l2_dev;
> +	video_set_drvdata(&vbi->v_dev, pd);
> +	ret = video_register_device(&vbi->v_dev, VFL_TYPE_VBI, -1);
>  	if (ret != 0)
>  		goto out;
>  	log("register VIDEO/VBI devices");
> @@ -1665,4 +1633,3 @@ out:
>  	pd_video_exit(pd);
>  	return ret;
>  }
> -
Acked-by: Huang Shijie <shijie8@gmail.com>

  reply	other threads:[~2013-02-03 15:35 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-31 10:25 [RFC PATCH 00/18] tlg2300: various v4l2-compliance fixes Hans Verkuil
2013-01-31 10:25 ` [RFC PATCH 01/18] tlg2300: use correct device parent Hans Verkuil
2013-01-31 10:25   ` [RFC PATCH 02/18] tlg2300: fix tuner and frequency handling of the radio device Hans Verkuil
2013-02-04  3:46     ` Huang Shijie
2013-01-31 10:25   ` [RFC PATCH 03/18] tlg2300: switch to unlocked_ioctl Hans Verkuil
2013-02-04  3:48     ` Huang Shijie
2013-01-31 10:25   ` [RFC PATCH 04/18] tlg2300: remove ioctls that are invalid for radio devices Hans Verkuil
2013-02-04  4:16     ` Huang Shijie
2013-02-04  8:34       ` Hans Verkuil
2013-02-05  4:03     ` Huang Shijie
2013-01-31 10:25   ` [RFC PATCH 05/18] tlg2300: embed video_device instead of allocating it Hans Verkuil
2013-02-04  4:26     ` Huang Shijie
2013-01-31 10:25   ` [RFC PATCH 06/18] tlg2300: add control handler for radio device node Hans Verkuil
2013-02-04  4:47     ` Huang Shijie
2013-01-31 10:25   ` [RFC PATCH 07/18] tlg2300: switch to v4l2_fh Hans Verkuil
2013-02-04  4:32     ` Huang Shijie
2013-01-31 10:25   ` [RFC PATCH 08/18] tlg2300: fix radio querycap Hans Verkuil
2013-02-04  4:36     ` Huang Shijie
2013-02-04  8:38       ` Hans Verkuil
2013-02-05  4:07         ` Huang Shijie
2013-01-31 10:25   ` [RFC PATCH 09/18] tlg2300: add missing video_unregister_device Hans Verkuil
2013-02-04  4:38     ` Huang Shijie
2013-01-31 10:25   ` [RFC PATCH 10/18] tlg2300: embed video_device Hans Verkuil
2013-02-04  4:39     ` Huang Shijie [this message]
2013-01-31 10:25   ` [RFC PATCH 11/18] tlg2300: fix querycap Hans Verkuil
2013-02-04  4:43     ` Huang Shijie
2013-01-31 10:25   ` [RFC PATCH 12/18] tlg2300: fix frequency handling Hans Verkuil
2013-02-04  4:44     ` Huang Shijie
2013-01-31 10:25   ` [RFC PATCH 13/18] tlg2300: fix missing audioset Hans Verkuil
2013-02-04  4:48     ` Huang Shijie
2013-02-04  8:39       ` Hans Verkuil
2013-02-05  4:07     ` Huang Shijie
2013-01-31 10:25   ` [RFC PATCH 14/18] tlg2300: implement the control framework Hans Verkuil
2013-02-04  4:46     ` Huang Shijie
2013-01-31 10:25   ` [RFC PATCH 15/18] tlg2300: remove empty vidioc_try_fmt_vid_cap, add missing g_std Hans Verkuil
2013-02-04  4:51     ` Huang Shijie
2013-01-31 10:25   ` [RFC PATCH 16/18] tlg2300: allow multiple opens Hans Verkuil
2013-02-04  4:54     ` Huang Shijie
2013-01-31 10:25   ` [RFC PATCH 17/18] tlg2300: Remove logs() macro Hans Verkuil
2013-02-04  4:54     ` Huang Shijie
2013-01-31 10:25   ` [RFC PATCH 18/18] tlg2300: update MAINTAINERS file Hans Verkuil
2013-02-04  4:55     ` Huang Shijie
2013-02-04  8:40       ` Hans Verkuil
2013-02-04  2:40   ` [RFC PATCH 01/18] tlg2300: use correct device parent Huang Shijie
2013-02-04  8:40     ` Hans Verkuil
2013-02-01  2:22 ` [RFC PATCH 00/18] tlg2300: various v4l2-compliance fixes Huang Shijie
2013-02-01  7:49   ` Hans Verkuil
2013-02-01  8:02     ` Huang Shijie
2013-02-01  8:07       ` Hans Verkuil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=510F3B78.3020700@gmail.com \
    --to=shijie8@gmail.com \
    --cc=hans.verkuil@cisco.com \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).