Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6aad04f2 authored by Jiri Slaby's avatar Jiri Slaby Committed by Greg Kroah-Hartman
Browse files

TTY: add tty_port_tty_wakeup helper



It allows for cleaning up on a considerable amount of places. They did
port_get, wakeup, kref_put. Now the only thing needed is to call
tty_port_tty_wakeup which does exactly that.

One exception is ifx6x60 where tty_wakeup was open-coded. We now call
tty_wakeup properly there.

Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6982a398
Loading
Loading
Loading
Loading
+1 −7
Original line number Diff line number Diff line
@@ -248,7 +248,6 @@ static irqreturn_t line_write_interrupt(int irq, void *data)
{
	struct chan *chan = data;
	struct line *line = chan->line;
	struct tty_struct *tty;
	int err;

	/*
@@ -267,12 +266,7 @@ static irqreturn_t line_write_interrupt(int irq, void *data)
	}
	spin_unlock(&line->lock);

	tty = tty_port_tty_get(&line->port);
	if (tty == NULL)
		return IRQ_NONE;

	tty_wakeup(tty);
	tty_kref_put(tty);
	tty_port_tty_wakeup(&line->port);

	return IRQ_HANDLED;
}
+1 −6
Original line number Diff line number Diff line
@@ -569,7 +569,6 @@ static void capi_recv_message(struct capi20_appl *ap, struct sk_buff *skb)
{
	struct capidev *cdev = ap->private;
#ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
	struct tty_struct *tty;
	struct capiminor *mp;
	u16 datahandle;
	struct capincci *np;
@@ -627,11 +626,7 @@ static void capi_recv_message(struct capi20_appl *ap, struct sk_buff *skb)
			 CAPIMSG_U16(skb->data, CAPIMSG_BASELEN + 4 + 2));
		kfree_skb(skb);
		capiminor_del_ack(mp, datahandle);
		tty = tty_port_tty_get(&mp->port);
		if (tty) {
			tty_wakeup(tty);
			tty_kref_put(tty);
		}
		tty_port_tty_wakeup(&mp->port);
		handle_minor_send(mp);

	} else {
+1 −5
Original line number Diff line number Diff line
@@ -487,12 +487,8 @@ static const struct tty_operations if_ops = {
static void if_wake(unsigned long data)
{
	struct cardstate *cs = (struct cardstate *)data;
	struct tty_struct *tty = tty_port_tty_get(&cs->port);

	if (tty) {
		tty_wakeup(tty);
		tty_kref_put(tty);
	}
	tty_port_tty_wakeup(&cs->port);
}

/*** interface to common ***/
+2 −11
Original line number Diff line number Diff line
@@ -1925,7 +1925,6 @@ static void hso_std_serial_write_bulk_callback(struct urb *urb)
{
	struct hso_serial *serial = urb->context;
	int status = urb->status;
	struct tty_struct *tty;

	/* sanity check */
	if (!serial) {
@@ -1941,11 +1940,7 @@ static void hso_std_serial_write_bulk_callback(struct urb *urb)
		return;
	}
	hso_put_activity(serial->parent);
	tty = tty_port_tty_get(&serial->port);
	if (tty) {
		tty_wakeup(tty);
		tty_kref_put(tty);
	}
	tty_port_tty_wakeup(&serial->port);
	hso_kick_transmit(serial);

	D1(" ");
@@ -2008,12 +2003,8 @@ static void ctrl_callback(struct urb *urb)
		put_rxbuf_data_and_resubmit_ctrl_urb(serial);
		spin_unlock(&serial->serial_lock);
	} else {
		struct tty_struct *tty = tty_port_tty_get(&serial->port);
		hso_put_activity(serial->parent);
		if (tty) {
			tty_wakeup(tty);
			tty_kref_put(tty);
		}
		tty_port_tty_wakeup(&serial->port);
		/* response to a write command */
		hso_kick_transmit(serial);
	}
+2 −7
Original line number Diff line number Diff line
@@ -107,7 +107,6 @@ sclp_tty_write_room (struct tty_struct *tty)
static void
sclp_ttybuf_callback(struct sclp_buffer *buffer, int rc)
{
	struct tty_struct *tty;
	unsigned long flags;
	void *page;

@@ -125,12 +124,8 @@ sclp_ttybuf_callback(struct sclp_buffer *buffer, int rc)
					    struct sclp_buffer, list);
		spin_unlock_irqrestore(&sclp_tty_lock, flags);
	} while (buffer && sclp_emit_buffer(buffer, sclp_ttybuf_callback));
	/* check if the tty needs a wake up call */
	tty = tty_port_tty_get(&sclp_port);
	if (tty != NULL) {
		tty_wakeup(tty);
		tty_kref_put(tty);
	}

	tty_port_tty_wakeup(&sclp_port);
}

static inline void
Loading