From patchwork Mon Jun 22 14:26:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Garg X-Patchwork-Id: 191332 Delivered-To: patch@linaro.org Received: by 2002:a92:1f07:0:0:0:0:0 with SMTP id i7csp1092585ile; Mon, 22 Jun 2020 07:27:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzimbhscLq8DLjUYmzKqObm8z4dAAw5m3/yUZjaYWbiAnBPp4/XEWavIVbNsT1EahlY/H03 X-Received: by 2002:a17:906:ce28:: with SMTP id sd8mr15658451ejb.280.1592836053598; Mon, 22 Jun 2020 07:27:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592836053; cv=none; d=google.com; s=arc-20160816; b=YCgTGxc/fbkiUMvXaYRwfnlib4YunUz+IuO/MkxLWVXvpyXRadbY1qH0fL6/WoNZl6 9wDa2Wz3g/wjWnxxDV51iGgmeXgpIXgXyQl04WiBZnxRKW1xO5Bn3oAfcIP8P7oTeFrx P9QgnsENqc442ag74YVP9nPXT04OUCQe+HATt1f09A4PGIXYDj3SXvXVzWvCujr3ODC8 Am46raPURfVLh62poz0ye5vu8RUiIOX7MJNHHYz7hYw0Ednfc7pNnShdDLp7l/g+kQ0d dmgo2nCHJkOPgV97GRaKO8xmU8wsBmSoVAHFXva/zKNwn9YKQX/f17cRBSgWBml7sXQy qcww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=vwFsGBHaAVO/O+/Qurpo2lVEh+kEhysHr8M/+K/fxoc=; b=kJ5NCk8aQlatu8w1GF0blPA/WSjjiZkF4Dzf/HKeG4qx6YLmOjdTpkoUoay8FRx6IG OYEhWWbdoK/8xJKU5sJFm9fn2mJ5HdFc4qHklA0qydFs2wKfKAgbhKnqp6EDGKLIYotk wZO1sWSbKj0CEliQlv7LVRSQ3cnnhYgv4MaH/W5PL/cnR0wvEM2l1gUubRvoUowN6RH+ oZjc3gKBbkmrFk4wc6kbLR52MLmSLOGQ1Cz1bLAumn7p4T9n1096xHz1mw8NhF4UCOJ9 oo2LO0V2a5u6B+mG6MOxvb5Lm5/7f59LUBGsSwEQ8mffPBAmf0eWiNaMaj3nCmZoVsXE ZlGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=A0H4lXeS; spf=pass (google.com: domain of linux-serial-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-serial-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w26si9077893edq.285.2020.06.22.07.27.33; Mon, 22 Jun 2020 07:27:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-serial-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=A0H4lXeS; spf=pass (google.com: domain of linux-serial-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-serial-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729753AbgFVO1b (ORCPT + 1 other); Mon, 22 Jun 2020 10:27:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729771AbgFVO1a (ORCPT ); Mon, 22 Jun 2020 10:27:30 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7177DC061795 for ; Mon, 22 Jun 2020 07:27:30 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id z63so8501224pfb.1 for ; Mon, 22 Jun 2020 07:27:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=vwFsGBHaAVO/O+/Qurpo2lVEh+kEhysHr8M/+K/fxoc=; b=A0H4lXeSqd1TcxTG4LkROpY5Ka7b89dAFnokSllDR68dqft5Eb3Sn+vycp/qtrhYPY Zg19eLNhtlN0dlmyu1JXx/lZTscE50s/df/wBFUmF5h0/CYagKoI7JXYmu8c/LiH9aWW c51dblKL90Tzo4xj50Bfq6fyy9fWKaJKxiwUejKcV6chfaeKNl6slT2CtykiK81hqv4d 2yLtdAYPMo8a6blB1QahexeTWQd6h0+I/PgnWrAhNe34KueKPg9k3NcquzAXJeYN77gJ MO2fh80EBgSVbP51lQ9PRKP9SD5h4V1Varsf+rDfhLRjJwdFtwfECRh2Xk9zwBi2IGHW azbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=vwFsGBHaAVO/O+/Qurpo2lVEh+kEhysHr8M/+K/fxoc=; b=hHhxLWS9UIKUJGFUmwHfSXNM2zNtqY8gbuo5x5idWlBAyrBocQ0qP2fWX/uP47YsJM vAU32z9G720fHSR0Toae6u2/HnHQaRkvpfm6Du8j39KKG+KzOMJWFKovyqU+J8tsmWJK 52dY7zAmimslazOmPsTI593/Ndvhe1wN0ARlQXwXIX6T4G8taCDstoFUjICTpc5UpmAo 0lZGFOUu4HYA5ylbB7NLZOf7vUVKmOOkWFOiC93guZFD4MGhNjRmZth/Fj9HUPfKb3dE W7R9511pB5r7NBBflxyQftSInzOt6v23z36K8d3dsqwXPfZoXBuurmj9EQGg7a9DDPPl Gz3w== X-Gm-Message-State: AOAM533OjEroOMWiiwENmNRSA/KM9bOnA+IqFRV8Ejqf011wIluggdgX xzqPI8dhvQdumL8YVNkzV5/e0A== X-Received: by 2002:a63:d318:: with SMTP id b24mr12063898pgg.403.1592836050027; Mon, 22 Jun 2020 07:27:30 -0700 (PDT) Received: from localhost.localdomain ([117.252.67.186]) by smtp.gmail.com with ESMTPSA id d6sm14547939pjh.5.2020.06.22.07.27.25 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Jun 2020 07:27:29 -0700 (PDT) From: Sumit Garg To: kgdb-bugreport@lists.sourceforge.net, linux-serial@vger.kernel.org Cc: gregkh@linuxfoundation.org, daniel.thompson@linaro.org, jason.wessel@windriver.com, dianders@chromium.org, jslaby@suse.com, linux@armlinux.org.uk, linux-kernel@vger.kernel.org, Sumit Garg Subject: [PATCH 2/7] tty: serial: Add poll_get_irq() to the polling interface Date: Mon, 22 Jun 2020 19:56:19 +0530 Message-Id: <1592835984-28613-3-git-send-email-sumit.garg@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1592835984-28613-1-git-send-email-sumit.garg@linaro.org> References: <1592835984-28613-1-git-send-email-sumit.garg@linaro.org> Sender: linux-serial-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org From: Daniel Thompson Add new API: poll_get_irq() to the polling interface in order for user of polling interface to retrieve allocated IRQ corresponding to underlying serial device. Although, serial interface still works in polling mode but interrupt associated with serial device can be leveraged for special purposes like debugger(kgdb) entry. Signed-off-by: Daniel Thompson Signed-off-by: Sumit Garg --- drivers/tty/serial/serial_core.c | 18 ++++++++++++++++++ include/linux/serial_core.h | 1 + include/linux/tty_driver.h | 1 + 3 files changed, 20 insertions(+) -- 2.7.4 diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 66a5e2f..1bb033c 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -2470,6 +2470,23 @@ static void uart_poll_put_char(struct tty_driver *driver, int line, char ch) port->ops->poll_put_char(port, ch); uart_port_deref(port); } + +static int uart_poll_get_irq(struct tty_driver *driver, int line) +{ + struct uart_driver *drv = driver->driver_state; + struct uart_state *state = drv->state + line; + struct uart_port *port; + int ret = -ENODEV; + + port = uart_port_ref(state); + if (port && port->ops->poll_get_irq) { + ret = port->ops->poll_get_irq(port); + uart_port_deref(port); + } + + return ret; +} + #endif static const struct tty_operations uart_ops = { @@ -2505,6 +2522,7 @@ static const struct tty_operations uart_ops = { .poll_init = uart_poll_init, .poll_get_char = uart_poll_get_char, .poll_put_char = uart_poll_put_char, + .poll_get_irq = uart_poll_get_irq, #endif }; diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 92f5eba..8b132e6 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -78,6 +78,7 @@ struct uart_ops { int (*poll_init)(struct uart_port *); void (*poll_put_char)(struct uart_port *, unsigned char); int (*poll_get_char)(struct uart_port *); + int (*poll_get_irq)(struct uart_port *); #endif }; diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h index 3584462..d6da5c5 100644 --- a/include/linux/tty_driver.h +++ b/include/linux/tty_driver.h @@ -295,6 +295,7 @@ struct tty_operations { int (*poll_init)(struct tty_driver *driver, int line, char *options); int (*poll_get_char)(struct tty_driver *driver, int line); void (*poll_put_char)(struct tty_driver *driver, int line, char ch); + int (*poll_get_irq)(struct tty_driver *driver, int line); #endif int (*proc_show)(struct seq_file *, void *); } __randomize_layout;