diff options
Diffstat (limited to 'drivers/usb/serial/usb-serial.c')
-rw-r--r-- | drivers/usb/serial/usb-serial.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 6bf22a28adb8..8511352251f3 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -99,9 +99,12 @@ static struct usb_serial *get_free_serial (struct usb_serial *serial, int num_po | |||
99 | continue; | 99 | continue; |
100 | 100 | ||
101 | *minor = i; | 101 | *minor = i; |
102 | j = 0; | ||
102 | dbg("%s - minor base = %d", __FUNCTION__, *minor); | 103 | dbg("%s - minor base = %d", __FUNCTION__, *minor); |
103 | for (i = *minor; (i < (*minor + num_ports)) && (i < SERIAL_TTY_MINORS); ++i) | 104 | for (i = *minor; (i < (*minor + num_ports)) && (i < SERIAL_TTY_MINORS); ++i) { |
104 | serial_table[i] = serial; | 105 | serial_table[i] = serial; |
106 | serial->port[j++]->number = i; | ||
107 | } | ||
105 | spin_unlock(&table_lock); | 108 | spin_unlock(&table_lock); |
106 | return serial; | 109 | return serial; |
107 | } | 110 | } |
@@ -135,11 +138,6 @@ static void destroy_serial(struct kref *kref) | |||
135 | 138 | ||
136 | dbg("%s - %s", __FUNCTION__, serial->type->description); | 139 | dbg("%s - %s", __FUNCTION__, serial->type->description); |
137 | 140 | ||
138 | serial->type->shutdown(serial); | ||
139 | |||
140 | /* return the minor range that this device had */ | ||
141 | return_serial(serial); | ||
142 | |||
143 | for (i = 0; i < serial->num_ports; ++i) | 141 | for (i = 0; i < serial->num_ports; ++i) |
144 | serial->port[i]->open_count = 0; | 142 | serial->port[i]->open_count = 0; |
145 | 143 | ||
@@ -150,6 +148,12 @@ static void destroy_serial(struct kref *kref) | |||
150 | serial->port[i] = NULL; | 148 | serial->port[i] = NULL; |
151 | } | 149 | } |
152 | 150 | ||
151 | if (serial->type->shutdown) | ||
152 | serial->type->shutdown(serial); | ||
153 | |||
154 | /* return the minor range that this device had */ | ||
155 | return_serial(serial); | ||
156 | |||
153 | /* If this is a "fake" port, we have to clean it up here, as it will | 157 | /* If this is a "fake" port, we have to clean it up here, as it will |
154 | * not get cleaned up in port_release() as it was never registered with | 158 | * not get cleaned up in port_release() as it was never registered with |
155 | * the driver core */ | 159 | * the driver core */ |
@@ -826,7 +830,6 @@ int usb_serial_probe(struct usb_interface *interface, | |||
826 | num_ports = type->num_ports; | 830 | num_ports = type->num_ports; |
827 | } | 831 | } |
828 | 832 | ||
829 | serial->minor = minor; | ||
830 | serial->num_ports = num_ports; | 833 | serial->num_ports = num_ports; |
831 | serial->num_bulk_in = num_bulk_in; | 834 | serial->num_bulk_in = num_bulk_in; |
832 | serial->num_bulk_out = num_bulk_out; | 835 | serial->num_bulk_out = num_bulk_out; |
@@ -847,7 +850,6 @@ int usb_serial_probe(struct usb_interface *interface, | |||
847 | port = kzalloc(sizeof(struct usb_serial_port), GFP_KERNEL); | 850 | port = kzalloc(sizeof(struct usb_serial_port), GFP_KERNEL); |
848 | if (!port) | 851 | if (!port) |
849 | goto probe_error; | 852 | goto probe_error; |
850 | port->number = i + serial->minor; | ||
851 | port->serial = serial; | 853 | port->serial = serial; |
852 | spin_lock_init(&port->lock); | 854 | spin_lock_init(&port->lock); |
853 | mutex_init(&port->mutex); | 855 | mutex_init(&port->mutex); |
@@ -980,6 +982,7 @@ int usb_serial_probe(struct usb_interface *interface, | |||
980 | dev_err(&interface->dev, "No more free serial devices\n"); | 982 | dev_err(&interface->dev, "No more free serial devices\n"); |
981 | goto probe_error; | 983 | goto probe_error; |
982 | } | 984 | } |
985 | serial->minor = minor; | ||
983 | 986 | ||
984 | /* register all of the individual ports with the driver core */ | 987 | /* register all of the individual ports with the driver core */ |
985 | for (i = 0; i < num_ports; ++i) { | 988 | for (i = 0; i < num_ports; ++i) { |
@@ -1034,9 +1037,6 @@ probe_error: | |||
1034 | kfree(port->interrupt_out_buffer); | 1037 | kfree(port->interrupt_out_buffer); |
1035 | } | 1038 | } |
1036 | 1039 | ||
1037 | /* return the minor range that this device had */ | ||
1038 | return_serial (serial); | ||
1039 | |||
1040 | /* free up any memory that we allocated */ | 1040 | /* free up any memory that we allocated */ |
1041 | for (i = 0; i < serial->num_port_pointers; ++i) | 1041 | for (i = 0; i < serial->num_port_pointers; ++i) |
1042 | kfree(serial->port[i]); | 1042 | kfree(serial->port[i]); |