Commit 26eca10e authored by Michal Nazarewicz's avatar Michal Nazarewicz Committed by Greg Kroah-Hartman

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: default avatarMichal Nazarewicz <m.nazarewicz@samsung.com>
Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 3b759c75
...@@ -143,7 +143,9 @@ static int msg_thread_exits(struct fsg_common *common) ...@@ -143,7 +143,9 @@ static int msg_thread_exits(struct fsg_common *common)
static int __init msg_do_config(struct usb_configuration *c) static int __init msg_do_config(struct usb_configuration *c)
{ {
struct fsg_common *common; static struct fsg_common common;
struct fsg_common *retp;
struct fsg_config config; struct fsg_config config;
int ret; int ret;
...@@ -154,12 +156,13 @@ static int __init msg_do_config(struct usb_configuration *c) ...@@ -154,12 +156,13 @@ static int __init msg_do_config(struct usb_configuration *c)
fsg_config_from_params(&config, &mod_data); fsg_config_from_params(&config, &mod_data);
config.thread_exits = msg_thread_exits; config.thread_exits = msg_thread_exits;
common = fsg_common_init(0, c->cdev, &config);
if (IS_ERR(common))
return PTR_ERR(common);
ret = fsg_add(c->cdev, c, common); retp = fsg_common_init(&common, c->cdev, &config);
fsg_common_put(common); if (IS_ERR(retp))
return PTR_ERR(retp);
ret = fsg_add(c->cdev, c, &common);
fsg_common_put(&common);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment