linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [media] radio-si476x: vidioc_s* now uses a const parameter
@ 2013-03-29 12:46 Mauro Carvalho Chehab
  2013-03-29 12:49 ` Hans Verkuil
  0 siblings, 1 reply; 2+ messages in thread
From: Mauro Carvalho Chehab @ 2013-03-29 12:46 UTC (permalink / raw)
  Cc: Mauro Carvalho Chehab, Linux Media Mailing List, Hans Verkuil,
	Andrey Smirnov

vidioc_s_tuner, vidioc_s_frequency and vidioc_s_register now
uses a constant argument. So, the driver reports warnings:

	drivers/media/radio/radio-si476x.c:1196:2: warning: initialization from incompatible pointer type [enabled by default]
	drivers/media/radio/radio-si476x.c:1196:2: warning: (near initialization for 'si4761_ioctl_ops.vidioc_s_tuner') [enabled by default]
	drivers/media/radio/radio-si476x.c:1199:2: warning: initialization from incompatible pointer type [enabled by default]
	drivers/media/radio/radio-si476x.c:1199:2: warning: (near initialization for 'si4761_ioctl_ops.vidioc_s_frequency') [enabled by default]
	drivers/media/radio/radio-si476x.c:1209:2: warning: initialization from incompatible pointer type [enabled by default]
	drivers/media/radio/radio-si476x.c:1209:2: warning: (near initialization for 'si4761_ioctl_ops.vidioc_s_register') [enabled by default]

This is due to a (soft) merge conflict, as both this driver and the
const patches were applied for the same Kernel version.

Cc: Hans Verkuil <hans.verkuil@cisco.com>
Cc: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
---
 drivers/media/radio/radio-si476x.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/media/radio/radio-si476x.c b/drivers/media/radio/radio-si476x.c
index 0895a0c..9430c6a 100644
--- a/drivers/media/radio/radio-si476x.c
+++ b/drivers/media/radio/radio-si476x.c
@@ -472,7 +472,7 @@ static int si476x_radio_g_tuner(struct file *file, void *priv,
 }
 
 static int si476x_radio_s_tuner(struct file *file, void *priv,
-				struct v4l2_tuner *tuner)
+				const struct v4l2_tuner *tuner)
 {
 	struct si476x_radio *radio = video_drvdata(file);
 
@@ -699,15 +699,16 @@ static int si476x_radio_g_frequency(struct file *file, void *priv,
 }
 
 static int si476x_radio_s_frequency(struct file *file, void *priv,
-				    struct v4l2_frequency *f)
+				    const struct v4l2_frequency *f)
 {
 	int err;
+	u32 freq = f->frequency;
 	struct si476x_tune_freq_args args;
 	struct si476x_radio *radio = video_drvdata(file);
 
 	const u32 midrange = (si476x_bands[SI476X_BAND_AM].rangehigh +
 			      si476x_bands[SI476X_BAND_FM].rangelow) / 2;
-	const int band = (f->frequency > midrange) ?
+	const int band = (freq > midrange) ?
 		SI476X_BAND_FM : SI476X_BAND_AM;
 	const enum si476x_func func = (band == SI476X_BAND_AM) ?
 		SI476X_FUNC_AM_RECEIVER : SI476X_FUNC_FM_RECEIVER;
@@ -718,11 +719,11 @@ static int si476x_radio_s_frequency(struct file *file, void *priv,
 
 	si476x_core_lock(radio->core);
 
-	f->frequency = clamp(f->frequency,
-			     si476x_bands[band].rangelow,
-			     si476x_bands[band].rangehigh);
+	freq = clamp(freq,
+		     si476x_bands[band].rangelow,
+		     si476x_bands[band].rangehigh);
 
-	if (si476x_radio_freq_is_inside_of_the_band(f->frequency,
+	if (si476x_radio_freq_is_inside_of_the_band(freq,
 						    SI476X_BAND_AM) &&
 	    (!si476x_core_has_am(radio->core) ||
 	     si476x_core_is_a_secondary_tuner(radio->core))) {
@@ -737,8 +738,7 @@ static int si476x_radio_s_frequency(struct file *file, void *priv,
 	args.zifsr		= false;
 	args.hd			= false;
 	args.injside		= SI476X_INJSIDE_AUTO;
-	args.freq		= v4l2_to_si476x(radio->core,
-						 f->frequency);
+	args.freq		= v4l2_to_si476x(radio->core, freq);
 	args.tunemode		= SI476X_TM_VALIDATED_NORMAL_TUNE;
 	args.smoothmetrics	= SI476X_SM_INITIALIZE_AUDIO;
 	args.antcap		= 0;
@@ -1046,7 +1046,7 @@ static int si476x_radio_g_register(struct file *file, void *fh,
 	return err;
 }
 static int si476x_radio_s_register(struct file *file, void *fh,
-				   struct v4l2_dbg_register *reg)
+				   const struct v4l2_dbg_register *reg)
 {
 
 	int err;
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] [media] radio-si476x: vidioc_s* now uses a const parameter
  2013-03-29 12:46 [PATCH] [media] radio-si476x: vidioc_s* now uses a const parameter Mauro Carvalho Chehab
@ 2013-03-29 12:49 ` Hans Verkuil
  0 siblings, 0 replies; 2+ messages in thread
