Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 144044
b: refs/heads/master
c: 82a10a8
h: refs/heads/master
v: v3
  • Loading branch information
Alan Stern authored and Greg Kroah-Hartman committed Apr 23, 2009
1 parent 879263e commit 66a6928
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 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: c065c60e83c006611caed23d1320450fcd709398
refs/heads/master: 82a10a81c853be3859b3d222db0f372ee8d2eaa2
20 changes: 4 additions & 16 deletions trunk/drivers/usb/gadget/file_storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,6 @@ static struct fsg_dev *the_fsg;
static struct usb_gadget_driver fsg_driver;

static void close_backing_file(struct lun *curlun);
static void close_all_backing_files(struct fsg_dev *fsg);


/*-------------------------------------------------------------------------*/
Expand Down Expand Up @@ -3593,12 +3592,10 @@ static int fsg_main_thread(void *fsg_)
fsg->thread_task = NULL;
spin_unlock_irq(&fsg->lock);

/* In case we are exiting because of a signal, unregister the
* gadget driver and close the backing file. */
if (test_and_clear_bit(REGISTERED, &fsg->atomic_bitflags)) {
/* If we are exiting because of a signal, unregister the
* gadget driver. */
if (test_and_clear_bit(REGISTERED, &fsg->atomic_bitflags))
usb_gadget_unregister_driver(&fsg_driver);
close_all_backing_files(fsg);
}

/* Let the unbind and cleanup routines know the thread has exited */
complete_and_exit(&fsg->thread_notifier, 0);
Expand Down Expand Up @@ -3703,14 +3700,6 @@ static void close_backing_file(struct lun *curlun)
}
}

static void close_all_backing_files(struct fsg_dev *fsg)
{
int i;

for (i = 0; i < fsg->nluns; ++i)
close_backing_file(&fsg->luns[i]);
}


static ssize_t show_ro(struct device *dev, struct device_attribute *attr, char *buf)
{
Expand Down Expand Up @@ -3845,6 +3834,7 @@ static void /* __init_or_exit */ fsg_unbind(struct usb_gadget *gadget)
if (curlun->registered) {
device_remove_file(&curlun->dev, &dev_attr_ro);
device_remove_file(&curlun->dev, &dev_attr_file);
close_backing_file(curlun);
device_unregister(&curlun->dev);
curlun->registered = 0;
}
Expand Down Expand Up @@ -4190,7 +4180,6 @@ static int __init fsg_bind(struct usb_gadget *gadget)
out:
fsg->state = FSG_STATE_TERMINATED; // The thread is dead
fsg_unbind(gadget);
close_all_backing_files(fsg);
complete(&fsg->thread_notifier);
return rc;
}
Expand Down Expand Up @@ -4284,7 +4273,6 @@ static void __exit fsg_cleanup(void)
/* Wait for the thread to finish up */
wait_for_completion(&fsg->thread_notifier);

close_all_backing_files(fsg);
kref_put(&fsg->ref, fsg_release);
}
module_exit(fsg_cleanup);

0 comments on commit 66a6928

Please sign in to comment.