All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: gadget: g_mass_storage: static data instead of dynamic allocation
@ 2010-05-13 17:50 Michal Nazarewicz
  2010-05-14 19:11 ` Greg KH
  2010-05-17  9:48 ` [PATCH] USB: " Michal Nazarewicz
  0 siblings, 2 replies; 3+ messages in thread
From: Michal Nazarewicz @ 2010-05-13 17:50 UTC (permalink / raw)
  To: linux-usb; +Cc: Kyungmin Park, Marek Szyprowski, linux-kernel

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>
---
 drivers/usb/gadget/mass_storage.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/gadget/mass_storage.c b/drivers/usb/gadget/mass_storage.c
index d574bad..d85ca27 100644
--- a/drivers/usb/gadget/mass_storage.c
+++ b/drivers/usb/gadget/mass_storage.c
@@ -143,7 +143,7 @@ static int msg_thread_exits(struct fsg_common *common)
 
 static int __init msg_do_config(struct usb_configuration *c)
 {
-	struct fsg_common *common;
+	static struct fsg_common common, *retp;
 	struct fsg_config config;
 	int ret;
 
@@ -156,12 +156,13 @@ static int __init msg_do_config(struct usb_configuration *c)
 	config.ops = &(const struct fsg_operations){
 		.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);
-	fsg_common_put(common);
+	retp = fsg_common_init(&common, c->cdev, &config);
+	if (IS_ERR(retp))
+		return PTR_ERR(retp);
+
+	ret = fsg_add(c->cdev, c, &common);
+	fsg_common_put(&common);
 	return ret;
 }
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] usb: gadget: g_mass_storage: static data instead of dynamic allocation
  2010-05-13 17:50 [PATCH] usb: gadget: g_mass_storage: static data instead of dynamic allocation Michal Nazarewicz
@ 2010-05-14 19:11 ` Greg KH
  2010-05-17  9:48 ` [PATCH] USB: " Michal Nazarewicz
  1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2010-05-14 19:11 UTC (permalink / raw)
  To: Michal Nazarewicz
  Cc: linux-usb, Kyungmin Park, Marek Szyprowski, linux-kernel

On Thu, May 13, 2010 at 07:50:32PM +0200, Michal Nazarewicz wrote:
> 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>
> ---
>  drivers/usb/gadget/mass_storage.c |   13 +++++++------

This patch doesn't apply.  Care to redo it against the linux-next tree?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] USB: gadget: g_mass_storage: static data instead of dynamic allocation
  2010-05-13 17:50 [PATCH] usb: gadget: g_mass_storage: static data instead of dynamic allocation Michal Nazarewicz
  2010-05-14 19:11 ` Greg KH
@ 2010-05-17  9:48 ` Michal Nazarewicz
  1 sibling, 0 replies; 3+ messages in thread
From: Michal Nazarewicz @ 2010-05-17  9:48 UTC (permalink / raw)
  To: Greg KH, linux-usb; +Cc: Kyungmin Park, Marek Szyprowski, Linux Kernel

From: Michal Nazarewicz <mina86@mina86.com>

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 <mina86@mina86.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
---
Greg KH wrote:
> This patch doesn't apply.  Care to redo it against the linux-next tree?

Hope this works.

 drivers/usb/gadget/mass_storage.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/gadget/mass_storage.c b/drivers/usb/gadget/mass_storage.c
index 705cc1f..a3349f2 100644
--- a/drivers/usb/gadget/mass_storage.c
+++ b/drivers/usb/gadget/mass_storage.c
@@ -143,7 +143,7 @@ static int msg_thread_exits(struct fsg_common *common)
 
 static int __init msg_do_config(struct usb_configuration *c)
 {
-	struct fsg_common *common;
+	static struct fsg_common common, *retp;
 	struct fsg_config config;
 	int ret;
 
@@ -154,12 +154,13 @@ static int __init msg_do_config(struct usb_configuration *c)
 
 	fsg_config_from_params(&config, &mod_data);
 	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);
-	fsg_common_put(common);
+	retp = fsg_common_init(&common, c->cdev, &config);
+	if (IS_ERR(retp))
+		return PTR_ERR(retp);
+
+	ret = fsg_add(c->cdev, c, &common);
+	fsg_common_put(&common);
 	return ret;
 }
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-05-17  9:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-13 17:50 [PATCH] usb: gadget: g_mass_storage: static data instead of dynamic allocation Michal Nazarewicz
2010-05-14 19:11 ` Greg KH
2010-05-17  9:48 ` [PATCH] USB: " Michal Nazarewicz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.