All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@redhat.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: linux-media@vger.kernel.org, Mike Isely <isely@isely.net>,
	Hans Verkuil <hans.verkuil@cisco.com>
Subject: Re: [RFCv4 PATCH 2/8] tuner-core: change return type of set_mode_freq to bool
Date: Sun, 12 Jun 2011 11:39:11 -0300	[thread overview]
Message-ID: <4DF4CF8F.8050507@redhat.com> (raw)
In-Reply-To: <d59fe38f04b4dbce9e79b10133db2f0953ced6e6.1307875512.git.hans.verkuil@cisco.com>

Em 12-06-2011 07:59, Hans Verkuil escreveu:
> From: Hans Verkuil <hans.verkuil@cisco.com>
> 
> set_mode_freq currently returns 0 or -EINVAL. But -EINVAL does not
> indicate a error that should be passed on, it just indicates that the
> tuner does not supportthe requested mode. So change the return type to
> bool.

NACK. Tuner core doesn't return the error code just because the subdev
functions don't allow, currently, at the multiple tuners case.

> 
> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
> ---
>  drivers/media/video/tuner-core.c |   23 ++++++++++-------------
>  1 files changed, 10 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
> index 083b9f1..ee43e0a 100644
> --- a/drivers/media/video/tuner-core.c
> +++ b/drivers/media/video/tuner-core.c
> @@ -746,11 +746,11 @@ static bool supported_mode(struct tuner *t, enum v4l2_tuner_type mode)
>   * @freq:	frequency to set (0 means to use the previous one)
>   *
>   * If tuner doesn't support the needed mode (radio or TV), prints a
> - * debug message and returns -EINVAL, changing its state to standby.
> - * Otherwise, changes the state and sets frequency to the last value, if
> - * the tuner can sleep or if it supports both Radio and TV.
> + * debug message and returns false, changing its state to standby.
> + * Otherwise, changes the state and sets frequency to the last value
> + * and returns true.
>   */
> -static int set_mode_freq(struct i2c_client *client, struct tuner *t,
> +static bool set_mode_freq(struct i2c_client *client, struct tuner *t,
>  			 enum v4l2_tuner_type mode, unsigned int freq)
>  {
>  	struct analog_demod_ops *analog_ops = &t->fe.ops.analog_ops;
> @@ -762,7 +762,7 @@ static int set_mode_freq(struct i2c_client *client, struct tuner *t,
>  			t->standby = true;
>  			if (analog_ops->standby)
>  				analog_ops->standby(&t->fe);
> -			return -EINVAL;
> +			return false;
>  		}
>  		t->mode = mode;
>  		tuner_dbg("Changing to mode %d\n", mode);
> @@ -777,7 +777,7 @@ static int set_mode_freq(struct i2c_client *client, struct tuner *t,
>  		set_tv_freq(client, t->tv_freq);
>  	}
>  
> -	return 0;
> +	return true;
>  }
>  
>  /*
> @@ -1075,8 +1075,7 @@ static int tuner_s_radio(struct v4l2_subdev *sd)
>  	struct tuner *t = to_tuner(sd);
>  	struct i2c_client *client = v4l2_get_subdevdata(sd);
>  
> -	if (set_mode_freq(client, t, V4L2_TUNER_RADIO, 0) == -EINVAL)
> -		return 0;
> +	set_mode_freq(client, t, V4L2_TUNER_RADIO, 0);
>  	return 0;
>  }
>  
> @@ -1110,7 +1109,7 @@ static int tuner_s_std(struct v4l2_subdev *sd, v4l2_std_id std)
>  	struct tuner *t = to_tuner(sd);
>  	struct i2c_client *client = v4l2_get_subdevdata(sd);
>  
> -	if (set_mode_freq(client, t, V4L2_TUNER_ANALOG_TV, 0) == -EINVAL)
> +	if (!set_mode_freq(client, t, V4L2_TUNER_ANALOG_TV, 0))
>  		return 0;
>  
>  	t->std = std;
> @@ -1124,9 +1123,7 @@ static int tuner_s_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *f)
>  	struct tuner *t = to_tuner(sd);
>  	struct i2c_client *client = v4l2_get_subdevdata(sd);
>  
> -	if (set_mode_freq(client, t, f->type, f->frequency) == -EINVAL)
> -		return 0;
> -
> +	set_mode_freq(client, t, f->type, f->frequency);
>  	return 0;
>  }
>  
> @@ -1197,7 +1194,7 @@ static int tuner_s_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt)
>  	struct tuner *t = to_tuner(sd);
>  	struct i2c_client *client = v4l2_get_subdevdata(sd);
>  
> -	if (set_mode_freq(client, t, vt->type, 0) == -EINVAL)
> +	if (!set_mode_freq(client, t, vt->type, 0))
>  		return 0;
>  
>  	if (t->mode == V4L2_TUNER_RADIO)


  reply	other threads:[~2011-06-12 14:39 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-12 10:59 tuner-core: fix g_freq/s_std and g/s_tuner Hans Verkuil
2011-06-12 10:59 ` [RFCv4 PATCH 1/8] tuner-core: rename check_mode to supported_mode Hans Verkuil
2011-06-12 10:59   ` [RFCv4 PATCH 2/8] tuner-core: change return type of set_mode_freq to bool Hans Verkuil
2011-06-12 14:39     ` Mauro Carvalho Chehab [this message]
2011-06-12 10:59   ` [RFCv4 PATCH 3/8] tuner-core: simplify the standard fixup Hans Verkuil
2011-06-12 14:39     ` Mauro Carvalho Chehab
2011-06-12 10:59   ` [RFCv4 PATCH 4/8] tuner-core: fix s_std and s_tuner Hans Verkuil
2011-06-12 14:41     ` Mauro Carvalho Chehab
2011-06-12 10:59   ` [RFCv4 PATCH 5/8] tuner-core: fix tuner_resume: use t->mode instead of t->type Hans Verkuil
2011-06-12 14:42     ` Mauro Carvalho Chehab
2011-06-12 10:59   ` [RFCv4 PATCH 6/8] v4l2-ioctl.c: prefill tuner type for g_frequency and g/s_tuner Hans Verkuil
2011-06-12 12:41     ` Andy Walls
2011-06-12 14:36     ` Mauro Carvalho Chehab
2011-06-12 15:46       ` Hans Verkuil
2011-06-12 17:08         ` Mauro Carvalho Chehab
2011-06-12 19:41           ` Hans Verkuil
2011-06-12 21:52             ` Mauro Carvalho Chehab
2011-06-12 10:59   ` [RFCv4 PATCH 7/8] pvrusb2: fix g/s_tuner support Hans Verkuil
2011-06-12 14:43     ` Mauro Carvalho Chehab
2011-06-12 10:59   ` [RFCv4 PATCH 8/8] bttv: fix s_tuner for radio Hans Verkuil
2011-06-12 14:43     ` Mauro Carvalho Chehab
2011-06-12 14:37   ` [RFCv4 PATCH 1/8] tuner-core: rename check_mode to supported_mode Mauro Carvalho Chehab
2011-06-12 16:07     ` Hans Verkuil
2011-06-12 17:27       ` Mauro Carvalho Chehab
2011-06-12 17:32         ` Mauro Carvalho Chehab
2011-06-12 18:09         ` Hans Verkuil
2011-06-12 22:06           ` Mauro Carvalho Chehab
2011-06-13 10:23             ` Hans Verkuil
2011-06-13 11:45               ` Mauro Carvalho Chehab
2011-06-13 12:07                 ` Hans Verkuil
2011-06-13 12:32                   ` Mauro Carvalho Chehab

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=4DF4CF8F.8050507@redhat.com \
    --to=mchehab@redhat.com \
    --cc=hans.verkuil@cisco.com \
    --cc=hverkuil@xs4all.nl \
    --cc=isely@isely.net \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.