diff options
author | Michal Nazarewicz <m.nazarewicz@samsung.com> | 2009-10-28 16:57:21 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-12-11 11:55:19 -0800 |
commit | 606206c271722d613b99c737ce150f58f4485f41 (patch) | |
tree | a3db1e8291005b1bd76e260296d9fe815d232420 /drivers/usb/gadget/storage_common.c | |
parent | a41ae4180e5403a68469420806c318e1a0c32248 (diff) | |
download | lwn-606206c271722d613b99c737ce150f58f4485f41.tar.gz lwn-606206c271722d613b99c737ce150f58f4485f41.zip |
USB: g_mass_storage: constant length buffers used
Using version of fsg_buffhd structure with buf field being an
array of characters with predefined size. Since mass storage
function does not define changing buffer size on run-time it is
not required for the field to be a pointer to void and allocating
space dynamically.
Signed-off-by: Michal Nazarewicz <m.nazarewicz@samsung.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/gadget/storage_common.c')
-rw-r--r-- | drivers/usb/gadget/storage_common.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/usb/gadget/storage_common.c b/drivers/usb/gadget/storage_common.c index e76c8ced41e2..60bc696778c9 100644 --- a/drivers/usb/gadget/storage_common.c +++ b/drivers/usb/gadget/storage_common.c @@ -47,6 +47,12 @@ * When FSG_NO_OTG is defined fsg_otg_desc won't be defined. */ +/* + * When FSG_BUFFHD_STATIC_BUFFER is defined when this file is included + * the fsg_buffhd structure's buf field will be an array of FSG_BUFLEN + * characters rather then a pointer to void. + */ + #include <asm/unaligned.h> @@ -290,7 +296,11 @@ enum fsg_buffer_state { }; struct fsg_buffhd { +#ifdef FSG_BUFFHD_STATIC_BUFFER + char buf[FSG_BUFLEN]; +#else void *buf; +#endif enum fsg_buffer_state state; struct fsg_buffhd *next; |