mdm6600: Enable the wake irq when ttyUSB4 is suspended
authorBenoit Goby <benoit@android.com>
Sat, 20 Nov 2010 02:10:58 +0000 (18:10 -0800)
committerBenoit Goby <benoit@android.com>
Sat, 20 Nov 2010 02:24:38 +0000 (18:24 -0800)
Instead of enabling it when the first opened port is suspended. It is
working because the modem only triggers this interrupt when all ttys are
suspended and the bus is suspended.

This fixes an issue when mdm6600_suspended_ports is not reset to 0 after
a disconnect/attach and the irq is never enabled.

Change-Id: I2a1a020ccd510b8c57c9f0b56988cb6de8aaff15
Signed-off-by: Benoit Goby <benoit@android.com>
drivers/usb/serial/mdm6600.c

index 43f5b3cc607f3666c5ca3cfe1cee4850882f728b..cf791c3f0116f795c65981b5a17d927cb09fa57b 100644 (file)
@@ -106,7 +106,6 @@ static int mdm6600_wake_irq;
  * changed if other ttyUSB have been registered before.
  */
 static int mdm6600_attached_ports;
-static int mdm6600_suspended_ports;
 
 static void mdm6600_read_bulk_work(struct work_struct *work);
 static void mdm6600_read_bulk_cb(struct urb *urb);
@@ -801,11 +800,12 @@ static int mdm6600_suspend(struct usb_interface *intf, pm_message_t message)
 
        spin_lock_irq(&modem->susp_lock);
 
-       if (!modem->susp_count++ && modem->opened) {
-               if (!mdm6600_suspended_ports++)
-                       enable_irq(mdm6600_wake_irq);
+       if (modem->number == MODEM_INTERFACE_NUM)
+               enable_irq(mdm6600_wake_irq);
 
+       if (!modem->susp_count++ && modem->opened) {
                spin_unlock_irq(&modem->susp_lock);
+
                dbg("%s: kill urbs", __func__);
                mdm6600_kill_urbs(modem);
                return 0;
@@ -826,10 +826,10 @@ static int mdm6600_resume(struct usb_interface *intf)
 
        spin_lock_irq(&modem->susp_lock);
 
-       if (!--modem->susp_count && modem->opened) {
-               if (!--mdm6600_suspended_ports)
-                       disable_irq(mdm6600_wake_irq);
+       if (modem->number == MODEM_INTERFACE_NUM)
+               disable_irq(mdm6600_wake_irq);
 
+       if (!--modem->susp_count && modem->opened) {
                dbg("%s: submit urbs", __func__);
                spin_unlock_irq(&modem->susp_lock);