31 Oct, 2011

1 commit

  • The changed files were only including linux/module.h for the
    EXPORT_SYMBOL infrastructure, and nothing else. Revector them
    onto the isolated export header for faster compile times.

    Nothing to see here but a whole lot of instances of:

    -#include
    +#include

    This commit is only changing the kernel dir; next targets
    will probably be mm, fs, the arch dirs, etc.

    Signed-off-by: Paul Gortmaker

    Paul Gortmaker
     

02 Oct, 2010

1 commit

  • The kfifo_dma family of functions use sg_mark_end() on the last element in
    their scatterlist. This forces use of a fresh scatterlist for each DMA
    operation, which makes recycling a single scatterlist impossible.

    Change the behavior of the kfifo_dma functions to match the usage of the
    dma_map_sg function. This means that users must respect the returned
    nents value. The sample code is updated to reflect the change.

    This bug is trivial to cause: call kfifo_dma_in_prepare() such that it
    prepares a scatterlist with a single entry comprising the whole fifo.
    This is the case when you map the entirety of a newly created empty fifo.
    This causes the setup_sgl() function to mark the first scatterlist entry
    as the end of the chain, no matter what comes after it.

    Afterwards, add and remove some data from the fifo such that another call
    to kfifo_dma_in_prepare() will create two scatterlist entries. It returns
    nents=2. However, due to the previous sg_mark_end() call, sg_is_last()
    will now return true for the first scatterlist element. This causes the
    sample code to print a single scatterlist element when it should print
    two.

    By removing the call to sg_mark_end(), we make the API as similar as
    possible to the DMA mapping API. All users are required to respect the
    returned nents.

    Signed-off-by: Ira W. Snyder
    Cc: Stefani Seibold
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ira W. Snyder
     

21 Aug, 2010

1 commit


12 Aug, 2010

1 commit

  • The current kfifo scatterlist implementation will not work with chained
    scatterlists. It assumes that struct scatterlist arrays are allocated
    contiguously, which is not the case when chained scatterlists (struct
    sg_table) are in use.

    Signed-off-by: Stefani Seibold
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Stefani Seibold
     

11 Aug, 2010

1 commit


17 Feb, 2010

2 commits

  • This patch fixes following sparse warnings:

    include/linux/kfifo.h:127:25: warning: Using plain integer as NULL pointer
    kernel/kfifo.c:83:21: warning: Using plain integer as NULL pointer

    Signed-off-by: Anton Vorontsov
    Acked-by: Stefani Seibold
    Signed-off-by: Greg Kroah-Hartman

    Anton Vorontsov
     
  • After kfifo rework it's no longer possible to reliably know if kfifo is
    usable, since after kfifo_free(), kfifo_initialized() would still return
    true. The correct behaviour is needed for at least FHCI USB driver.

    This patch fixes the issue by resetting the kfifo to zero values (the
    same approach is used in kfifo_alloc() if allocation failed).

    Signed-off-by: Anton Vorontsov
    Acked-by: Stefani Seibold
    Signed-off-by: Greg Kroah-Hartman

    Anton Vorontsov
     

03 Feb, 2010

1 commit

  • Fix kfifo kernel-doc warnings:

    Warning(kernel/kfifo.c:361): No description found for parameter 'total'
    Warning(kernel/kfifo.c:402): bad line: @ @lenout: pointer to output variable with copied data
    Warning(kernel/kfifo.c:412): No description found for parameter 'lenout'

    Signed-off-by: Randy Dunlap
    Cc: Stefani Seibold
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Randy Dunlap
     

17 Jan, 2010

