linux/drivers/net/wireless
Stefani Seibold 4546548789 kfifo: move struct kfifo in place
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 <stefani@seibold.net>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Acked-by: Andi Kleen <ak@linux.intel.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-12-22 14:17:55 -08:00
..
ath Merge branch 'master' of /home/davem/src/GIT/linux-2.6/ 2009-12-11 17:12:17 -08:00
b43 Merge branch 'master' of /home/davem/src/GIT/linux-2.6/ 2009-12-11 17:12:17 -08:00
b43legacy Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2009-12-09 19:43:33 -08:00
hostap Merge branch 'master' of /home/davem/src/GIT/linux-2.6/ 2009-12-05 15:22:26 -08:00
ipw2x00 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2009-12-09 19:43:33 -08:00
iwlwifi net: fix for utsrelease.h moving to generated 2009-12-12 13:12:04 +01:00
iwmc3200wifi Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2009-12-09 19:43:33 -08:00
libertas kfifo: move struct kfifo in place 2009-12-22 14:17:55 -08:00
libertas_tf libertas_tf_usb: declare MODULE_FIRMWARE 2009-11-11 15:23:53 -05:00
orinoco Merge branch 'master' of /home/davem/src/GIT/linux-2.6/ 2009-12-11 17:12:17 -08:00
p54 cfg80211: convert bools into flags 2009-11-19 11:08:50 -05:00
prism54 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2009-12-09 19:43:33 -08:00
rt2x00 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2009-12-09 19:43:33 -08:00
rtl818x rtl8187: add radio led and fix warnings on suspend 2009-12-10 16:09:51 -05:00
wl12xx wl1251: don't build null data template in wl1251_op_config() 2009-12-07 16:50:13 -05:00
zd1211rw Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2009-12-09 19:43:33 -08:00
adm8211.c drivers/net/adm8211.c: remove exceptional & on function name 2009-11-18 10:48:52 -08:00
adm8211.h
airo_cs.c pcmcia: rework the irq_req_t typedef 2009-11-28 18:03:14 +01:00
airo.c airo: Fix integer overflow warning 2009-12-04 13:30:40 -05:00
airo.h
at76c50x-usb.c at76c50x-usb: Supply additional parameters to at76_start_monitor scan request 2009-11-11 17:09:17 -05:00
at76c50x-usb.h
atmel_cs.c pcmcia: rework the irq_req_t typedef 2009-11-28 18:03:14 +01:00
atmel_pci.c
atmel.c atmel: declare MODULE_FIRMWARE 2009-11-11 15:23:49 -05:00
atmel.h
Kconfig
mac80211_hwsim.c cfg80211: convert bools into flags 2009-11-19 11:08:50 -05:00
Makefile
mwl8k.c mwl8k: don't complain about oversized beacons in FINALIZE_JOIN 2009-12-07 16:51:23 -05:00
ray_cs.c Merge branch 'master' of /home/davem/src/GIT/linux-2.6/ 2009-12-05 15:22:26 -08:00
ray_cs.h
rayctl.h
rndis_wlan.c rndis_wlan: disable stall workaround 2009-11-23 17:05:40 -05:00
wl3501_cs.c Merge branch 'master' of /home/davem/src/GIT/linux-2.6/ 2009-12-05 15:22:26 -08:00
wl3501.h
zd1201.c zd1201: declare MODULE_FIRMWARE 2009-11-11 15:23:54 -05:00
zd1201.h