diff options
author | Michal Nazarewicz <m.nazarewicz@samsung.com> | 2009-10-28 11:57:21 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-12-11 14:55:19 -0500 |
commit | 606206c271722d613b99c737ce150f58f4485f41 (patch) | |
tree | a3db1e8291005b1bd76e260296d9fe815d232420 /drivers/usb/gadget/storage_common.c | |
parent | a41ae4180e5403a68469420806c318e1a0c32248 (diff) |
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 @@ | |||
47 | * When FSG_NO_OTG is defined fsg_otg_desc won't be defined. | 47 | * When FSG_NO_OTG is defined fsg_otg_desc won't be defined. |
48 | */ | 48 | */ |
49 | 49 | ||
50 | /* | ||
51 | * When FSG_BUFFHD_STATIC_BUFFER is defined when this file is included | ||
52 | * the fsg_buffhd structure's buf field will be an array of FSG_BUFLEN | ||
53 | * characters rather then a pointer to void. | ||
54 | */ | ||
55 | |||
50 | 56 | ||
51 | #include <asm/unaligned.h> | 57 | #include <asm/unaligned.h> |
52 | 58 | ||
@@ -290,7 +296,11 @@ enum fsg_buffer_state { | |||
290 | }; | 296 | }; |
291 | 297 | ||
292 | struct fsg_buffhd { | 298 | struct fsg_buffhd { |
299 | #ifdef FSG_BUFFHD_STATIC_BUFFER | ||
300 | char buf[FSG_BUFLEN]; | ||
301 | #else | ||
293 | void *buf; | 302 | void *buf; |
303 | #endif | ||
294 | enum fsg_buffer_state state; | 304 | enum fsg_buffer_state state; |
295 | struct fsg_buffhd *next; | 305 | struct fsg_buffhd *next; |
296 | 306 | ||