aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/mos7840.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/mos7840.c')
-rw-r--r--drivers/usb/serial/mos7840.c42
1 files changed, 37 insertions, 5 deletions
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index 5fe9fe3df77..c40f95c1951 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -2633,16 +2633,16 @@ error:
2633} 2633}
2634 2634
2635/**************************************************************************** 2635/****************************************************************************
2636 * mos7840_shutdown 2636 * mos7840_disconnect
2637 * This function is called whenever the device is removed from the usb bus. 2637 * This function is called whenever the device is removed from the usb bus.
2638 ****************************************************************************/ 2638 ****************************************************************************/
2639 2639
2640static void mos7840_shutdown(struct usb_serial *serial) 2640static void mos7840_disconnect(struct usb_serial *serial)
2641{ 2641{
2642 int i; 2642 int i;
2643 unsigned long flags; 2643 unsigned long flags;
2644 struct moschip_port *mos7840_port; 2644 struct moschip_port *mos7840_port;
2645 dbg("%s", " shutdown :entering.........."); 2645 dbg("%s", " disconnect :entering..........");
2646 2646
2647 if (!serial) { 2647 if (!serial) {
2648 dbg("%s", "Invalid Handler"); 2648 dbg("%s", "Invalid Handler");
@@ -2662,11 +2662,42 @@ static void mos7840_shutdown(struct usb_serial *serial)
2662 mos7840_port->zombie = 1; 2662 mos7840_port->zombie = 1;
2663 spin_unlock_irqrestore(&mos7840_port->pool_lock, flags); 2663 spin_unlock_irqrestore(&mos7840_port->pool_lock, flags);
2664 usb_kill_urb(mos7840_port->control_urb); 2664 usb_kill_urb(mos7840_port->control_urb);
2665 }
2666 }
2667
2668 dbg("%s", "Thank u :: ");
2669
2670}
2671
2672/****************************************************************************
2673 * mos7840_release
2674 * This function is called when the usb_serial structure is freed.
2675 ****************************************************************************/
2676
2677static void mos7840_release(struct usb_serial *serial)
2678{
2679 int i;
2680 struct moschip_port *mos7840_port;
2681 dbg("%s", " release :entering..........");
2682
2683 if (!serial) {
2684 dbg("%s", "Invalid Handler");
2685 return;
2686 }
2687
2688 /* check for the ports to be closed,close the ports and disconnect */
2689
2690 /* free private structure allocated for serial port *
2691 * stop reads and writes on all ports */
2692
2693 for (i = 0; i < serial->num_ports; ++i) {
2694 mos7840_port = mos7840_get_port_private(serial->port[i]);
2695 dbg("mos7840_port %d = %p", i, mos7840_port);
2696 if (mos7840_port) {
2665 kfree(mos7840_port->ctrl_buf); 2697 kfree(mos7840_port->ctrl_buf);
2666 kfree(mos7840_port->dr); 2698 kfree(mos7840_port->dr);
2667 kfree(mos7840_port); 2699 kfree(mos7840_port);
2668 } 2700 }
2669 mos7840_set_port_private(serial->port[i], NULL);
2670 } 2701 }
2671 2702
2672 dbg("%s", "Thank u :: "); 2703 dbg("%s", "Thank u :: ");
@@ -2707,7 +2738,8 @@ static struct usb_serial_driver moschip7840_4port_device = {
2707 .tiocmget = mos7840_tiocmget, 2738 .tiocmget = mos7840_tiocmget,
2708 .tiocmset = mos7840_tiocmset, 2739 .tiocmset = mos7840_tiocmset,
2709 .attach = mos7840_startup, 2740 .attach = mos7840_startup,
2710 .shutdown = mos7840_shutdown, 2741 .disconnect = mos7840_disconnect,
2742 .release = mos7840_release,
2711 .read_bulk_callback = mos7840_bulk_in_callback, 2743 .read_bulk_callback = mos7840_bulk_in_callback,
2712 .read_int_callback = mos7840_interrupt_callback, 2744 .read_int_callback = mos7840_interrupt_callback,
2713}; 2745};