ChangeSet 1.2171, 2004/11/19 09:38:31-08:00, [EMAIL PROTECTED]

[PATCH] USB Storage: fixes to usb-storage scanning thread

This was originally patch as401 from Alan Stern.  This patch makes a couple
of small changes to the new scanning thread.

It changes the name to "usb-stor-scan", which was my original intention and
makes more sense than the current name.

It also removes the PF_NOFREEZE flag; if someone suspends their system
immediately after plugging in a USB storage device then the scanning thread
should be frozen along with everything else.  The delay will be restarted
after the system wakes up.


Signed-off-by: Alan Stern <[EMAIL PROTECTED]>
Signed-off-by: Matthew Dharm <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>


 drivers/usb/storage/usb.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)


diff -Nru a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
--- a/drivers/usb/storage/usb.c 2004-11-19 11:42:38 -08:00
+++ b/drivers/usb/storage/usb.c 2004-11-19 11:42:38 -08:00
@@ -50,6 +50,7 @@
 #include <linux/config.h>
 #include <linux/sched.h>
 #include <linux/errno.h>
+#include <linux/suspend.h>
 
 #include <scsi/scsi.h>
 #include <scsi/scsi_cmnd.h>
@@ -897,8 +898,7 @@
         * so get rid of all our resources.
         */
        lock_kernel();
-       daemonize("usb-stor");
-       current->flags |= PF_NOFREEZE;
+       daemonize("usb-stor-scan");
        unlock_kernel();
 
        printk(KERN_DEBUG
@@ -908,9 +908,14 @@
        if (delay_use > 0) {
                printk(KERN_DEBUG "usb-storage: waiting for device "
                                "to settle before scanning\n");
+retry:
                wait_event_interruptible_timeout(us->scsi_scan_wait,
                                test_bit(US_FLIDX_DISCONNECTING, &us->flags),
                                delay_use * HZ);
+               if (current->flags & PF_FREEZE) {
+                       refrigerator(PF_FREEZE);
+                       goto retry;
+               }
        }
 
        /* If the device is still connected, perform the scanning */



-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to