diff options
author | Jiri Slaby <jslaby@suse.cz> | 2013-03-07 07:12:30 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-03-18 19:24:29 -0400 |
commit | aa27a094e2c2e0cc59914e56113b860f524f4479 (patch) | |
tree | b3cfef8d8023741107e3d3bed934f2bd4d8bf189 /drivers/net/usb | |
parent | e4408ce3c23f8451eff7a2954694598fb8fce833 (diff) |
TTY: add tty_port_tty_hangup helper
It allows for cleaning up on a considerable amount of places. They did
port_get, hangup, kref_put. Now the only thing needed is to call
tty_port_tty_hangup which does exactly that. And they can also decide
whether to consider CLOCAL or completely ignore that.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/net/usb')
-rw-r--r-- | drivers/net/usb/hso.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c index a7714b4f29ad..cba1d46e672e 100644 --- a/drivers/net/usb/hso.c +++ b/drivers/net/usb/hso.c | |||
@@ -3124,18 +3124,13 @@ static void hso_serial_ref_free(struct kref *ref) | |||
3124 | static void hso_free_interface(struct usb_interface *interface) | 3124 | static void hso_free_interface(struct usb_interface *interface) |
3125 | { | 3125 | { |
3126 | struct hso_serial *hso_dev; | 3126 | struct hso_serial *hso_dev; |
3127 | struct tty_struct *tty; | ||
3128 | int i; | 3127 | int i; |
3129 | 3128 | ||
3130 | for (i = 0; i < HSO_SERIAL_TTY_MINORS; i++) { | 3129 | for (i = 0; i < HSO_SERIAL_TTY_MINORS; i++) { |
3131 | if (serial_table[i] && | 3130 | if (serial_table[i] && |
3132 | (serial_table[i]->interface == interface)) { | 3131 | (serial_table[i]->interface == interface)) { |
3133 | hso_dev = dev2ser(serial_table[i]); | 3132 | hso_dev = dev2ser(serial_table[i]); |
3134 | tty = tty_port_tty_get(&hso_dev->port); | 3133 | tty_port_tty_hangup(&hso_dev->port, false); |
3135 | if (tty) { | ||
3136 | tty_hangup(tty); | ||
3137 | tty_kref_put(tty); | ||
3138 | } | ||
3139 | mutex_lock(&hso_dev->parent->mutex); | 3134 | mutex_lock(&hso_dev->parent->mutex); |
3140 | hso_dev->parent->usb_gone = 1; | 3135 | hso_dev->parent->usb_gone = 1; |
3141 | mutex_unlock(&hso_dev->parent->mutex); | 3136 | mutex_unlock(&hso_dev->parent->mutex); |