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>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
e4408ce3c2
commit
aa27a094e2
@@ -628,7 +628,6 @@ static void sierra_instat_callback(struct urb *urb)
|
||||
unsigned char signals = *((unsigned char *)
|
||||
urb->transfer_buffer +
|
||||
sizeof(struct usb_ctrlrequest));
|
||||
struct tty_struct *tty;
|
||||
|
||||
dev_dbg(&port->dev, "%s: signal x%x\n", __func__,
|
||||
signals);
|
||||
@@ -639,11 +638,8 @@ static void sierra_instat_callback(struct urb *urb)
|
||||
portdata->dsr_state = ((signals & 0x02) ? 1 : 0);
|
||||
portdata->ri_state = ((signals & 0x08) ? 1 : 0);
|
||||
|
||||
tty = tty_port_tty_get(&port->port);
|
||||
if (tty && !C_CLOCAL(tty) &&
|
||||
old_dcd_state && !portdata->dcd_state)
|
||||
tty_hangup(tty);
|
||||
tty_kref_put(tty);
|
||||
if (old_dcd_state && !portdata->dcd_state)
|
||||
tty_port_tty_hangup(&port->port, true);
|
||||
} else {
|
||||
dev_dbg(&port->dev, "%s: type %x req %x\n",
|
||||
__func__, req_pkt->bRequestType,
|
||||
|
Reference in New Issue
Block a user