Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp66314imu; Thu, 3 Jan 2019 14:11:39 -0800 (PST) X-Google-Smtp-Source: ALg8bN7VaybvTvuTzJ6bdhJy3Hx9nG5iJYP/laLqjQaHogb+9VVyqI82HsG/CeMbzZ2cs0lPFFDe X-Received: by 2002:a65:4049:: with SMTP id h9mr45853647pgp.304.1546553499653; Thu, 03 Jan 2019 14:11:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546553499; cv=none; d=google.com; s=arc-20160816; b=opJpyOZfh0GI/nkSdfowFNcnjhuom1gOztT/57YHHvsgwPl0qHam+1DyE4umjuvEpx FvSFyKX3TW5cuR1dFfxESO+T8Ni26jgFCfRla6NTD14ACHOnlGI5zxDjMEyoX2dza0I4 3YKsSzIlLLCjOVRtt1sr7iMdudr89La/2T/ogcg0+8JUGDDh8oY98NLX7sf8ncWfkGRA hexDoLjO+ANjRU186Ct0wHHbVTR4Ekv1NB40NvFKLayPU5xJHYlDnKPbdKLMWLeAAWWA gj8NrQWJuBkxUj3bN7ZEW6ruQ69JYLehwN3OnJEkjRyj9NxC8iEz4iw9XDdbbjInPp6J tu+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=pabVha8AYe88Z3JqtWOtTwJW/Tm4lwZSMMo59Skbsbc=; b=fBgsFj8P6Vi1/BG5vVIteePFSTJu5y53j6TDq55eSzXr6tw46wivnWZmoK5hhPl13n BpCTthDq9rpm0zYqgssJbpTBUfGew+QN9DjlG/em5jMZ5Iesclh59qqYlseNM17F82u9 lNUsy6TejB3/z1yOMCQLPYIm+UnamRlYPk5SdvEXfrEgdMq4K+Fmzy4aFGPTFE8dqkQ9 /MEocNhly4lerRjLqPNJpl52A3eVWk8smpRqY8zgd5Uifu8pbBAjfU7VlkkNYL1KxMNA f6ClJycnTpOJfStP81LHo4A4doZmTirX5C8vAzqqL5UsPTgBUiG4oYOXKwjZ0QN3IiFc 9y0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microgate-com.20150623.gappssmtp.com header.s=20150623 header.b=GfxIyEtX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x74si11487110pfe.23.2019.01.03.14.11.24; Thu, 03 Jan 2019 14:11:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@microgate-com.20150623.gappssmtp.com header.s=20150623 header.b=GfxIyEtX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731757AbfACP5E (ORCPT + 99 others); Thu, 3 Jan 2019 10:57:04 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:41543 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727699AbfACP5D (ORCPT ); Thu, 3 Jan 2019 10:57:03 -0500 Received: by mail-pg1-f196.google.com with SMTP id m1so16174982pgq.8 for ; Thu, 03 Jan 2019 07:57:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microgate-com.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=pabVha8AYe88Z3JqtWOtTwJW/Tm4lwZSMMo59Skbsbc=; b=GfxIyEtXii8mYEdoWjzQ5HGZ1Uej78w4vUe8PgoPw+xAAzyFNfv4AVCSbVhZTD20Aw EjZP3ffsglC1Xclsnq+k9b0knMtTZMLMHjXcjYeK9lU33k9nMEOVbvTr3C7Cz2P7oCiI Oaq2u8crm/Jos8fpdw0EG++uJ3FGbEtm7om9EF7+5u3mtwEwOB/htvIfckK6VZpoZfdy ZrO52XHqLdyvbCyasGY5ulSM/Xk2ielmvC0hICNvA2sOow72GVufDnRZ/NJkigBP4s/B g5NqhXobM+j58Fvks02CMCr1ru3cI+Se5yZQB/k26KX3kRznR9aM00ScvTwtsA/flbL3 T5WQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=pabVha8AYe88Z3JqtWOtTwJW/Tm4lwZSMMo59Skbsbc=; b=PcA0tRMfrtJOIpze0glRo5gWDU4HDnLbR3pM7lfKRSGqdQ+ScwaHEuwR8EN3OjhoPP nddE4tx0Cxy+9CDGXScHK5Fbw25uLwrRMXtf5QRBmTC16Jz21BRepi65+my7f7B9VxJa AltAsfFGWxlV6NV5Em+LG4O8+3FExMoWi97/TVJKW5YtFt9s2MbsO6PXD7tnlV50YjIL R8LRtrDzPGmCOQbrNv9JjFtNTPskTCF7hMA8znb3rzuZ6sLxMwtKP0KjahBJrIN3Gsb3 ZpufeJRAC3gLFawIAzQ0DLl4pEJWGAEBpX0S0uWDG/++SMRLlL6R/uqZB8tcg3PdvbLC bqzw== X-Gm-Message-State: AA+aEWYeE+7xIt7UmCVwSlw+WHxg+sDekfWCuntva+i+7SazwAVSRBag QVc4oyvsgiHFdXnSJlmTXSS7Iw== X-Received: by 2002:a62:9719:: with SMTP id n25mr50390534pfe.240.1546531022534; Thu, 03 Jan 2019 07:57:02 -0800 (PST) Received: from [192.168.1.77] (c.208.53.119.160.static.broadstripe.net. [208.53.119.160]) by smtp.gmail.com with ESMTPSA id b7sm135668578pga.39.2019.01.03.07.57.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Jan 2019 07:57:01 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.2 \(3445.102.3\)) Subject: Re: [PATCH] tty/n_hdlc: fix sleep in !TASK_RUNNING state warning From: Paul Fulghum In-Reply-To: <98eec651-d1ab-48e5-309b-7e748981cfdd@i-love.sakura.ne.jp> Date: Thu, 3 Jan 2019 07:57:00 -0800 Cc: Jiri Slaby , Arnd Bergmann , Greg Kroah-Hartman , Alan Cox , linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Message-Id: <434841F9-C2DF-4D73-9AFB-3BFADF325086@microgate.com> References: <000000000000449587057e1e6f8b@google.com> <49b3b189-a51f-6a97-0e1f-bc3f2c305299@I-love.SAKURA.ne.jp> <98eec651-d1ab-48e5-309b-7e748981cfdd@i-love.sakura.ne.jp> To: Tetsuo Handa X-Mailer: Apple Mail (2.3445.102.3) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Jan 3, 2019, at 3:32 AM, Tetsuo Handa = wrote: >=20 > 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 =3D -EIO, test_bit(TTY_OTHER_CLOSED, &tty->flags)) || >>> + (ret =3D 0, tty_hung_up_p(file)) || >>> + (rbuf =3D n_hdlc_buf_get(&n_hdlc->rx_buf_list)) !=3D NULL = || >>> + (ret =3D -EAGAIN, tty_io_nonblock(tty, file)))) >>> + return -EINTR; >>=20 >> Oh, that looks really ugly. Could you move all this to a function >> returning a bool and taking &ret and &rbuf as parameters? >>=20 >=20 > 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.