From: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless <linux-wireless@vger.kernel.org>,
Inaky Perez-Gonzalez <inaky@linux.intel.com>,
Dirk Opfer <Dirk@Opfer-Online.de>,
Matthew Garrett <mjg@redhat.com>
Subject: Re: [RFC] rfkill: rewrite
Date: Mon, 30 Mar 2009 18:02:33 -0300 [thread overview]
Message-ID: <20090330210233.GE23749@khazad-dum.debian.net> (raw)
In-Reply-To: <1238446338.5970.41.camel@johannes.local>
Hi Johannes!
On Mon, 30 Mar 2009, Johannes Berg wrote:
> On Mon, 2009-03-30 at 17:48 -0300, Henrique de Moraes Holschuh wrote:
>
> > Yes, thinkpad-acpi wants it. It uses that to make sure the bluethooth
> > and wwan rfkill _global_ state is kept across machine shutdown and
> > reboots (I can't do that for UWB because Lenovo didn't add persistence
> > for UWB for some reason).
>
> Yeah, I've added it back already :)
>
> > 1. thinkpad-acpi loads
> > 1a. reads radio states from firmware, and stores to rfkill core
> > default state for the specific radio type
> > 1b. registers the rfkill switch. The core will cause the just
> > registered rfkill switch state to be changed to match the
> > current global state for that switch type... which probably
> > is what thinkpad-acpi tried to set in 1a.
>
> Yeah -- I need to add back 1b; I removed it for now because it goes like
> this:
>
> driver - rfkill_register
> rfkill - rfkill_register
> rfkill - set radio
> driver - set radio <--- deadlock if this needs lock
>
> This I need to schedule that away.
>
> > > state should be set for the devices it applies to, but it seems that if
> > > the master rfkill switch is set to "transmitter off" then one needs to
> > > set the default state (for all USB transmitters etc) to off, correct?
> >
> > Well, the default is applied to a _type_, so it is valid for all
> > switches of that type.
>
> Right.
>
> > It is probably a good idea to have the rfkill core sanitize the
> > attempt to set the default state, and force it to "block" if EPO is
> > active (I don't recall if I checked for this failure mode in the old
> > code).
>
> No, but it rejects any calls to set the default state when any rfkill
> struct has been registered already. So this isn't a concern.
Suppose something entirely different (an input device) issued SW_RFKILL_ALL,
and EPO is in effect. It happened right at boot because the user turned the
laptop on with the rfkill switch active, and that driver loaded first.
Now another driver is loading, and is registering the first rfkill struct of
type foo (say, for an USB 'foo' dongle that has no idea whatsoever of any
platform rfkill switches), and that USB 'foo' dongle is a really well-made
device that even has NVRAM with lots of state pertaining to 'foo', including
a bit used to keep persistent on/off state.
It will try to set the default state for type 'foo' (which might well be
unblock) while EPO is active. This attempt to set the default for 'foo' to
ubblock can succeed or not (whatever is easier on the rfkill core code), but
either way it must _not_ cause any switches to be unblocked, and that
includes any subsequent rfkill_register (because EPO _is_ active)...
--
"One disk to rule them all, One disk to find them. One disk to bring
them all and in the darkness grind them. In the Land of Redmond
where the shadows lie." -- The Silicon Valley Tarot
Henrique Holschuh
next prev parent reply other threads:[~2009-03-30 21:02 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-29 17:53 [RFC] rfkill: rewrite Johannes Berg
2009-03-29 18:16 ` Ivo van Doorn
2009-03-30 13:27 ` Henrique de Moraes Holschuh
2009-03-30 9:06 ` Johannes Berg
2009-03-30 9:54 ` Michael Buesch
2009-03-30 9:57 ` Johannes Berg
2009-03-30 10:39 ` Johannes Berg
2009-03-30 9:40 ` Johannes Berg
2009-03-30 10:04 ` Matthew Garrett
2009-03-30 13:29 ` Henrique de Moraes Holschuh
2009-03-30 14:08 ` Johannes Berg
2009-03-30 17:34 ` Henrique de Moraes Holschuh
2009-03-30 17:41 ` Johannes Berg
2009-03-30 20:48 ` Henrique de Moraes Holschuh
2009-03-30 20:52 ` Johannes Berg
2009-03-30 21:02 ` Henrique de Moraes Holschuh [this message]
2009-03-30 21:20 ` Johannes Berg
2009-03-30 17:39 ` Inaky Perez-Gonzalez
2009-03-30 17:45 ` Johannes Berg
2009-03-30 17:54 ` Ivo van Doorn
2009-03-30 18:00 ` Johannes Berg
2009-03-30 20:36 ` Inaky Perez-Gonzalez
2009-03-30 20:43 ` Johannes Berg
2009-03-30 20:52 ` Henrique de Moraes Holschuh
2009-03-30 19:01 ` Johannes Berg
2009-03-30 22:07 ` Johannes Berg
2009-03-30 22:08 ` Johannes Berg
2009-03-30 21:15 ` Henrique de Moraes Holschuh
2009-03-30 21:26 ` Johannes Berg
2009-03-30 21:26 ` Johannes Berg
2009-04-05 14:59 ` Henrique de Moraes Holschuh
2009-04-07 10:36 ` Johannes Berg
2009-04-08 18:06 ` Henrique de Moraes Holschuh
2009-04-14 21:03 ` Johannes Berg
2009-03-30 22:16 ` [RFC/RFT v2] " Johannes Berg
2009-03-30 23:20 ` Larry Finger
2009-03-31 8:02 ` Johannes Berg
2009-03-31 8:11 ` Johannes Berg
2009-03-31 12:16 ` Johannes Berg
2009-03-31 18:20 ` Larry Finger
2009-03-31 18:32 ` Johannes Berg
2009-03-31 19:11 ` [RFC v3] " Johannes Berg
2009-04-14 21:48 ` [RFC v5] " Johannes Berg
2009-04-14 23:08 ` [RFC v6] " Johannes Berg
2009-04-15 4:34 ` Larry Finger
2009-04-30 3:19 ` Henrique de Moraes Holschuh
2009-04-30 8:53 ` Johannes Berg
2009-04-30 14:11 ` Henrique de Moraes Holschuh
2009-04-30 14:18 ` Johannes Berg
2009-04-30 15:06 ` Johannes Berg
2009-04-30 15:53 ` Henrique de Moraes Holschuh
2009-04-30 16:09 ` Johannes Berg
2009-04-30 15:14 ` [RFC v8] " Johannes Berg
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=20090330210233.GE23749@khazad-dum.debian.net \
--to=hmh@hmh.eng.br \
--cc=Dirk@Opfer-Online.de \
--cc=inaky@linux.intel.com \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=mjg@redhat.com \
/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 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).