[05/16] cx18: fix handling of 'radio' module parameter

Message ID 1327960820-11867-6-git-send-email-danny.kukawka@bisect.de (mailing list archive)
State Rejected, archived
Headers

Commit Message

Danny Kukawka Jan. 30, 2012, 10 p.m. UTC
  Fixed handling of 'radio' module parameter from module_param_array
to module_param_named to fix these compiler warnings in cx18-driver.c:

In function ‘__check_radio’:
113:1: warning: return from incompatible pointer type [enabled by default]
At top level:
113:1: warning: initialization from incompatible pointer type [enabled by default]
113:1: warning: (near initialization for ‘__param_arr_radio.num’) [enabled by default]

Signed-off-by: Danny Kukawka <danny.kukawka@bisect.de>
---
 drivers/media/video/cx18/cx18-driver.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
  

Comments

Danny Kukawka Jan. 31, 2012, 1:45 p.m. UTC | #1
On Dienstag, 31. Januar 2012, Andy Walls wrote:
> On Tue, 2012-01-31 at 05:01 -0500, Andy Walls wrote:
> > On Mon, 2012-01-30 at 20:40 +0100, Danny Kukawka wrote:
> > > Fixed handling of 'radio' module parameter from module_param_array
> > > to module_param_named to fix these compiler warnings in cx18-driver.c:
> >
> > NACK.
> >
> > "radio" is an array of tristate values (-1, 0, 1) per installed card:
> >
> > 	static int radio[CX18_MAX_CARDS] = { -1, -1,
> >
> > and must remain an array or you will break the driver.
> >
> > Calling "radio_c" a module parameter named "radio" is wrong.
> >
> > The correct fix is to reverse Rusty Russel's patch to the driver in
> > commit  90ab5ee94171b3e28de6bb42ee30b527014e0be7
> > to change the "bool" back to an "int" as it should be in
>
>                       ^^^^
> Sorry, a typo here.  Disregard the word "back".

Overseen this. But wouldn't be the correct fix in this case to:
a) reverse the part of 90ab5ee94171b3e28de6bb42ee30b527014e0be7 to:
   get: 
   static unsigned radio_c = 1;
   
b) change the following line:
   module_param_array(radio, bool, &radio_c, 0644);
   to:
   module_param_array(radio, int, &radio_c, 0644);

Without b) you would get a warning from the compiler again.

Danny 
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
  
Andy Walls Jan. 31, 2012, 2:59 p.m. UTC | #2
Danny Kukawka <danny.kukawka@bisect.de> wrote:

>On Dienstag, 31. Januar 2012, Andy Walls wrote:
>> On Tue, 2012-01-31 at 05:01 -0500, Andy Walls wrote:
>> > On Mon, 2012-01-30 at 20:40 +0100, Danny Kukawka wrote:
>> > > Fixed handling of 'radio' module parameter from
>module_param_array
>> > > to module_param_named to fix these compiler warnings in
>cx18-driver.c:
>> >
>> > NACK.
>> >
>> > "radio" is an array of tristate values (-1, 0, 1) per installed
>card:
>> >
>> > 	static int radio[CX18_MAX_CARDS] = { -1, -1,
>> >
>> > and must remain an array or you will break the driver.
>> >
>> > Calling "radio_c" a module parameter named "radio" is wrong.
>> >
>> > The correct fix is to reverse Rusty Russel's patch to the driver in
>> > commit  90ab5ee94171b3e28de6bb42ee30b527014e0be7
>> > to change the "bool" back to an "int" as it should be in
>>
>>                       ^^^^
>> Sorry, a typo here.  Disregard the word "back".
>
>Overseen this. But wouldn't be the correct fix in this case to:
>a) reverse the part of 90ab5ee94171b3e28de6bb42ee30b527014e0be7 to:
>   get: 
>   static unsigned radio_c = 1;
>   
>b) change the following line:
>   module_param_array(radio, bool, &radio_c, 0644);
>   to:
>   module_param_array(radio, int, &radio_c, 0644);
>
>Without b) you would get a warning from the compiler again.
>
>Danny 

Yes, both need to happen.

I mentioned b) at the end of my original email.

Regards,
Andy
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
  
Rusty Russell Feb. 1, 2012, 2:29 a.m. UTC | #3
On Tue, 31 Jan 2012 14:45:18 +0100, Danny Kukawka <danny.kukawka@bisect.de> wrote:
> On Dienstag, 31. Januar 2012, Andy Walls wrote:
> Overseen this. But wouldn't be the correct fix in this case to:
> a) reverse the part of 90ab5ee94171b3e28de6bb42ee30b527014e0be7 to:
>    get: 
>    static unsigned radio_c = 1;
>    
> b) change the following line:
>    module_param_array(radio, bool, &radio_c, 0644);
>    to:
>    module_param_array(radio, int, &radio_c, 0644);

Yes, sorry, my patch was complete crap here :(

If you want people to set it only to 1 or 0, you probably want "bint".

Thanks,
Rusty.
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
  

Patch

diff --git a/drivers/media/video/cx18/cx18-driver.c b/drivers/media/video/cx18/cx18-driver.c
index 349bd9c..27b5330 100644
--- a/drivers/media/video/cx18/cx18-driver.c
+++ b/drivers/media/video/cx18/cx18-driver.c
@@ -110,7 +110,7 @@  static int retry_mmio = 1;
 int cx18_debug;
 
 module_param_array(tuner, int, &tuner_c, 0644);
-module_param_array(radio, bool, &radio_c, 0644);
+module_param_named(radio, radio_c, bool, 0644);
 module_param_array(cardtype, int, &cardtype_c, 0644);
 module_param_string(pal, pal, sizeof(pal), 0644);
 module_param_string(secam, secam, sizeof(secam), 0644);