LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Jonathan McDowell <noodles@earth.li>
To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: [PATCH] Fix logic error in rfkill_check_duplicity
Date: Thu, 30 Oct 2008 14:44:09 +0000	[thread overview]
Message-ID: <20081030144409.GJ3162@earth.li> (raw)
In-Reply-To: <20081030102746.GI3162@earth.li>

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>

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

-- 
/-\                             |  Shall I call the United Nations?
|@/  Debian GNU/Linux Developer |
\-                              |

  reply	other threads:[~2008-10-30 14:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-29 16:40 2.6.28-rc2 / hso driver oops Jonathan McDowell
2008-10-29 19:40 ` Ben Hutchings
2008-10-30 10:27   ` [PATCH] Cleanup hso rfkill error handling [was: 2.6.28-rc2 / hso driver oops] Jonathan McDowell
2008-10-30 14:44     ` Jonathan McDowell [this message]
2008-10-30 20:49       ` [PATCH] Fix logic error in rfkill_check_duplicity Henrique de Moraes Holschuh

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=20081030144409.GJ3162@earth.li \
    --to=noodles@earth.li \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --subject='Re: [PATCH] Fix logic error in rfkill_check_duplicity' \
    /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

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