From 66a69289b3275e781b16fe2281159c409a0e632e Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Thu, 16 Apr 2009 15:37:28 -0400 Subject: [PATCH] --- yaml --- r: 144044 b: refs/heads/master c: 82a10a81c853be3859b3d222db0f372ee8d2eaa2 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/usb/gadget/file_storage.c | 20 ++++---------------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/[refs] b/[refs] index 00ab610b4185..1862c12a9a1c 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: c065c60e83c006611caed23d1320450fcd709398 +refs/heads/master: 82a10a81c853be3859b3d222db0f372ee8d2eaa2 diff --git a/trunk/drivers/usb/gadget/file_storage.c b/trunk/drivers/usb/gadget/file_storage.c index 5c030b080d4c..381a53b3e11c 100644 --- a/trunk/drivers/usb/gadget/file_storage.c +++ b/trunk/drivers/usb/gadget/file_storage.c @@ -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); /*-------------------------------------------------------------------------*/ @@ -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); @@ -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) { @@ -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; } @@ -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; } @@ -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);