1. 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
  2. 27 7月, 2010 1 次提交
  3. 15 7月, 2010 1 次提交
  4. 17 6月, 2010 3 次提交
  5. 08 6月, 2010 2 次提交
  6. 03 6月, 2010 1 次提交
  7. 08 4月, 2010 1 次提交
    • B
      ath5k: Adaptive Noise Immunity (ANI) Implementation · 2111ac0d
      Bruno Randolf 提交于
      This is an Adaptive Noise Imunity (ANI) implementation for ath5k. I have looked
      at both ath9k and HAL sources (they are nearly the same), and even though i
      have implemented some things differently, the basic algorithm is practically
      the same, for now. I hope that this can serve as a clean start to improve the
      algorithm later.
      
      This also adds a possibility to manually control ANI settings, right now only
      thru a debugfs file:
        * set lowest sensitivity (=highest noise immunity):
      	echo sens-low > /sys/kernel/debug/ath5k/phy0/ani
        * set highest sensitivity (=lowest noise immunity):
      	echo sens-high > /sys/kernel/debug/ath5k/phy0/ani
        * automatically control immunity (default):
      	echo ani-on > /sys/kernel/debug/ath5k/phy0/ani
        * to see the parameters in use and watch them change:
      	cat /sys/kernel/debug/ath5k/phy0/ani
      
      Manually setting sensitivity will turn the automatic control off. You can also
      control each of the five immunity parameters (noise immunity, spur immunity,
      firstep, ofdm weak signal detection, cck weak signal detection) manually thru
      the debugfs file.
      
      This is tested on AR5414 and nearly doubles the thruput in a noisy 2GHz band.
      Signed-off-by: NBruno Randolf <br1@einfach.org>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      2111ac0d
  8. 01 4月, 2010 1 次提交
  9. 11 3月, 2010 2 次提交
  10. 11 7月, 2009 1 次提交
  11. 23 4月, 2009 1 次提交
  12. 17 3月, 2009 1 次提交
  13. 30 1月, 2009 2 次提交
  14. 22 1月, 2009 1 次提交
  15. 26 11月, 2008 1 次提交
  16. 30 10月, 2008 1 次提交
  17. 06 9月, 2008 1 次提交
    • N
      ath5k: HW code cleanup · c6e387a2
      Nick Kossifidis 提交于
       * No code changes...
      
       * Split hw.c to multiple files for better maintenance and add some documentation on each file
         code is going to grow soon (eeprom.c for example is going to get much stuff currently developed
         on ath_info) so it's better this way.
      
       * Rename following functions to maintain naming scheme:
      
           ah_setup_xtx_desc -> ah_setup_mrr_tx_desc
           (Because xtx doesn't say much, it's actually
           a multi-rate-retry tx descriptor)
      
           ath5k_hw_put_tx/rx_buf - > ath5k_hw_set_tx/rxdp
           ath5k_hw_get_tx/rx_buf -> ath5k_hw_get_tx/rxdp
           (We don't put any "buf" we set descriptor pointers on hw)
      
           ath5k_hw_tx_start -> ath5k_hw_start_tx_dma
           ath5k_hw_start_rx -> ath5k_hw_start_rx_dma
           ath5k_hw_stop_pcu_recv -> ath5k_hw_stop_rx_pcu
           (It's easier this way to identify them, we also
           have ath5k_hw_start_rx_pcu which completes the
           set)
      
           ath5k_hw_set_intr -> ath5k_hw_set_imr
           (As in get_isr we set imr here, not "intr")
      
        * Move ath5k_hw_setup_rx_desc on ah->ah_setup_rx_desc so we can
          include support for different rx descriptors in the future
      
        * Further cleanups so that checkpatch doesn't complain
          (only some > 80 col warnings for eeprom.h and reg.h as usual
          due to comments)
      
        Tested on 5211 and 5213 cards and works ok.
      
      Changes-licensed-under: ISC
      Signed-off-by: NNick Kossifidis <mickflemm@gmail.com>
      Acked-by: NLuis R. Rodriguez <lrodriguez@atheros.com>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      c6e387a2
  18. 02 8月, 2008 1 次提交
  19. 08 3月, 2008 3 次提交
    • J
      wireless: correct warnings from using '%llx' for type 'u64' · f868f4e1
      John W. Linville 提交于
      drivers/net/wireless/ath5k/debug.c: In function 'read_file_tsf': drivers/net/wireless/ath5k/debug.c:203: warning: format '%016llx'
      expects type 'long long unsigned int', but argument 4 has type 'u64' drivers/net/wireless/ath5k/debug.c:203: warning: format '%016llx'
      expects type 'long long unsigned int', but argument 4 has type 'u64' drivers/net/wireless/ath5k/debug.c: In function 'read_file_beacon':
      drivers/net/wireless/ath5k/debug.c:274: warning: format '%016llx' expects type 'long long unsigned int', but argument 4 has type 'u64'
      drivers/net/wireless/ath5k/debug.c:274: warning: format '%016llx' expects type 'long long unsigned int', but argument 4 has type 'u64'
      
      drivers/net/wireless/iwlwifi/iwl-4965.c: In function 'iwl4965_tx_status_reply_compressed_ba':
      drivers/net/wireless/iwlwifi/iwl-4965.c:3907: warning: format '%llx' expects type 'long long unsigned int', but argument 4 has type 'u64'
      drivers/net/wireless/iwlwifi/iwl-4965.c: In function 'iwl4965_rx_reply_compressed_ba':
      drivers/net/wireless/iwlwifi/iwl-4965.c:4039: warning: format '%llx' expects type 'long long unsigned int', but argument 6 has type '__le64'
      drivers/net/wireless/iwlwifi/iwl-4965.c:4046: warning: format '%llx' expects type 'long long unsigned int', but argument 5 has type 'u64'
      drivers/net/wireless/iwlwifi/iwl4965-base.c: In function 'iwl4965_tx_status_reply_tx':
      drivers/net/wireless/iwlwifi/iwl4965-base.c:3661: warning: format '%llx' expects type 'long long unsigned int', but argument 6 has type 'u64'
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      f868f4e1
    • B
      ath5k: move rx and tx status structures out of hardware descriptor · b47f407b
      Bruno Randolf 提交于
      move ath5k_tx_status and ath5k_rx_status structures out of the hardware
      descriptor since they are not accessed by the hardware at all. they just
      contain converted information from the hardware descriptor. since they are only
      used in the rx and tx tasklets there is also no use to keep them for each
      descriptor.
      
      drivers/net/wireless/ath5k/ath5k.h:     Changes-licensed-under: ISC
      drivers/net/wireless/ath5k/base.c:      Changes-licensed-under: 3-Clause-BSD
      drivers/net/wireless/ath5k/debug.c:     Changes-licensed-under: GPL
      drivers/net/wireless/ath5k/debug.h:     Changes-licensed-under: GPL
      drivers/net/wireless/ath5k/hw.c:        Changes-licensed-under: ISC
      Signed-off-by: NBruno Randolf <bruno@thinktube.com>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      b47f407b
    • B
      ath5k: struct ath5k_desc cleanups · 19fd6e55
      Bruno Randolf 提交于
      * make struct ath5k_desc clearer by directly including unions of structures,
        which correspond to the hardware descriptors of different HW versions (5210
        and 5212). before they were casted at onto ath5k_desc at different points
        (e.g.  ds_hw[2]).
      
      * rename some structures and variable names to make their use clearer, e.g.
        struct ath5k_hw_4w_tx_desc to ath5k_hw_4w_tx_ctl.
      
      * substitute "old" with "5210" and "new" with "5212" (eg. rename
        ath5k_hw_proc_new_rx_status() to ath5k_hw_proc_5212_rx_status()) because old
        and new are relative and we might have a newer structure at some point.
      
      * unify structs ath5k_hw_old_rx_status and ath5k_hw_new_rx_status into one
        ath5k_hw_rx_status, because they only differ in the flags and masks.
      
      drivers/net/wireless/ath5k/ath5k.h:     Changes-licensed-under: ISC
      drivers/net/wireless/ath5k/debug.c:     Changes-licensed-under: GPL
      drivers/net/wireless/ath5k/hw.c:        Changes-licensed-under: ISC
      drivers/net/wireless/ath5k/hw.h:        Changes-licensed-under: ISC
      Signed-off-by: NBruno Randolf <bruno@thinktube.com>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      19fd6e55
  20. 01 3月, 2008 1 次提交
    • L
      ath5k: Port debug.c over to the new band API and enable as build option · b446197c
      Luis R. Rodriguez 提交于
      This patch finishes the port and enables debug as an build option.
      This was tested on:
      
      Atheros AR5213A chip found (MAC: 0x59, PHY: 0x43)
      RF5112A multiband radio found (0x36)
      
      Note:
      
      For 2 GHz band on the above card I noticed we get negative channel
      numbers. Will look into this unless someone beats me to it.
      
      Example out put when loading using:
      
      sudo modprobe ath5k debug=0x00000400
      
       Band 2 GHz: channels 26, rates 12
        channels:
           1 2412 00c0 0000
           2 2417 00c0 0000
           3 2422 00c0 0000
           4 2427 00c0 0000
           5 2432 00c0 0000
           6 2437 00c0 0000
           7 2442 00c0 0000
           8 2447 00c0 0000
           9 2452 00c0 0000
          10 2457 00c0 0000
          11 2462 00c0 0000
          12 2467 00c0 0000
          13 2472 00c0 0000
          14 2484 00c0 0000
         -498 2512 00c0 0000
         -494 2532 00c0 0000
         -490 2552 00c0 0000
         -486 2572 00c0 0000
         -482 2592 00c0 0000
         -478 2612 00c0 0000
         -474 2632 00c0 0000
         -470 2652 00c0 0000
         -466 2672 00c0 0000
         -462 2692 00c0 0000
         -458 2712 00c0 0000
         -454 2732 00c0 0000
       Band 5 GHz: channels 194, rates 8
        channels:
          27 5135 0140 0000
          28 5140 0140 0000
      [... etc ]
         219 6095 0140 0000
         220 6100 0140 0000
        rates:
           60 000b 0000 0000
           90 000f 0000 0000
          120 000a 0000 0000
          180 000e 0000 0000
          240 0009 0000 0000
          360 000d 0000 0000
          480 0008 0000 0000
          540 000c 0000 0000
      
      Changes to base.c, base.h
      Changes-licensed-under: 3-Clause-BSD
      
      Changes to debug.c, debug.h
      Changes-licensed-under: GPL
      Signed-off-by: NLuis R. Rodriguez <mcgrof@winlab.rutgers.edu>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      b446197c
  21. 01 2月, 2008 1 次提交
    • B
      ath5k: debug level improvements · be9b7259
      Bruno Randolf 提交于
      * use only one debug level for beacon debugging: unify ATH5K_DEBUG_BEACON and
      ATH5K_DEBUG_BEACON_PROC.
      
      * remove debug level ATH5K_DEBUG_FATAL. doesn't make sense as a debug level -
      if it's fatal it should be logged as an error.
      
      * fancier printing of debug levels. cat /debugfs/ath5k/phy0/debug.
      
      * allow debug levels to be changed by echoing their name into
      /debugfs/ath5k/phy0/debug. this will toggle the state, when it was off it will
      be turned on and vice versa.
      
      * use copy_from_user() when reading from the debug files. use unsigned int for
      better optimization. reduce buffer sizes on stack.
      
      drivers/net/wireless/ath5k/base.c:      Changes-licensed-under: 3-Clause-BSD
      drivers/net/wireless/ath5k/debug.c:     Changes-licensed-under: GPL
      drivers/net/wireless/ath5k/debug.h:     Changes-licensed-under: GPL
      Signed-off-by: NBruno Randolf <bruno@thinktube.com>
      Acked-by: NLuis R. Rodriguez <mcgrof@winlab.rutgers.edu>
      Acked-by: NJiri Slaby <jirislaby@gmail.com>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      be9b7259
  22. 29 1月, 2008 1 次提交