From: Paul Fulghum <paulkf@microgate.com>
To: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Cc: Jiri Slaby <jslaby@suse.cz>, Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Alan Cox <alan@lxorguk.ukuu.org.uk>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tty/n_hdlc: fix sleep in !TASK_RUNNING state warning
Date: Thu, 3 Jan 2019 07:57:00 -0800 [thread overview]
Message-ID: <434841F9-C2DF-4D73-9AFB-3BFADF325086@microgate.com> (raw)
In-Reply-To: <98eec651-d1ab-48e5-309b-7e748981cfdd@i-love.sakura.ne.jp>
> On Jan 3, 2019, at 3:32 AM, Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp> wrote:
>
> On 2019/01/03 18:09, Jiri Slaby wrote:
>> On 02. 01. 19, 16:04, Tetsuo Handa wrote:
>>> + if (wait_event_interruptible(tty->read_wait,
>>> + (ret = -EIO, test_bit(TTY_OTHER_CLOSED, &tty->flags)) ||
>>> + (ret = 0, tty_hung_up_p(file)) ||
>>> + (rbuf = n_hdlc_buf_get(&n_hdlc->rx_buf_list)) != NULL ||
>>> + (ret = -EAGAIN, tty_io_nonblock(tty, file))))
>>> + return -EINTR;
>>
>> Oh, that looks really ugly. Could you move all this to a function
>> returning a bool and taking &ret and &rbuf as parameters?
>>
>
> OK. Something like this?
I agree with Jiri that placing all the conditional logic in a single expression is difficult to read.
But exchanging that many locals with a separate function defeats the original purpose of
simplifying code and this implementation changes the logic (write no
longer checks for line discipline changing under it during wait).
Converting to wait_event_interruptible where possible is a good goal but this instance
may be better left alone. The current structure mirrors the existing n_tty line discipline.
next prev parent reply other threads:[~2019-01-03 15:57 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-29 0:41 WARNING in __might_sleep (2) syzbot
2018-12-29 11:48 ` [PATCH] tty/n_hdlc: fix sleep in !TASK_RUNNING state warning Tetsuo Handa
2019-01-01 3:13 ` Paul Fulghum
2019-01-01 20:28 ` [PATCH] tty/n_hdlc: fix __might_sleep warning Paul Fulghum
2019-01-10 11:38 ` Tetsuo Handa
2019-01-10 12:25 ` Arnd Bergmann
[not found] ` <FEBFE826-8D27-4A0B-86A5-BA559921CADC@microgate.com>
2019-01-02 15:04 ` [PATCH] tty/n_hdlc: fix sleep in !TASK_RUNNING state warning Tetsuo Handa
2019-01-02 20:55 ` Paul Fulghum
2019-01-03 9:09 ` Jiri Slaby
2019-01-03 11:32 ` Tetsuo Handa
2019-01-03 15:57 ` Paul Fulghum [this message]
2019-01-04 10:23 ` Tetsuo Handa
2019-01-04 13:57 ` Paul Fulghum
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=434841F9-C2DF-4D73-9AFB-3BFADF325086@microgate.com \
--to=paulkf@microgate.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=penguin-kernel@i-love.sakura.ne.jp \
/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
Powered by JetHome