1. 21 1月, 2011 1 次提交
    • D
      kconfig: rename CONFIG_EMBEDDED to CONFIG_EXPERT · 6a108a14
      David Rientjes 提交于
      The meaning of CONFIG_EMBEDDED has long since been obsoleted; the option
      is used to configure any non-standard kernel with a much larger scope than
      only small devices.
      
      This patch renames the option to CONFIG_EXPERT in init/Kconfig and fixes
      references to the option throughout the kernel.  A new CONFIG_EMBEDDED
      option is added that automatically selects CONFIG_EXPERT when enabled and
      can be used in the future to isolate options that should only be
      considered for embedded systems (RISC architectures, SLOB, etc).
      
      Calling the option "EXPERT" more accurately represents its intention: only
      expert users who understand the impact of the configuration changes they
      are making should enable it.
      Reviewed-by: NIngo Molnar <mingo@elte.hu>
      Acked-by: NDavid Woodhouse <david.woodhouse@intel.com>
      Signed-off-by: NDavid Rientjes <rientjes@google.com>
      Cc: Greg KH <gregkh@suse.de>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Robin Holt <holt@sgi.com>
      Cc: <linux-arch@vger.kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      6a108a14
  2. 16 11月, 2010 1 次提交
  3. 15 10月, 2010 1 次提交
    • A
      llseek: automatically add .llseek fop · 6038f373
      Arnd Bergmann 提交于
      All file_operations should get a .llseek operation so we can make
      nonseekable_open the default for future file operations without a
      .llseek pointer.
      
      The three cases that we can automatically detect are no_llseek, seq_lseek
      and default_llseek. For cases where we can we can automatically prove that
      the file offset is always ignored, we use noop_llseek, which maintains
      the current behavior of not returning an error from a seek.
      
      New drivers should normally not use noop_llseek but instead use no_llseek
      and call nonseekable_open at open time.  Existing drivers can be converted
      to do the same when the maintainer knows for certain that no user code
      relies on calling seek on the device file.
      
      The generated code is often incorrectly indented and right now contains
      comments that clarify for each added line why a specific variant was
      chosen. In the version that gets submitted upstream, the comments will
      be gone and I will manually fix the indentation, because there does not
      seem to be a way to do that using coccinelle.
      
      Some amount of new code is currently sitting in linux-next that should get
      the same modifications, which I will do at the end of the merge window.
      
      Many thanks to Julia Lawall for helping me learn to write a semantic
      patch that does all this.
      
      ===== begin semantic patch =====
      // This adds an llseek= method to all file operations,
      // as a preparation for making no_llseek the default.
      //
      // The rules are
      // - use no_llseek explicitly if we do nonseekable_open
      // - use seq_lseek for sequential files
      // - use default_llseek if we know we access f_pos
      // - use noop_llseek if we know we don't access f_pos,
      //   but we still want to allow users to call lseek
      //
      @ open1 exists @
      identifier nested_open;
      @@
      nested_open(...)
      {
      <+...
      nonseekable_open(...)
      ...+>
      }
      
      @ open exists@
      identifier open_f;
      identifier i, f;
      identifier open1.nested_open;
      @@
      int open_f(struct inode *i, struct file *f)
      {
      <+...
      (
      nonseekable_open(...)
      |
      nested_open(...)
      )
      ...+>
      }
      
      @ read disable optional_qualifier exists @
      identifier read_f;
      identifier f, p, s, off;
      type ssize_t, size_t, loff_t;
      expression E;
      identifier func;
      @@
      ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
      {
      <+...
      (
         *off = E
      |
         *off += E
      |
         func(..., off, ...)
      |
         E = *off
      )
      ...+>
      }
      
      @ read_no_fpos disable optional_qualifier exists @
      identifier read_f;
      identifier f, p, s, off;
      type ssize_t, size_t, loff_t;
      @@
      ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
      {
      ... when != off
      }
      
      @ write @
      identifier write_f;
      identifier f, p, s, off;
      type ssize_t, size_t, loff_t;
      expression E;
      identifier func;
      @@
      ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
      {
      <+...
      (
        *off = E
      |
        *off += E
      |
        func(..., off, ...)
      |
        E = *off
      )
      ...+>
      }
      
      @ write_no_fpos @
      identifier write_f;
      identifier f, p, s, off;
      type ssize_t, size_t, loff_t;
      @@
      ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
      {
      ... when != off
      }
      
      @ fops0 @
      identifier fops;
      @@
      struct file_operations fops = {
       ...
      };
      
      @ has_llseek depends on fops0 @
      identifier fops0.fops;
      identifier llseek_f;
      @@
      struct file_operations fops = {
      ...
       .llseek = llseek_f,
      ...
      };
      
      @ has_read depends on fops0 @
      identifier fops0.fops;
      identifier read_f;
      @@
      struct file_operations fops = {
      ...
       .read = read_f,
      ...
      };
      
      @ has_write depends on fops0 @
      identifier fops0.fops;
      identifier write_f;
      @@
      struct file_operations fops = {
      ...
       .write = write_f,
      ...
      };
      
      @ has_open depends on fops0 @
      identifier fops0.fops;
      identifier open_f;
      @@
      struct file_operations fops = {
      ...
       .open = open_f,
      ...
      };
      
      // use no_llseek if we call nonseekable_open
      ////////////////////////////////////////////
      @ nonseekable1 depends on !has_llseek && has_open @
      identifier fops0.fops;
      identifier nso ~= "nonseekable_open";
      @@
      struct file_operations fops = {
      ...  .open = nso, ...
      +.llseek = no_llseek, /* nonseekable */
      };
      
      @ nonseekable2 depends on !has_llseek @
      identifier fops0.fops;
      identifier open.open_f;
      @@
      struct file_operations fops = {
      ...  .open = open_f, ...
      +.llseek = no_llseek, /* open uses nonseekable */
      };
      
      // use seq_lseek for sequential files
      /////////////////////////////////////
      @ seq depends on !has_llseek @
      identifier fops0.fops;
      identifier sr ~= "seq_read";
      @@
      struct file_operations fops = {
      ...  .read = sr, ...
      +.llseek = seq_lseek, /* we have seq_read */
      };
      
      // use default_llseek if there is a readdir
      ///////////////////////////////////////////
      @ fops1 depends on !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      identifier readdir_e;
      @@
      // any other fop is used that changes pos
      struct file_operations fops = {
      ... .readdir = readdir_e, ...
      +.llseek = default_llseek, /* readdir is present */
      };
      
      // use default_llseek if at least one of read/write touches f_pos
      /////////////////////////////////////////////////////////////////
      @ fops2 depends on !fops1 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      identifier read.read_f;
      @@
      // read fops use offset
      struct file_operations fops = {
      ... .read = read_f, ...
      +.llseek = default_llseek, /* read accesses f_pos */
      };
      
      @ fops3 depends on !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      identifier write.write_f;
      @@
      // write fops use offset
      struct file_operations fops = {
      ... .write = write_f, ...
      +	.llseek = default_llseek, /* write accesses f_pos */
      };
      
      // Use noop_llseek if neither read nor write accesses f_pos
      ///////////////////////////////////////////////////////////
      
      @ fops4 depends on !fops1 && !fops2 && !fops3 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      identifier read_no_fpos.read_f;
      identifier write_no_fpos.write_f;
      @@
      // write fops use offset
      struct file_operations fops = {
      ...
       .write = write_f,
       .read = read_f,
      ...
      +.llseek = noop_llseek, /* read and write both use no f_pos */
      };
      
      @ depends on has_write && !has_read && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      identifier write_no_fpos.write_f;
      @@
      struct file_operations fops = {
      ... .write = write_f, ...
      +.llseek = noop_llseek, /* write uses no f_pos */
      };
      
      @ depends on has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      identifier read_no_fpos.read_f;
      @@
      struct file_operations fops = {
      ... .read = read_f, ...
      +.llseek = noop_llseek, /* read uses no f_pos */
      };
      
      @ depends on !has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      @@
      struct file_operations fops = {
      ...
      +.llseek = noop_llseek, /* no read or write fn */
      };
      ===== End semantic patch =====
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Cc: Julia Lawall <julia@diku.dk>
      Cc: Christoph Hellwig <hch@infradead.org>
      6038f373
  4. 24 9月, 2010 1 次提交
  5. 30 3月, 2010 1 次提交
    • T
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo 提交于
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      
        http://userweb.kernel.org/~tj/misc/slabh-sweep.py
      
      The script does the followings.
      
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
        file.
      
      The conversion was done in the following steps.
      
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
         files.
      
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
         necessary.
      
      6. percpu.h was updated not to include slab.h.
      
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
      
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Guess-its-ok-by: NChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
      5a0e3ad6
  6. 20 3月, 2010 1 次提交
  7. 11 3月, 2010 1 次提交
  8. 03 3月, 2010 1 次提交
  9. 08 12月, 2009 1 次提交
  10. 24 11月, 2009 1 次提交
  11. 19 11月, 2009 1 次提交
  12. 05 10月, 2009 1 次提交
  13. 05 8月, 2009 1 次提交
  14. 22 7月, 2009 2 次提交
  15. 11 7月, 2009 1 次提交
    • J
      rfkill: prep for rfkill API changes · 1be491fc
      Johannes Berg 提交于
      We've designed the /dev/rfkill API in a way that we
      can increase the event struct by adding members at
      the end, should it become necessary. To validate the
      events, userspace and the kernel need to have the
      proper event size to check for -- when reading from
      the other end they need to verify that it's at least
      version 1 of the event API, with the current struct
      size, so define a constant for that and make the
      code a little more 'future proof'.
      
      Not that I expect that we'll have to change the event
      size any time soon, but it's better to write the code
      in a way that lends itself to extending.
      
      Due to the current size of the event struct, the code
      is currently equivalent, but should the event struct
      ever need to be increased the new code might not need
      changing.
      Signed-off-by: NJohannes Berg <johannes@sipsolutions.net>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      1be491fc
  16. 19 6月, 2009 3 次提交
    • A
      rfkill: export persistent attribute in sysfs · 464902e8
      Alan Jenkins 提交于
      This information allows userspace to implement a hybrid policy where
      it can store the rfkill soft-blocked state in platform non-volatile
      storage if available, and if not then file-based storage can be used.
      
      Some users prefer platform non-volatile storage because of the behaviour
      when dual-booting multiple versions of Linux, or if the rfkill setting
      is changed in the BIOS setting screens, or if the BIOS responds to
      wireless-toggle hotkeys itself before the relevant platform driver has
      been loaded.
      Signed-off-by: NAlan Jenkins <alan-jenkins@tuffmail.co.uk>
      Acked-by: NHenrique de Moraes Holschuh <hmh@hmh.eng.br>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      464902e8
    • A
      rfkill: don't restore software blocked state on persistent devices · 06d5caf4
      Alan Jenkins 提交于
      The setting of the "persistent" flag is also made more explicit using
      a new rfkill_init_sw_state() function, instead of special-casing
      rfkill_set_sw_state() when it is called before registration.
      
      Suspend is a bit of a corner case so we try to get away without adding
      another hack to rfkill-input - it's going to be removed soon.
      If the state does change over suspend, users will simply have to prod
      rfkill-input twice in order to toggle the state.
      
      Userspace policy agents will be able to implement a more consistent user
      experience.  For example, they can avoid the above problem if they
      toggle devices individually.  Then there would be no "global state"
      to get out of sync.
      
      Currently there are only two rfkill drivers with persistent soft-blocked
      state.  thinkpad-acpi already checks the software state on resume.
      eeepc-laptop will require modification.
      Signed-off-by: NAlan Jenkins <alan-jenkins@tuffmail.co.uk>
      CC: Marcel Holtmann <marcel@holtmann.org>
      Acked-by: NHenrique de Moraes Holschuh <hmh@hmh.eng.br>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      06d5caf4
    • A
      rfkill: rfkill_set_block() when suspended nitpick · 7fa20a7f
      Alan Jenkins 提交于
      If we return after fiddling with the state, userspace will see the
      wrong state and rfkill_set_sw_state() won't work until the next call to
      rfkill_set_block().  At the moment rfkill_set_block() will always be
      called from rfkill_resume(), but this will change in future.
      
      Also, presumably the point of this test is to avoid bothering devices
      which may be suspended.  If we don't want to call set_block(), we
      probably don't want to call query() either :-).
      Signed-off-by: NAlan Jenkins <alan-jenkins@tuffmail.co.uk>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      7fa20a7f
  17. 11 6月, 2009 4 次提交
  18. 04 6月, 2009 4 次提交
    • J
      rfkill: always init poll delayed work · 2ec2c68c
      Johannes Berg 提交于
      The rfkill core didn't initialise the poll delayed work
      because it assumed that polling was always done by specifying
      the poll function. cfg80211, however, would like to start
      polling only later, which is a valid use case and easy to
      support, so change rfkill to always initialise the poll
      delayed work and thus allow starting polling by calling the
      rfkill_resume_polling() function after registration.
      Signed-off-by: NJohannes Berg <johannes@sipsolutions.net>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      2ec2c68c
    • J
      rfkill: add function to query state · 6081162e
      Johannes Berg 提交于
      Sometimes it is necessary to know how the state is,
      and it is easier to query rfkill than keep track of
      it somewhere else, so add a function for that. This
      could later be expanded to return hard/soft block,
      but so far that isn't necessary.
      Signed-off-by: NJohannes Berg <johannes@sipsolutions.net>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      6081162e
    • J
      rfkill: create useful userspace interface · c64fb016
      Johannes Berg 提交于
      The new code added by this patch will make rfkill create
      a misc character device /dev/rfkill that userspace can use
      to control rfkill soft blocks and get status of devices as
      well as events when the status changes.
      
      Using it is very simple -- when you open it you can read
      a number of times to get the initial state, and every
      further read blocks (you can poll) on getting the next
      event from the kernel. The same structure you read is
      also used when writing to it to change the soft block of
      a given device, all devices of a given type, or all
      devices.
      
      This also makes CONFIG_RFKILL_INPUT selectable again in
      order to be able to test without it present since its
      functionality can now be replaced by userspace entirely
      and distros and users may not want the input part of
      rfkill interfering with their userspace code. We will
      also write a userspace daemon to handle all that and
      consequently add the input code to the feature removal
      schedule.
      
      In order to have rfkilld support both kernels with and
      without CONFIG_RFKILL_INPUT (or new kernels after its
      eventual removal) we also add an ioctl (that only exists
      if rfkill-input is present) to disable rfkill-input.
      It is not very efficient, but at least gives the correct
      behaviour in all cases.
      Signed-off-by: NJohannes Berg <johannes@sipsolutions.net>
      Acked-by: NMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      c64fb016
    • J
      rfkill: rewrite · 19d337df
      Johannes Berg 提交于
      This patch completely rewrites the rfkill core to address
      the following deficiencies:
      
       * all rfkill drivers need to implement polling where necessary
         rather than having one central implementation
      
       * updating the rfkill state cannot be done from arbitrary
         contexts, forcing drivers to use schedule_work and requiring
         lots of code
      
       * rfkill drivers need to keep track of soft/hard blocked
         internally -- the core should do this
      
       * the rfkill API has many unexpected quirks, for example being
         asymmetric wrt. alloc/free and register/unregister
      
       * rfkill can call back into a driver from within a function the
         driver called -- this is prone to deadlocks and generally
         should be avoided
      
       * rfkill-input pointlessly is a separate module
      
       * drivers need to #ifdef rfkill functions (unless they want to
         depend on or select RFKILL) -- rfkill should provide inlines
         that do nothing if it isn't compiled in
      
       * the rfkill structure is not opaque -- drivers need to initialise
         it correctly (lots of sanity checking code required) -- instead
         force drivers to pass the right variables to rfkill_alloc()
      
       * the documentation is hard to read because it always assumes the
         reader is completely clueless and contains way TOO MANY CAPS
      
       * the rfkill code needlessly uses a lot of locks and atomic
         operations in locked sections
      
       * fix LED trigger to actually change the LED when the radio state
         changes -- this wasn't done before
      Tested-by: NAlan Jenkins <alan-jenkins@tuffmail.co.uk>
      Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br> [thinkpad]
      Signed-off-by: NJohannes Berg <johannes@sipsolutions.net>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      19d337df
  19. 07 5月, 2009 1 次提交
  20. 23 4月, 2009 3 次提交
  21. 05 1月, 2009 1 次提交
  22. 13 12月, 2008 1 次提交
  23. 26 11月, 2008 2 次提交
  24. 11 11月, 2008 1 次提交
  25. 07 11月, 2008 1 次提交
  26. 01 11月, 2008 3 次提交
    • H
      rfkill: rate-limit rfkill-input workqueue usage (v3) · 78236571
      Henrique de Moraes Holschuh 提交于
      Limit the number of "expensive" rfkill workqueue operations per second, in
      order to not hog system resources too much when faced with a rogue source
      of rfkill input events.
      
      The old rfkill-input code (before it was refactored) had such a limit in
      place.  It used to drop new events that were past the rate limit.  This
      behaviour was not implemented as an anti-DoS measure, but rather as an
      attempt to work around deficiencies in input device drivers which would
      issue multiple KEY_FOO events too soon for a given key FOO (i.e. ones that
      do not implement mechanical debouncing properly).
      
      However, we can't really expect such issues to be worked around by every
      input handler out there, and also by every userspace client of input
      devices.  It is the input device driver's responsability to do debouncing
      instead of spamming the input layer with bogus events.
      
      The new limiter code is focused only on anti-DoS behaviour, and tries to
      not lose events (instead, it coalesces them when possible).
      
      The transmitters are updated once every 200ms, maximum.  Care is taken not
      to delay a request to _enter_ rfkill transmitter Emergency Power Off (EPO)
      mode.
      
      If mistriggered (e.g. by a jiffies counter wrap), the code delays processing
      *once* by 200ms.
      Signed-off-by: NHenrique de Moraes Holschuh <hmh@hmh.eng.br>
      Cc: Ivo van Doorn <IvDoorn@gmail.com>
      Cc: Dmitry Torokhov <dtor@mail.ru>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      78236571
    • H
      rfkill: honour EPO state when resuming a rfkill controller · 17670799
      Henrique de Moraes Holschuh 提交于
      rfkill_resume() would always restore the rfkill controller state to its
      pre-suspend state.
      
      Now that we know when we are under EPO, kick the rfkill controller to
      SOFT_BLOCKED state instead of to its pre-suspend state when it is resumed
      while EPO mode is active.
      Signed-off-by: NHenrique de Moraes Holschuh <hmh@hmh.eng.br>
      Cc: Ivo van Doorn <IvDoorn@gmail.com>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      17670799
    • H
      rfkill: add master_switch_mode and EPO lock to rfkill and rfkill-input · d003922d
      Henrique de Moraes Holschuh 提交于
      Add of software-based sanity to rfkill and rfkill-input so that it can
      reproduce what hardware-based EPO switches do, blocking all transmitters
      and locking down any further attempts to unblock them until the switch is
      deactivated.
      
      rfkill-input is responsible for issuing the EPO control requests, like
      before.
      
      While an rfkill EPO is active, all transmitters are locked to one of the
      BLOCKED states and all attempts to change that through the rfkill API
      (userspace and kernel) will be either ignored or return -EPERM errors.
      
      The lock will be released upon receipt of EV_SW SW_RFKILL_ALL ON by
      rfkill-input, or should modular rfkill-input be unloaded.
      
      This makes rfkill and rfkill-input extend the operation of an existing
      wireless master kill switch to all wireless devices in the system, even
      those that are not under hardware or firmware control.
      
      Since the above is the expected operational behavior for the master rfkill
      switch, the EPO lock functionality is not optional.
      
      Also, extend rfkill-input to allow for three different behaviors when it
      receives an EV_SW SW_RFKILL_ALL ON input event.  The user can set which
      behavior he wants through the master_switch_mode parameter:
      
      master_switch_mode = 0: EV_SW SW_RFKILL_ALL ON just unlocks rfkill
      controller state changes (so that the rfkill userspace and kernel APIs can
      now be used to change rfkill controller states again), but doesn't change
      any of their states (so they will all remain blocked).  This is the safest
      mode of operation, as it requires explicit operator action to re-enable a
      transmitter.
      
      master_switch_mode = 1: EV_SW SW_RFKILL_ALL ON causes rfkill-input to
      attempt to restore the system to the state before the last EV_SW
      SW_RFKILL_ALL OFF event, or to the default global states if no EV_SW
      SW_RFKILL_ALL OFF ever happened.   This is the recommended mode of
      operation for laptops.
      
      master_switch_mode = 2: tries to unblock all rfkill controllers (i.e.
      enable all transmitters) when an EV_SW SW_RFKILL_ALL ON event is received.
      This is the default mode of operation, as it mimics the previous behavior
      of rfkill-input.
      
      In order to implement these features in a clean way, the entire event
      handling of rfkill-input was refactored into a single worker function.
      
      Protection against input event DoS (repeatedly firing rfkill events for
      rfkill-input to process) was removed during the code refactoring.  It will
      be added back in a future patch.
      
      Note that with these changes, rfkill-input doesn't need to explicitly
      handle any radio types for which KEY_<radio type> or SW_<radio type> events
      do not exist yet.
      
      Code to handle EV_SW SW_{WLAN,WWAN,BLUETOOTH,WIMAX,...} was added as it
      might be needed in the future (and its implementation is not that obvious),
      but is currently #ifdef'd out to avoid wasting resources.
      Signed-off-by: NHenrique de Moraes Holschuh <hmh@hmh.eng.br>
      Cc: Ivo van Doorn <IvDoorn@gmail.com>
      Cc: Dmitry Torokhov <dtor@mail.ru>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      d003922d