Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 207980
b: refs/heads/master
c: fd7c9a0
h: refs/heads/master
v: v3
  • Loading branch information
Michal Nazarewicz authored and Greg Kroah-Hartman committed Aug 10, 2010
1 parent 6dfe392 commit 443eed2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 19 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f2adc4f8aaf272de9ac71dcb18d95ebe05fc3f94
refs/heads/master: fd7c9a007f7d45df86974c3f83d67ab21cc21f1f
30 changes: 12 additions & 18 deletions trunk/drivers/usb/gadget/f_fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1375,41 +1375,35 @@ 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();

if (WARN_ON(ffs->state != FFS_ACTIVE
|| 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))
return -ENOMEM;
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;
}

Expand Down

0 comments on commit 443eed2

Please sign in to comment.