1. 23 10月, 2010 3 次提交
  2. 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
  3. 08 3月, 2010 1 次提交
  4. 12 10月, 2009 1 次提交
  5. 28 9月, 2009 1 次提交
  6. 25 3月, 2009 2 次提交
    • I
      UIO: Take offset into account when determining number of pages that can be mapped · 6da2d377
      Ian Abbott 提交于
      If a UIO memory region does not start on a page boundary but straddles one,
      the number of actual pages that overlap the memory region may be calculated
      incorrectly because the offset isn't taken into account.  If userspace sets
      the mmap length to offset+size, it may fail with -EINVAL if UIO thinks it's
      trying to allocate too many pages.
      Signed-off-by: NIan Abbott <abbotti@mev.co.uk>
      Cc: Hans J. Koch <hjk@linutronix.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      6da2d377
    • H
      UIO: Add name attributes for mappings and port regions · 82057791
      Hans J. Koch 提交于
      If a UIO device has several memory mappings, it can be difficult for userspace
      to find the right one. The situation becomes even worse if the UIO driver can
      handle different versions of a card that have different numbers of mappings.
      Benedikt Spranger has such cards and pointed this out to me. Thanks, Bene!
      
      To address this problem, this patch adds "name" sysfs attributes for each
      mapping. Userspace can use these to clearly identify each mapping. The name
      string is optional. If a driver doesn't set it, an empty string will be
      returned, so this patch won't break existing drivers.
      
      The same problem exists for port region information, so a "name" attribute is
      added there, too.
      Signed-off-by: NHans J. Koch <hjk@linutronix.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      82057791
  7. 07 1月, 2009 1 次提交
    • H
      UIO: Pass information about ioports to userspace (V2) · e70c412e
      Hans J. Koch 提交于
      Devices sometimes have memory where all or parts of it can not be mapped to
      userspace. But it might still be possible to access this memory from
      userspace by other means. An example are PCI cards that advertise not only
      mappable memory but also ioport ranges. On x86 architectures, these can be
      accessed with ioperm, iopl, inb, outb, and friends. Mike Frysinger (CCed)
      reported a similar problem on Blackfin arch where it doesn't seem to be easy
      to mmap non-cached memory but it can still be accessed from userspace.
      
      This patch allows kernel drivers to pass information about such ports to
      userspace. Similar to the existing mem[] array, it adds a port[] array to
      struct uio_info. Each port range is described by start, size, and porttype.
      
      If a driver fills in at least one such port range, the UIO core will simply
      pass this information to userspace by creating a new directory "portio"
      underneath /sys/class/uio/uioN/. Similar to the "mem" directory, it will
      contain a subdirectory (portX) for each port range given.
      
      Note that UIO simply passes this information to userspace, it performs no
      action whatsoever with this data. It's userspace's responsibility to obtain
      access to these ports and to solve arch dependent issues. The "porttype"
      attribute tells userspace what kind of port it is dealing with.
      
      This mechanism could also be used to give userspace information about GPIOs
      related to a device. You frequently find such hardware in embedded devices,
      so I added a UIO_PORT_GPIO definition. I'm not really sure if this is a good
      idea since there are other solutions to this problem, but it won't hurt much
      anyway.
      Signed-off-by: NHans J. Koch <hjk@linutronix.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      e70c412e
  8. 02 11月, 2008 1 次提交
    • A
      saner FASYNC handling on file close · 233e70f4
      Al Viro 提交于
      As it is, all instances of ->release() for files that have ->fasync()
      need to remember to evict file from fasync lists; forgetting that
      creates a hole and we actually have a bunch that *does* forget.
      
      So let's keep our lives simple - let __fput() check FASYNC in
      file->f_flags and call ->fasync() there if it's been set.  And lose that
      crap in ->release() instances - leaving it there is still valid, but we
      don't have to bother anymore.
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      233e70f4
  9. 17 10月, 2008 4 次提交
  10. 22 7月, 2008 1 次提交
  11. 21 6月, 2008 1 次提交
  12. 21 5月, 2008 1 次提交
    • G
      UIO: fix race in device_create · 43691da4
      Greg Kroah-Hartman 提交于
      There is a race from when a device is created with device_create() and
      then the drvdata is set with a call to dev_set_drvdata() in which a
      sysfs file could be open, yet the drvdata will be NULL, causing all
      sorts of bad things to happen.
      
      This patch fixes the problem by using the new function,
      device_create_drvdata().
      
      Cc: Kay Sievers <kay.sievers@vrfy.org>
      Cc: Hans J. Koch <hjk@linutronix.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      43691da4
  13. 20 4月, 2008 1 次提交
  14. 25 3月, 2008 1 次提交
  15. 22 2月, 2008 1 次提交
  16. 07 2月, 2008 1 次提交
  17. 25 1月, 2008 6 次提交
  18. 19 7月, 2007 1 次提交
    • H
      UIO: Add the User IO core code · beafc54c
      Hans J. Koch 提交于
      This interface allows the ability to write the majority of a driver in
      userspace with only a very small shell of a driver in the kernel itself.
      It uses a char device and sysfs to interact with a userspace process to
      process interrupts and control memory accesses.
      
      See the docbook documentation for more details on how to use this
      interface.
      
      From: Hans J. Koch <hjk@linutronix.de>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Benedikt Spranger <b.spranger@linutronix.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      beafc54c