From: Jiri Slaby <jslaby@suse.cz>
To: Gregory CLEMENT <gregory.clement@bootlin.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH 3/3] tty: n_gsm: Fix waking up upper tty layer when room available
Date: Mon, 4 May 2020 08:30:56 +0200 [thread overview]
Message-ID: <dee67599-a3bf-3904-e26b-4a02f36cf67f@suse.cz> (raw)
In-Reply-To: <20200430113433.2162886-5-gregory.clement@bootlin.com>
On 30. 04. 20, 13:34, Gregory CLEMENT wrote:
> Warn the upper layer when n_gms is ready to receive data
> again. Without this the associated virtual tty remain blocked
s/remain/&s/
> indefinitely.
>
> Fixes: 96fd7ce58ffb ("TTY: create drivers/tty and move the tty core files there")
This looks invalid. Did you use git blame? Or git log, with --follow -M?
> Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
> ---
> drivers/tty/n_gsm.c | 33 +++++++++++++++++++++++++++++----
> 1 file changed, 29 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
> index 58950b33e5ac..4ff2b981aa7e 100644
> --- a/drivers/tty/n_gsm.c
> +++ b/drivers/tty/n_gsm.c
> @@ -665,10 +665,12 @@ static struct gsm_msg *gsm_data_alloc(struct gsm_mux *gsm, u8 addr, int len,
> * FIXME: lock against link layer control transmissions
> */
>
> -static void gsm_data_kick(struct gsm_mux *gsm)
> +static void gsm_data_kick(struct gsm_mux *gsm, struct gsm_dlci *dlci)
> {
> struct gsm_msg *msg, *nmsg;
> int len;
> + struct tty_struct *tty_dlci = NULL;
> +
>
> list_for_each_entry_safe(msg, nmsg, &gsm->tx_list, list) {
> if (gsm->constipated && msg->addr)
> @@ -697,6 +699,29 @@ static void gsm_data_kick(struct gsm_mux *gsm)
>
> list_del(&msg->list);
> kfree(msg);
> +
> + if (dlci) {
> + tty_dlci = tty_port_tty_get(&dlci->port);
> + if (tty_dlci)
> + tty_wakeup(tty_dlci);
No tty_port_put looks wrong to me?
Why not to use tty_port_tty_wakeup?
> + } else {
> + int i = 0;
> +
> + while (i < NUM_DLCI) {
Hmm, feels like 'for' loop fits better here.
> + struct gsm_dlci *dlci;
> +
> + dlci = gsm->dlci[i];
> + if (dlci == NULL) {
> + i++;
> + continue;
> + }
> +
> + tty_dlci = tty_port_tty_get(&dlci->port);
> + if (tty_dlci)
> + tty_wakeup(tty_dlci);
Dtto
> + i++;
> + }
> + }
> }
> }
>
> @@ -748,7 +773,7 @@ static void __gsm_data_queue(struct gsm_dlci *dlci, struct gsm_msg *msg)
> /* Add to the actual output queue */
> list_add_tail(&msg->list, &gsm->tx_list);
> gsm->tx_bytes += msg->len;
> - gsm_data_kick(gsm);
> + gsm_data_kick(gsm, dlci);
thanks,
--
js
suse labs
prev parent reply other threads:[~2020-05-04 6:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-30 11:34 [PATCH 0/3] TTY improve n_gsm support Gregory CLEMENT
2020-04-30 11:34 ` [PATCH 1/3] tty: n_gsm: Improve debug output Gregory CLEMENT
2020-05-04 6:37 ` Jiri Slaby
2020-04-30 11:34 ` [PATCH 2/3] tty: n_gsm: Fix SOF skipping Gregory CLEMENT
2020-05-04 6:39 ` Jiri Slaby
2020-04-30 11:34 ` [PATCH 3/3] tty: n_gsm: Fixe waking up upper tty layer when room available Gregory CLEMENT
2020-04-30 11:34 ` [PATCH 3/3] tty: n_gsm: Fix " Gregory CLEMENT
2020-05-04 6:30 ` Jiri Slaby [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dee67599-a3bf-3904-e26b-4a02f36cf67f@suse.cz \
--to=jslaby@suse.cz \
--cc=gregkh@linuxfoundation.org \
--cc=gregory.clement@bootlin.com \
--cc=linux-kernel@vger.kernel.org \
--cc=thomas.petazzoni@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox