From: Andrzej Pietrasiewicz Date: Tue, 14 Jan 2014 13:27:18 +0000 (+0100) Subject: Revert "usb/gadget: f_mass_storage: use fsg_common_setup in fsg_common_init" X-Git-Tag: submit/tizen/20141121.110247~2777 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2de5911e14f35f587af319d0fee85c883f2ca454;p=platform%2Fkernel%2Flinux-3.10.git Revert "usb/gadget: f_mass_storage: use fsg_common_setup in fsg_common_init" This reverts commit 6da409d4af402599d135f22d4f0273c42aee5d9c. --- diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c index 2f6e3c3..ef4733c 100644 --- a/drivers/usb/gadget/f_mass_storage.c +++ b/drivers/usb/gadget/f_mass_storage.c @@ -3018,9 +3018,16 @@ struct fsg_common *fsg_common_init(struct fsg_common *common, return ERR_PTR(-EINVAL); } - common = fsg_common_setup(common, !!common); - if (IS_ERR(common)) - return common; + /* Allocate? */ + if (!common) { + common = kzalloc(sizeof *common, GFP_KERNEL); + if (!common) + return ERR_PTR(-ENOMEM); + common->free_storage_on_release = 1; + } else { + memset(common, 0, sizeof *common); + common->free_storage_on_release = 0; + } common->sysfs = true; common->state = FSG_STATE_IDLE; @@ -3060,6 +3067,8 @@ struct fsg_common *fsg_common_init(struct fsg_common *common, } common->luns = curlun_it; + init_rwsem(&common->filesem); + for (i = 0, lcfg = cfg->luns; i < nluns; ++i, ++curlun_it, ++lcfg) { struct fsg_lun *curlun; @@ -3159,6 +3168,8 @@ buffhds_first_it: common->can_stall = cfg->can_stall && !(gadget_is_at91(common->gadget)); + spin_lock_init(&common->lock); + kref_init(&common->ref); /* Tell the thread to start working */ common->thread_task = @@ -3167,6 +3178,8 @@ buffhds_first_it: rc = PTR_ERR(common->thread_task); goto error_release; } + init_completion(&common->thread_notifier); + init_waitqueue_head(&common->fsg_wait); /* Information */ INFO(common, FSG_DRIVER_DESC ", version: " FSG_DRIVER_VERSION "\n");