aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/usb-serial.c
diff options
context:
space:
mode:
authorJohan Hovold <jhovold@gmail.com>2012-04-25 09:56:32 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-04-25 14:37:19 -0400
commitbdce6612a0562e64acec92bbf6dce567609f5867 (patch)
tree18f59af1558fc0dde243445246803658493df152 /drivers/usb/serial/usb-serial.c
parent6f1efd6c5aa63ddcfe1ffc60ade716f5421766f4 (diff)
USB: serial: fix interface data use
The interface data should not be used as a flag to signal disconnect. Now that all serial drivers use the usb_serial disconnect flag and mutex, we can set the interface data prior to registering the ports and there's no need to clear it at disconnect. This should hopefully also make it more clear that the interface data is not a flag, which could prevent future misuse. Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/serial/usb-serial.c')
-rw-r--r--drivers/usb/serial/usb-serial.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 97355a15bbea..906f06e97fde 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -1043,6 +1043,8 @@ int usb_serial_probe(struct usb_interface *interface,
1043 dbg("the device claims to support interrupt out transfers, but write_int_callback is not defined"); 1043 dbg("the device claims to support interrupt out transfers, but write_int_callback is not defined");
1044 } 1044 }
1045 1045
1046 usb_set_intfdata(interface, serial);
1047
1046 /* if this device type has an attach function, call it */ 1048 /* if this device type has an attach function, call it */
1047 if (type->attach) { 1049 if (type->attach) {
1048 retval = type->attach(serial); 1050 retval = type->attach(serial);
@@ -1087,10 +1089,7 @@ int usb_serial_probe(struct usb_interface *interface,
1087 serial->disconnected = 0; 1089 serial->disconnected = 0;
1088 1090
1089 usb_serial_console_init(debug, minor); 1091 usb_serial_console_init(debug, minor);
1090
1091exit: 1092exit:
1092 /* success */
1093 usb_set_intfdata(interface, serial);
1094 module_put(type->driver.owner); 1093 module_put(type->driver.owner);
1095 return 0; 1094 return 0;
1096 1095
@@ -1112,7 +1111,6 @@ void usb_serial_disconnect(struct usb_interface *interface)
1112 dbg("%s", __func__); 1111 dbg("%s", __func__);
1113 1112
1114 mutex_lock(&serial->disc_mutex); 1113 mutex_lock(&serial->disc_mutex);
1115 usb_set_intfdata(interface, NULL);
1116 /* must set a flag, to signal subdrivers */ 1114 /* must set a flag, to signal subdrivers */
1117 serial->disconnected = 1; 1115 serial->disconnected = 1;
1118 mutex_unlock(&serial->disc_mutex); 1116 mutex_unlock(&serial->disc_mutex);