Greg:

I'm not sure if you got this patch through David Brownell or not, so just
in case you didn't...  It replaces a call to device_unregister_wait() in
the File-backed Storage Gadget.  Please apply.

Alan Stern


===== file_storage.c 1.1 vs edited =====
--- 1.1/drivers/usb/gadget/file_storage.c       Wed Jan 21 07:56:53 2004
+++ edited/drivers/usb/gadget/file_storage.c    Tue Jan 27 15:32:13 2004
@@ -1,7 +1,7 @@
 /*
  * file_storage.c -- File-backed USB Storage Gadget, for USB development
  *
- * Copyright (C) 2003 Alan Stern
+ * Copyright (C) 2003, 2004 Alan Stern
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -244,7 +244,7 @@
 
 #define DRIVER_DESC            "File-backed Storage Gadget"
 #define DRIVER_NAME            "g_file_storage"
-#define DRIVER_VERSION         "14 January 2004"
+#define DRIVER_VERSION         "26 January 2004"
 
 static const char longname[] = DRIVER_DESC;
 static const char shortname[] = DRIVER_NAME;
@@ -848,6 +848,7 @@
        unsigned int            nluns;
        struct lun              *luns;
        struct lun              *curlun;
+       struct completion       lun_released;
 };
 
 typedef void (*fsg_routine_t)(struct fsg_dev *);
@@ -3771,6 +3772,13 @@
 
 /*-------------------------------------------------------------------------*/
 
+static void lun_release(struct device *dev)
+{
+       struct fsg_dev  *fsg = (struct fsg_dev *) dev_get_drvdata(dev);
+
+       complete(&fsg->lun_released);
+}
+
 static void fsg_unbind(struct usb_gadget *gadget)
 {
        struct fsg_dev          *fsg = get_gadget_data(gadget);
@@ -3782,12 +3790,14 @@
        clear_bit(REGISTERED, &fsg->atomic_bitflags);
 
        /* Unregister the sysfs attribute files and the LUNs */
+       init_completion(&fsg->lun_released);
        for (i = 0; i < fsg->nluns; ++i) {
                curlun = &fsg->luns[i];
                if (curlun->registered) {
                        device_remove_file(&curlun->dev, &dev_attr_ro);
                        device_remove_file(&curlun->dev, &dev_attr_file);
-                       device_unregister_wait(&curlun->dev);
+                       device_unregister(&curlun->dev);
+                       wait_for_completion(&fsg->lun_released);
                        curlun->registered = 0;
                }
        }
@@ -4140,6 +4150,7 @@
                        INFO(fsg, "failed to register LUN%d: %d\n", i, rc);
                else {
                        curlun->registered = 1;
+                       curlun->dev.release = lun_release;
                        device_create_file(&curlun->dev, &dev_attr_ro);
                        device_create_file(&curlun->dev, &dev_attr_file);
                }



-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to