diff options
author | Michal Nazarewicz <m.nazarewicz@samsung.com> | 2010-06-16 06:07:56 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-08-10 17:35:36 -0400 |
commit | 26eca10e6ef64e15f250523a1e7e94ad40ac2bf8 (patch) | |
tree | 516237887aaaa58604b02cc6db7bc43967935858 | |
parent | 3b759c75febd8f9ce91a05705ec43eb7f4b5ed3d (diff) |
USB: gadget: g_mass_storage: static data instead of dynamic allocation
This patch changes msg_do_config() function so that it uses
a static object for a fsg_common structure instead of dynamically
allocated. This is a micro-optimisation.
Signed-off-by: Michal Nazarewicz <m.nazarewicz@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/usb/gadget/mass_storage.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/usb/gadget/mass_storage.c b/drivers/usb/gadget/mass_storage.c index 705cc1f76327..e68c00e08765 100644 --- a/drivers/usb/gadget/mass_storage.c +++ b/drivers/usb/gadget/mass_storage.c | |||
@@ -143,7 +143,9 @@ static int msg_thread_exits(struct fsg_common *common) | |||
143 | 143 | ||
144 | static int __init msg_do_config(struct usb_configuration *c) | 144 | static int __init msg_do_config(struct usb_configuration *c) |
145 | { | 145 | { |
146 | struct fsg_common *common; | 146 | static struct fsg_common common; |
147 | |||
148 | struct fsg_common *retp; | ||
147 | struct fsg_config config; | 149 | struct fsg_config config; |
148 | int ret; | 150 | int ret; |
149 | 151 | ||
@@ -154,12 +156,13 @@ static int __init msg_do_config(struct usb_configuration *c) | |||
154 | 156 | ||
155 | fsg_config_from_params(&config, &mod_data); | 157 | fsg_config_from_params(&config, &mod_data); |
156 | config.thread_exits = msg_thread_exits; | 158 | config.thread_exits = msg_thread_exits; |
157 | common = fsg_common_init(0, c->cdev, &config); | ||
158 | if (IS_ERR(common)) | ||
159 | return PTR_ERR(common); | ||
160 | 159 | ||
161 | ret = fsg_add(c->cdev, c, common); | 160 | retp = fsg_common_init(&common, c->cdev, &config); |
162 | fsg_common_put(common); | 161 | if (IS_ERR(retp)) |
162 | return PTR_ERR(retp); | ||
163 | |||
164 | ret = fsg_add(c->cdev, c, &common); | ||
165 | fsg_common_put(&common); | ||
163 | return ret; | 166 | return ret; |
164 | } | 167 | } |
165 | 168 | ||