4 commits

  • On my first try using them I missed that the fifos need to be power of
    two, resulting in a runtime bug. Document that requirement everywhere
    (and fix one grammar bug)

    Signed-off-by: Andi Kleen
    Acked-by: Stefani Seibold
    Cc: Roland Dreier
    Cc: Dmitry Torokhov
    Cc: Andy Walls
    Cc: Vikram Dhillon
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andi Kleen
     
  • In some upcoming code it's useful to peek into a FIFO without permanentely
    removing data. This patch implements a new kfifo_out_peek() to do this.

    Signed-off-by: Andi Kleen
    Acked-by: Stefani Seibold
    Cc: Roland Dreier
    Cc: Dmitry Torokhov
    Cc: Andy Walls
    Cc: Vikram Dhillon
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andi Kleen
     
  • Right now for kfifo_*_user it's not easily possible to distingush between
    a user copy failing and the FIFO not containing enough data. The problem
    is that both conditions are multiplexed into the same return code.

    Avoid this by moving the "copy length" into a separate output parameter
    and only return 0/-EFAULT in the main return value.

    I didn't fully adapt the weird "record" variants, those seem
    to be unused anyways and were rather messy (should they be just removed?)

    I would appreciate some double checking if I did all the conversions
    correctly.

    Signed-off-by: Andi Kleen
    Cc: Stefani Seibold
    Cc: Roland Dreier
    Cc: Dmitry Torokhov
    Cc: Andy Walls
    Cc: Vikram Dhillon
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andi Kleen
     
  • The pointers to user buffers are currently unsigned char *, which requires
    a lot of casting in the caller for any non-char typed buffers. Use void *
    instead.

    Signed-off-by: Andi Kleen
    Acked-by: Stefani Seibold
    Cc: Roland Dreier
    Cc: Dmitry Torokhov
    Cc: Andy Walls
    Cc: Vikram Dhillon
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andi Kleen
     

23 Dec, 2009

6 commits

  • Add kfifo_in_rec() - puts some record data into the FIFO
    Add kfifo_out_rec() - gets some record data from the FIFO
    Add kfifo_from_user_rec() - puts some data from user space into the FIFO
    Add kfifo_to_user_rec() - gets data from the FIFO and write it to user space
    Add kfifo_peek_rec() - gets the size of the next FIFO record field
    Add kfifo_skip_rec() - skip the next fifo out record
    Add kfifo_avail_rec() - determinate the number of bytes available in a record FIFO

    Signed-off-by: Stefani Seibold
    Acked-by: Greg Kroah-Hartman
    Acked-by: Mauro Carvalho Chehab
    Acked-by: Andi Kleen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Stefani Seibold
     
  • Add kfifo_reset_out() for save lockless discard the fifo output
    Add kfifo_skip() to skip a number of output bytes
    Add kfifo_from_user() to copy user space data into the fifo
    Add kfifo_to_user() to copy fifo data to user space

    Signed-off-by: Stefani Seibold
    Acked-by: Greg Kroah-Hartman
    Acked-by: Mauro Carvalho Chehab
    Acked-by: Andi Kleen
    Acked-by: Arnd Bergmann
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Stefani Seibold
     
  • rename kfifo_put... into kfifo_in... to prevent miss use of old non in
    kernel-tree drivers

    ditto for kfifo_get... -> kfifo_out...

    Improve the prototypes of kfifo_in and kfifo_out to make the kerneldoc
    annotations more readable.

    Add mini "howto porting to the new API" in kfifo.h

    Signed-off-by: Stefani Seibold
    Acked-by: Greg Kroah-Hartman
    Acked-by: Mauro Carvalho Chehab
    Acked-by: Andi Kleen
    Acked-by: Arnd Bergmann
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Stefani Seibold
     
  • change name of __kfifo_* functions to kfifo_*, because the prefix __kfifo
    should be reserved for internal functions only.

    Signed-off-by: Stefani Seibold
    Acked-by: Greg Kroah-Hartman
    Acked-by: Mauro Carvalho Chehab
    Acked-by: Andi Kleen
    Acked-by: Arnd Bergmann
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Stefani Seibold
     
  • Move the pointer to the spinlock out of struct kfifo. Most users in
    tree do not actually use a spinlock, so the few exceptions now have to
    call kfifo_{get,put}_locked, which takes an extra argument to a
    spinlock.

    Signed-off-by: Stefani Seibold
    Acked-by: Greg Kroah-Hartman
    Acked-by: Mauro Carvalho Chehab
    Acked-by: Andi Kleen
    Acked-by: Arnd Bergmann
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Stefani Seibold
     
  • This is a new generic kernel FIFO implementation.

    The current kernel fifo API is not very widely used, because it has to
    many constrains. Only 17 files in the current 2.6.31-rc5 used it.
    FIFO's are like list's a very basic thing and a kfifo API which handles
    the most use case would save a lot of development time and memory
    resources.

    I think this are the reasons why kfifo is not in use:

    - The API is to simple, important functions are missing
    - A fifo can be only allocated dynamically
    - There is a requirement of a spinlock whether you need it or not
    - There is no support for data records inside a fifo

    So I decided to extend the kfifo in a more generic way without blowing up
    the API to much. The new API has the following benefits:

    - Generic usage: For kernel internal use and/or device driver.
    - Provide an API for the most use case.
    - Slim API: The whole API provides 25 functions.
    - Linux style habit.
    - DECLARE_KFIFO, DEFINE_KFIFO and INIT_KFIFO Macros
    - Direct copy_to_user from the fifo and copy_from_user into the fifo.
    - The kfifo itself is an in place member of the using data structure, this save an
    indirection access and does not waste the kernel allocator.
    - Lockless access: if only one reader and one writer is active on the fifo,
    which is the common use case, no additional locking is necessary.
    - Remove spinlock - give the user the freedom of choice what kind of locking to use if
    one is required.
    - Ability to handle records. Three type of records are supported:
    - Variable length records between 0-255 bytes, with a record size
    field of 1 bytes.
    - Variable length records between 0-65535 bytes, with a record size
    field of 2 bytes.
    - Fixed size records, which no record size field.
    - Preserve memory resource.
    - Performance!
    - Easy to use!

    This patch:

    Since most users want to have the kfifo as part of another object,
    reorganize the code to allow including struct kfifo in another data
    structure. This requires changing the kfifo_alloc and kfifo_init
    prototypes so that we pass an existing kfifo pointer into them. This
    patch changes the implementation and all existing users.

    [akpm@linux-foundation.org: fix warning]
    Signed-off-by: Stefani Seibold
    Acked-by: Greg Kroah-Hartman
    Acked-by: Mauro Carvalho Chehab
    Acked-by: Andi Kleen
    Acked-by: Arnd Bergmann
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Stefani Seibold
     

