1. 03 8月, 2010 1 次提交
  2. 13 7月, 2010 1 次提交
    • A
      net: autoconvert trivial BKL users to private mutex · 15fd0cd9
      Arnd Bergmann 提交于
      All these files use the big kernel lock in a trivial
      way to serialize their private file operations,
      typically resulting from an earlier semi-automatic
      pushdown from VFS.
      
      None of these drivers appears to want to lock against
      other code, and they all use the BKL as the top-level
      lock in their file operations, meaning that there
      is no lock-order inversion problem.
      
      Consequently, we can remove the BKL completely,
      replacing it with a per-file mutex in every case.
      Using a scripted approach means we can avoid
      typos.
      
      file=$1
      name=$2
      if grep -q lock_kernel ${file} ; then
          if grep -q 'include.*linux.mutex.h' ${file} ; then
                  sed -i '/include.*<linux\/smp_lock.h>/d' ${file}
          else
                  sed -i 's/include.*<linux\/smp_lock.h>.*$/include <linux\/mutex.h>/g' ${file}
          fi
          sed -i ${file} \
              -e "/^#include.*linux.mutex.h/,$ {
                      1,/^\(static\|int\|long\)/ {
                           /^\(static\|int\|long\)/istatic DEFINE_MUTEX(${name}_mutex);
      
      } }"  \
          -e "s/\(un\)*lock_kernel\>[ ]*()/mutex_\1lock(\&${name}_mutex)/g" \
          -e '/[      ]*cycle_kernel_lock();/d'
      else
          sed -i -e '/include.*\<smp_lock.h\>/d' ${file}  \
                      -e '/cycle_kernel_lock()/d'
      fi
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: netdev@vger.kernel.org
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      15fd0cd9
  3. 05 6月, 2010 1 次提交
  4. 03 6月, 2010 1 次提交
  5. 31 5月, 2010 2 次提交
    • J
      drivers/net/wan: Use memdup_user · 7d889504
      Julia Lawall 提交于
      Use memdup_user when user data is immediately copied into the
      allocated region.
      
      The semantic patch that makes this change is as follows:
      (http://coccinelle.lip6.fr/)
      
      // <smpl>
      @@
      expression from,to,size,flag;
      position p;
      identifier l1,l2;
      @@
      
      -  to = \(kmalloc@p\|kzalloc@p\)(size,flag);
      +  to = memdup_user(from,size);
         if (
      -      to==NULL
      +      IS_ERR(to)
                       || ...) {
         <+... when != goto l1;
      -  -ENOMEM
      +  PTR_ERR(to)
         ...+>
         }
      -  if (copy_from_user(to, from, size) != 0) {
      -    <+... when != goto l2;
      -    -EFAULT
      -    ...+>
      -  }
      // </smpl>
      Signed-off-by: NJulia Lawall <julia@diku.dk>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7d889504
    • J
      drivers/net/wan: Use memdup_user · c146fc9f
      Julia Lawall 提交于
      Use memdup_user when user data is immediately copied into the
      allocated region.
      
      The semantic patch that makes this change is as follows:
      (http://coccinelle.lip6.fr/)
      
      // <smpl>
      @@
      expression from,to,size,flag;
      position p;
      identifier l1,l2;
      @@
      
      -  to = \(kmalloc@p\|kzalloc@p\)(size,flag);
      +  to = memdup_user(from,size);
         if (
      -      to==NULL
      +      IS_ERR(to)
                       || ...) {
         <+... when != goto l1;
      -  -ENOMEM
      +  PTR_ERR(to)
         ...+>
         }
      -  if (copy_from_user(to, from, size) != 0) {
      -    <+... when != goto l2;
      -    -EFAULT
      -    ...+>
      -  }
      // </smpl>
      Signed-off-by: NJulia Lawall <julia@diku.dk>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c146fc9f
  6. 10 5月, 2010 1 次提交
  7. 23 4月, 2010 4 次提交
  8. 17 4月, 2010 1 次提交
  9. 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
  10. 25 3月, 2010 1 次提交
  11. 04 2月, 2010 1 次提交
  12. 08 1月, 2010 1 次提交
  13. 04 12月, 2009 3 次提交
  14. 02 12月, 2009 1 次提交
  15. 30 11月, 2009 3 次提交
  16. 26 11月, 2009 1 次提交
  17. 19 11月, 2009 2 次提交
  18. 07 11月, 2009 1 次提交
    • A
      net, compat_ioctl: handle socket ioctl abuses in tty drivers · 9646e7ce
      Arnd Bergmann 提交于
      Slip and a few other drivers use the same ioctl numbers on
      tty devices that are normally meant for sockets. This causes
      problems with our compat_ioctl handling that tries to convert
      the data structures in a different format.
      
      Fortunately, these five drivers all use 32 bit compatible
      data structures in the ioctl numbers, so we can just add
      a trivial compat_ioctl conversion function to each of them.
      
      SIOCSIFENCAP and SIOCGIFENCAP do not need to live in
      fs/compat_ioctl.c after this any more, and they are not
      used on any sockets.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9646e7ce
  19. 19 10月, 2009 1 次提交
  20. 14 10月, 2009 1 次提交
  21. 13 10月, 2009 1 次提交
  22. 12 10月, 2009 1 次提交
  23. 12 9月, 2009 1 次提交
    • J
      drivers/net/wan: introduce missing kfree · 966a5d1b
      Julia Lawall 提交于
      Error handling code following a kmalloc should free the allocated data.
      
      The semantic match that finds the problem is as follows:
      (http://www.emn.fr/x-info/coccinelle/)
      
      // <smpl>
      @r exists@
      local idexpression x;
      statement S;
      expression E;
      identifier f,f1,l;
      position p1,p2;
      expression *ptr != NULL;
      @@
      
      x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(...);
      ...
      if (x == NULL) S
      <... when != x
           when != if (...) { <+...x...+> }
      (
      x->f1 = E
      |
       (x->f1 == NULL || ...)
      |
       f(...,x->f1,...)
      )
      ...>
      (
       return \(0\|<+...x...+>\|ptr\);
      |
       return@p2 ...;
      )
      
      @script:python@
      p1 << r.p1;
      p2 << r.p2;
      @@
      
      print "* file: %s kmalloc %s return %s" % (p1[0].file,p1[0].line,p2[0].line)
      // </smpl>
      Signed-off-by: NJulia Lawall <julia@diku.dk>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      966a5d1b
  24. 07 9月, 2009 3 次提交
    • K
      IXP42x HSS support for setting internal clock rate · 5dbc4650
      Krzysztof Halasa 提交于
      HSS usually uses external clocks, so it's not a big deal. Internal clock
      is used for direct DTE-DTE connections and when the DCE doesn't provide
      it's own clock.
      
      This also depends on the oscillator frequency. Intel seems to have
      calculated the clock register settings for 33.33 MHz (66.66 MHz timer
      base). Their settings seem quite suboptimal both in terms of average
      frequency (60 ppm is unacceptable for G.703 applications, their primary
      intended usage(?)) and jitter.
      
      Many (most?) platforms use a 33.333 MHz oscillator, a 10 ppm difference
      from Intel's base.
      
      Instead of creating static tables, I've created a procedure to program
      the HSS clock register. The register consists of 3 parts (A, B, C).
      The average frequency (= bit rate) is:
      66.66x MHz / (A  + (B + 1) / (C + 1))
      The procedure aims at the closest average frequency, possibly at the
      cost of increased jitter. Nobody would be able to directly drive an
      unbufferred transmitter with a HSS anyway, and the frequency error is
      what it really counts.
      
      I've verified the above with an oscilloscope on IXP425. It seems IXP46x
      and possibly IXP43x use a bit different clock generation algorithm - it
      looks like the avg frequency is:
      (on IXP465) 66.66x MHz / (A  + B / (C + 1)).
      Also they use much greater precomputed A and B - on IXP425 it would
      simply result in more jitter, but I don't know how does it work on
      IXP46x (perhaps 3 least significant bits aren't used?).
      
      Anyway it looks that they were aiming for exactly +60 ppm or -60 ppm,
      while <1 ppm is typically possible (with a synchronized clock, of
      course).
      
      The attached patch makes it possible to set almost any bit rate
      (my IXP425 533 MHz quits at > 22 Mb/s if a single port is used, and the
      minimum is ca. 65 Kb/s).
      
      This is independent of MVIP (multi-E1/T1 on one HSS) mode.
      Signed-off-by: NKrzysztof Hałasa <khc@pm.waw.pl>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5dbc4650
    • K
      WAN: remove deprecated PCI_DEVICE_ID from PCI200SYN driver. · 32e6a0c8
      Krzysztof Halasa 提交于
      PCI200SYN has its own PCI subsystem device ID for 3+ years, now it's
      time to remove the generic PLX905[02] ID from the driver. Anyone with
      old EEPROM data will have to run the upgrade.
      
      Having the generic PLX905[02] (PCI-local bus bridge) ID is harmful
      as the driver tries to handle other devices based on these bridges.
      Signed-off-by: NKrzysztof Halasa <khc@pm.waw.pl>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      32e6a0c8
    • S
      wan: dlci/sdla transmit return dehacking · 38482428
      Stephen Hemminger 提交于
      This is a brute force removal of the wierd slave interface done for
      DLCI -> SDLA transmit. Before it was using non-standard return values
      and freeing skb in caller.  This changes it to using normal return
      values, and freeing in the callee.  Luckly only one driver pair was
      doing this. Not tested on real hardware, in fact I wonder if this
      driver pair is even being used by any users.
      Signed-off-by: NStephen Hemminger <shemminger@vyatta.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      38482428
  25. 04 9月, 2009 1 次提交
    • D
      WAN: dscc4: Fix warning pointing out a bug. · fab4e763
      David S. Miller 提交于
      Noticed by Stephen Rothwell:
      
      	Today's linux-next build (x86_64 allmodconfig gcc-4.4.0)
      	produced this warning:
      
      	drivers/net/wan/dscc4.c: In function 'dscc4_rx_skb':
      	drivers/net/wan/dscc4.c:670: warning: suggest parentheses around comparison in operand of '|'
      
      	which actually points out a bug, I think.  It is doing
      		(x & (y | z)) != y | z
      	when it probably means
      		(x & (y | z)) != (y | z)
      
      	Introduced by commit 5de3fcab
      	("WAN: bit and/or confusion").
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      fab4e763
  26. 01 9月, 2009 1 次提交
  27. 31 8月, 2009 1 次提交
  28. 29 8月, 2009 1 次提交
  29. 14 8月, 2009 1 次提交