From: Hans Verkuil @ 2013-03-29 12:49 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Linux Media Mailing List
  Cc: Hans Verkuil, Andrey Smirnov

On Fri March 29 2013 13:46:37 Mauro Carvalho Chehab wrote:
> vidioc_s_tuner, vidioc_s_frequency and vidioc_s_register now
> uses a constant argument. So, the driver reports warnings:
> 
> 	drivers/media/radio/radio-si476x.c:1196:2: warning: initialization from incompatible pointer type [enabled by default]
> 	drivers/media/radio/radio-si476x.c:1196:2: warning: (near initialization for 'si4761_ioctl_ops.vidioc_s_tuner') [enabled by default]
> 	drivers/media/radio/radio-si476x.c:1199:2: warning: initialization from incompatible pointer type [enabled by default]
> 	drivers/media/radio/radio-si476x.c:1199:2: warning: (near initialization for 'si4761_ioctl_ops.vidioc_s_frequency') [enabled by default]
> 	drivers/media/radio/radio-si476x.c:1209:2: warning: initialization from incompatible pointer type [enabled by default]
> 	drivers/media/radio/radio-si476x.c:1209:2: warning: (near initialization for 'si4761_ioctl_ops.vidioc_s_register') [enabled by default]
> 
> This is due to a (soft) merge conflict, as both this driver and the
> const patches were applied for the same Kernel version.
> 
> Cc: Hans Verkuil <hans.verkuil@cisco.com>

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>

Regards,

	Hans

> Cc: Andrey Smirnov <andrew.smirnov@gmail.com>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
> ---
>  drivers/media/radio/radio-si476x.c | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/media/radio/radio-si476x.c b/drivers/media/radio/radio-si476x.c
> index 0895a0c..9430c6a 100644
> --- a/drivers/media/radio/radio-si476x.c
> +++ b/drivers/media/radio/radio-si476x.c
> @@ -472,7 +472,7 @@ static int si476x_radio_g_tuner(struct file *file, void *priv,
>  }
>  
>  static int si476x_radio_s_tuner(struct file *file, void *priv,
> -				struct v4l2_tuner *tuner)
> +				const struct v4l2_tuner *tuner)
>  {
>  	struct si476x_radio *radio = video_drvdata(file);
>  
> @@ -699,15 +699,16 @@ static int si476x_radio_g_frequency(struct file *file, void *priv,
>  }
>  
>  static int si476x_radio_s_frequency(struct file *file, void *priv,
> -				    struct v4l2_frequency *f)
> +				    const struct v4l2_frequency *f)
>  {
>  	int err;
> +	u32 freq = f->frequency;
>  	struct si476x_tune_freq_args args;
>  	struct si476x_radio *radio = video_drvdata(file);
>  
>  	const u32 midrange = (si476x_bands[SI476X_BAND_AM].rangehigh +
>  			      si476x_bands[SI476X_BAND_FM].rangelow) / 2;
> -	const int band = (f->frequency > midrange) ?
> +	const int band = (freq > midrange) ?
>  		SI476X_BAND_FM : SI476X_BAND_AM;
>  	const enum si476x_func func = (band == SI476X_BAND_AM) ?
>  		SI476X_FUNC_AM_RECEIVER : SI476X_FUNC_FM_RECEIVER;
> @@ -718,11 +719,11 @@ static int si476x_radio_s_frequency(struct file *file, void *priv,
>  
>  	si476x_core_lock(radio->core);
>  
> -	f->frequency = clamp(f->frequency,
> -			     si476x_bands[band].rangelow,
> -			     si476x_bands[band].rangehigh);
> +	freq = clamp(freq,
> +		     si476x_bands[band].rangelow,
> +		     si476x_bands[band].rangehigh);
>  
> -	if (si476x_radio_freq_is_inside_of_the_band(f->frequency,
> +	if (si476x_radio_freq_is_inside_of_the_band(freq,
>  						    SI476X_BAND_AM) &&
>  	    (!si476x_core_has_am(radio->core) ||
>  	     si476x_core_is_a_secondary_tuner(radio->core))) {
> @@ -737,8 +738,7 @@ static int si476x_radio_s_frequency(struct file *file, void *priv,
>  	args.zifsr		= false;
>  	args.hd			= false;
>  	args.injside		= SI476X_INJSIDE_AUTO;
> -	args.freq		= v4l2_to_si476x(radio->core,
> -						 f->frequency);
> +	args.freq		= v4l2_to_si476x(radio->core, freq);
>  	args.tunemode		= SI476X_TM_VALIDATED_NORMAL_TUNE;
>  	args.smoothmetrics	= SI476X_SM_INITIALIZE_AUDIO;
>  	args.antcap		= 0;
> @@ -1046,7 +1046,7 @@ static int si476x_radio_g_register(struct file *file, void *fh,
>  	return err;
>  }
>  static int si476x_radio_s_register(struct file *file, void *fh,
> -				   struct v4l2_dbg_register *reg)
> +				   const struct v4l2_dbg_register *reg)
>  {
>  
>  	int err;
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-03-29 12:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-29 12:46 [PATCH] [media] radio-si476x: vidioc_s* now uses a const parameter Mauro Carvalho Chehab
2013-03-29 12:49 ` Hans Verkuil

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).