Message ID | 20230802150545.3742-3-jszhang@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp550272vqx; Wed, 2 Aug 2023 08:48:04 -0700 (PDT) X-Google-Smtp-Source: APBJJlE8IVqEJqIYkSoTMTkRR0saK8Nv5blB7LNoq7gm9U7p0D+T+KTsavSEZiuoFk90LujMVAWa X-Received: by 2002:a17:902:d2cd:b0:1bc:239:a7ec with SMTP id n13-20020a170902d2cd00b001bc0239a7ecmr12962375plc.65.1690991284101; Wed, 02 Aug 2023 08:48:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690991284; cv=none; d=google.com; s=arc-20160816; b=eq/KyRJpkZXPQEpO0HSdvRGB2A0aIGiyrmVQ+tWgwDi+xI+P7ZZuPrf0/jqyhFll0z gFov0xX4zP8sgwfagqXFMLY0EnDv/la61XMK0BU+2ZMA6TnmYwteLDdVkkdCedxprcJ+ msFOAQZiveZZKtN+3ZWktDIsv3as/vafP12mvK9Ip1Qcum0wXr2QQbe0syeUq/zn+Nf0 JJ8HOlms8Jw26W8elSJ+IDAvxaUuk+ttYU8ZMPHYi+X18QgS/N700jUYUYgqbQy+aLUo f9nAM3sLVZzu1At9L5UqoN4MTISfe8lzBwWEin+1ccUUErAO3Blr6Ye88LOYi/BrIky6 sPzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Zrnu0/L77MNW1fa/WdNXwcEGI7LPKgy7NUxx30oiKO4=; fh=9LhevukQlN8QgABBNKHWl1nBtSwK1vKoyAVqIrNCnSI=; b=EyYYqhDEpbTwGgdAopIZ7zRk1t6e1YGoENZWyoxe0L1fughDhE/hmtYdShjiAyArxy EiH6RHC3N77f3SqtaU2ez/ZCZ/YIERmrmTu3i4YfW7Hq1vpc4NqiNHBC12uNttTN7Am7 Hv536BuJuvMQb/xmzXw3CEmH3hXJ9g/QqoUWrkplvo/lQg7f9YxTy+P5DB8CUCM1o6mj uOiYvmnpNMbmIMgB+RW/s5S37mnYwGcTsWAVEfF6ls/OdyQ/Y5am8SaSyWn9jmSPG5hn 4m/uI0zZtyEjVmxaBKsLijy/F0LZ5SmUbua96fQdAlVW4XE1s+30Vx4C56UfPbBA7tDE 53gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=o+GTk+Zi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j14-20020a170902da8e00b001bb7b0d358bsi2620990plx.272.2023.08.02.08.47.50; Wed, 02 Aug 2023 08:48:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=o+GTk+Zi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232192AbjHBPWY (ORCPT <rfc822;maxi.paulin@gmail.com> + 99 others); Wed, 2 Aug 2023 11:22:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234923AbjHBPVy (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 2 Aug 2023 11:21:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CC37729C; Wed, 2 Aug 2023 08:18:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 19A2361A10; Wed, 2 Aug 2023 15:17:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68AD5C433C8; Wed, 2 Aug 2023 15:17:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690989452; bh=7g0cOtIPkTfpyTVkaC+imOD6lb85coVQ5pyYai7ah8g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o+GTk+ZiTqrD50iO1u+Je+SWZGXJ8Ykl+Kd2uDp2GWXfLqyxNMBGGoKLq47yWby6/ Grucz//CFkdABFja9oavh7p0hIl+v8DkAzPsThD7LrkPk/4MWmVJxVSsE9wzX8/FZJ CstVqxfxeHocIXHyfPrUsn3nZ4t0JO8dtNmEldKeMb0nhMfFkO7N/pGEpgFGV7Atd6 AhLtDUvem4RlppYeFSpP1CwRYzz93yhezO89tL4c6Pj0vV8hJVLLzYjsa5UcVLpArx hfynAGhFjQQfJcuEOqtYF6ZDPcgHYqa9M0ap3SEnoIwG/oU406YjcI80x5hWsAIbti YOH3EVR0d30gQ== From: Jisheng Zhang <jszhang@kernel.org> To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Conor Dooley <conor+dt@kernel.org>, =?utf-8?q?Ilpo_J=C3=A4rvinen?= <ilpo.jarvinen@linux.intel.com>, Andy Shevchenko <andriy.shevchenko@linux.intel.com>, Jiri Slaby <jirislaby@kernel.org> Cc: linux-serial@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] serial: 8250_dw: fall back to poll if there's no interrupt Date: Wed, 2 Aug 2023 23:05:45 +0800 Message-Id: <20230802150545.3742-3-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230802150545.3742-1-jszhang@kernel.org> References: <20230802150545.3742-1-jszhang@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773132790660813384 X-GMAIL-MSGID: 1773132876840926466 |
Series |
serial: 8250_dw: fall back to poll if there's no interrupt
|
|
Commit Message
Jisheng Zhang
Aug. 2, 2023, 3:05 p.m. UTC
When there's no irq(this can be due to various reasons, for example,
no irq from HW support, or we just want to use poll solution, and so
on), falling back to poll is still better than no support at all.
Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
---
drivers/tty/serial/8250/8250_dw.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
Comments
On Wed, Aug 02, 2023 at 11:05:45PM +0800, Jisheng Zhang wrote: > When there's no irq(this can be due to various reasons, for example, > no irq from HW support, or we just want to use poll solution, and so > on), falling back to poll is still better than no support at all. ... > irq = platform_get_irq(pdev, 0); You will still have an error message. Perhaps you need to replace it with irq = platform_get_irq_optional(pdev, 0); > - if (irq < 0) > - return irq; > + if (irq < 0) { > + if (irq != -ENXIO) > + return irq; > + /* no interrupt -> fall back to polling */ > + irq = 0; > + } This can be slightly modified: /* no interrupt -> fall back to polling */ if (irq == -ENXIO) irq = 0; if (irq < 0) return irq;
diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c index 7db51781289e..39db768517eb 100644 --- a/drivers/tty/serial/8250/8250_dw.c +++ b/drivers/tty/serial/8250/8250_dw.c @@ -524,8 +524,12 @@ static int dw8250_probe(struct platform_device *pdev) return dev_err_probe(dev, -EINVAL, "no registers defined\n"); irq = platform_get_irq(pdev, 0); - if (irq < 0) - return irq; + if (irq < 0) { + if (irq != -ENXIO) + return irq; + /* no interrupt -> fall back to polling */ + irq = 0; + } spin_lock_init(&p->lock); p->mapbase = regs->start;