diff mbox

Fix logic error in rfkill_check_duplicity

Message ID 20081030144409.GJ3162@earth.li
State Not Applicable, archived
Delegated to: David Miller
Headers show

Commit Message

Jonathan McDowell Oct. 30, 2008, 2:44 p.m. UTC
On Thu, Oct 30, 2008 at 10:27:46AM +0000, Jonathan McDowell wrote:
 
> I'll have a prod at why the [hso] rfkill stuff isn't working next

Ok, I believe this is due to the addition of rfkill_check_duplicity in
rfkill and the fact that test_bit actually returns a negative value
rather than the postive one expected (which is of course equally true).
So when the second WLAN device (the hso device, with the EEE PC WLAN
being the first) comes along rfkill_check_duplicity returns a negative
value and so rfkill_register returns an error. Patch below fixes this
for me.

The hso driver should probably be claiming to be a WWAN device as well,
given that it's GSM/HSDPA rather than 802.11.

Signed-Off-By: Jonathan McDowell <noodles@earth.li>

-----
-----

J.

Comments

Henrique de Moraes Holschuh Oct. 30, 2008, 8:49 p.m. UTC | #1
On Thu, 30 Oct 2008, Jonathan McDowell wrote:
> On Thu, Oct 30, 2008 at 10:27:46AM +0000, Jonathan McDowell wrote:
> > I'll have a prod at why the [hso] rfkill stuff isn't working next
> 
> Ok, I believe this is due to the addition of rfkill_check_duplicity in
> rfkill and the fact that test_bit actually returns a negative value
> rather than the postive one expected (which is of course equally true).
> So when the second WLAN device (the hso device, with the EEE PC WLAN
> being the first) comes along rfkill_check_duplicity returns a negative
> value and so rfkill_register returns an error. Patch below fixes this
> for me.

Good catch, I screwed up on that one.  Please forward it with my ack to
linux-wireless@kernel.org and to Ivo van Doorn <IvDoorn@gmail.com> and John
W. Linville <linville@tuxdriver.com>.

Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>

> -----
> diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c
> index f949a48..1ba35a7 100644
> --- a/net/rfkill/rfkill.c
> +++ b/net/rfkill/rfkill.c
> @@ -603,7 +603,7 @@ static int rfkill_check_duplicity(const struct rfkill *rfkil
>         }
>  
>         /* 0: first switch of its kind */
> -       return test_bit(rfkill->type, seen);
> +       return (test_bit(rfkill->type, seen)) ? 1 : 0;
>  }
>  
>  static int rfkill_add_switch(struct rfkill *rfkill)
> -----
> 
> J.
>
diff mbox

Patch

diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c
index f949a48..1ba35a7 100644
--- a/net/rfkill/rfkill.c
+++ b/net/rfkill/rfkill.c
@@ -603,7 +603,7 @@  static int rfkill_check_duplicity(const struct rfkill *rfkil
        }
 
        /* 0: first switch of its kind */
-       return test_bit(rfkill->type, seen);
+       return (test_bit(rfkill->type, seen)) ? 1 : 0;
 }
 
 static int rfkill_add_switch(struct rfkill *rfkill)