X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=drivers%2Fusb%2Fgadget%2Ff_fs.c;h=e4f59505520889e86ecd7d131e9ba283cdbf3dc9;hb=fd7c9a007f7d45df86974c3f83d67ab21cc21f1f;hp=2aaa0f75c6cf79936f5f1e03bc1c002e42f5e59a;hpb=f7ddc2b6cd880a259db338925d03bdc01f1d26c1;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c index 2aaa0f7..e4f5950 100644 --- a/drivers/usb/gadget/f_fs.c +++ b/drivers/usb/gadget/f_fs.c @@ -714,9 +714,7 @@ static long ffs_ep0_ioctl(struct file *file, unsigned code, unsigned long value) struct ffs_function *func = ffs->func; ret = func ? ffs_func_revmap_intf(func, value) : -ENODEV; } else if (gadget->ops->ioctl) { - lock_kernel(); ret = gadget->ops->ioctl(gadget, code, value); - unlock_kernel(); } else { ret = -ENOTTY; } @@ -1377,7 +1375,8 @@ static void ffs_data_reset(struct ffs_data *ffs) static int functionfs_bind(struct ffs_data *ffs, struct usb_composite_dev *cdev) { - unsigned i, count; + struct usb_gadget_strings **lang; + int first_id; ENTER(); @@ -1385,7 +1384,9 @@ static int functionfs_bind(struct ffs_data *ffs, struct usb_composite_dev *cdev) || test_and_set_bit(FFS_FL_BOUND, &ffs->flags))) return -EBADFD; - ffs_data_get(ffs); + first_id = usb_string_ids_n(cdev, ffs->strings_count); + if (unlikely(first_id < 0)) + return first_id; ffs->ep0req = usb_ep_alloc_request(cdev->gadget->ep0, GFP_KERNEL); if (unlikely(!ffs->ep0req)) @@ -1393,25 +1394,16 @@ static int functionfs_bind(struct ffs_data *ffs, struct usb_composite_dev *cdev) ffs->ep0req->complete = ffs_ep0_complete; ffs->ep0req->context = ffs; - /* Get strings identifiers */ - for (count = ffs->strings_count, i = 0; i < count; ++i) { - struct usb_gadget_strings **lang; - - int id = usb_string_id(cdev); - if (unlikely(id < 0)) { - usb_ep_free_request(cdev->gadget->ep0, ffs->ep0req); - ffs->ep0req = NULL; - return id; - } - - lang = ffs->stringtabs; - do { - (*lang)->strings[i].id = id; - ++lang; - } while (*lang); + lang = ffs->stringtabs; + for (lang = ffs->stringtabs; *lang; ++lang) { + struct usb_string *str = (*lang)->strings; + int id = first_id; + for (; str->s; ++id, ++str) + str->id = id; } ffs->gadget = cdev->gadget; + ffs_data_get(ffs); return 0; } @@ -1480,9 +1472,9 @@ static void ffs_epfiles_destroy(struct ffs_epfile *epfiles, unsigned count) } -static int functionfs_add(struct usb_composite_dev *cdev, - struct usb_configuration *c, - struct ffs_data *ffs) +static int functionfs_bind_config(struct usb_composite_dev *cdev, + struct usb_configuration *c, + struct ffs_data *ffs) { struct ffs_function *func; int ret;