lkml.org 
[lkml]   [2010]   [May]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH] USB: gadget: g_mass_storage: static data instead of dynamic allocation
    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


    \
     
     \ /
      Last update: 2010-05-17 11:51    [W:7.655 / U:0.032 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site