20 Sep, 2009

1 commit

  • Currently kfifo cannot be used by parts of the kernel that use "const"
    properly as kfifo itself does not use const for passed data blocks which
    are indeed const.

    Signed-off-by: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    Alan Cox
     

17 Jun, 2009

1 commit


17 Jul, 2007

1 commit


12 Feb, 2007

1 commit

  • A variety of (mostly) innocuous fixes to the embedded kernel-doc content in
    source files, including:

    * make multi-line initial descriptions single line
    * denote some function names, constants and structs as such
    * change erroneous opening '/*' to '/**' in a few places
    * reword some text for clarity

    Signed-off-by: Robert P. J. Day
    Cc: "Randy.Dunlap"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Robert P. J. Day
     

30 Sep, 2006

1 commit

  • Both __kfifo_put() and __kfifo_get() have header comments stating that if
    there is but one concurrent reader and one concurrent writer, locking is not
    necessary. This is almost the case, but a couple of memory barriers are
    needed. Another option would be to change the header comments to remove the
    bit about locking not being needed, and to change the those callers who
    currently don't use locking to add the required locking. The attachment
    analyzes this approach, but the patch below seems simpler.

    Signed-off-by: Paul E. McKenney
    Cc: Stelian Pop
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Paul E. McKenney
     

09 Oct, 2005

1 commit

  • - added typedef unsigned int __nocast gfp_t;

    - replaced __nocast uses for gfp flags with gfp_t - it gives exactly
    the same warnings as far as sparse is concerned, doesn't change
    generated code (from gcc point of view we replaced unsigned int with
    typedef) and documents what's going on far better.

    Signed-off-by: Al Viro
    Signed-off-by: Linus Torvalds

    Al Viro
     

17 Apr, 2005

1 commit

  • Initial git repository build. I'm not bothering with the full history,
    even though we have it. We can create a separate "historical" git
    archive of that later if we want to, and in the meantime it's about
    3.2GB when imported into git - space that would just make the early
    git days unnecessarily complicated, when we don't have a lot of good
    infrastructure for it.

    Let it rip!

    Linus Torvalds