From patchwork Thu Aug 18 01:14:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 74134 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp106391qga; Wed, 17 Aug 2016 18:15:45 -0700 (PDT) X-Received: by 10.98.18.221 with SMTP id 90mr79754038pfs.3.1471482944737; Wed, 17 Aug 2016 18:15:44 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n127si40418252pfn.241.2016.08.17.18.15.44; Wed, 17 Aug 2016 18:15:44 -0700 (PDT) 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; 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 S1945955AbcHRBPc (ORCPT + 27 others); Wed, 17 Aug 2016 21:15:32 -0400 Received: from mail-oi0-f65.google.com ([209.85.218.65]:33128 "EHLO mail-oi0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753660AbcHRBP3 (ORCPT ); Wed, 17 Aug 2016 21:15:29 -0400 Received: by mail-oi0-f65.google.com with SMTP id s207so1172541oie.0; Wed, 17 Aug 2016 18:15:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Vpm1rTw8eABtZxVsELQVZs6HykLoeIcpdmRLPBh73Ak=; b=LtkpPVmHXfq0ho189Zyk4GThYN7G5pMZG6OAmq4fR1m4e6J7dhq7bEdpp6BdNDllkK r54fxGD0/bpKjm8bIyrZLXhaS1FLmuclTGP3IbppllPLCu2VC2fLdn6wNJW+lGuIJHb5 HN6XbvbZwWCU2PHE1Y/S+Ak8Yg15qE360Yq9O4t77m/nlN+LvDowFA71xLCpHc+rM+H7 6vPs1KgI0oFqRlwCp4+FrKlC1acO7mWxfVM93cCsDQrU4jrRkGHYgRgWSLmkoe9rmnNv SMVSdaL8b2q+Uugeq8KPvNWABNqRhBIa+BPcUerNSUemtcsX+zfhIyTa2he1VnDR3bc2 z1dA== X-Gm-Message-State: AEkooutEfARKIQ8GEfw2kslixhQu2PQY6EkgpozGopqdx2RIb3uGHVqMok4f0kDD0m49XA== X-Received: by 10.202.177.4 with SMTP id a4mr10230212oif.72.1471482928957; Wed, 17 Aug 2016 18:15:28 -0700 (PDT) Received: from rob-hp-laptop.herring.priv (72-48-98-129.dyn.grandenetworks.net. [72.48.98.129]) by smtp.googlemail.com with ESMTPSA id c44sm1261876ote.14.2016.08.17.18.15.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 17 Aug 2016 18:15:28 -0700 (PDT) From: Rob Herring To: Greg Kroah-Hartman , Marcel Holtmann , Jiri Slaby , Sebastian Reichel Cc: Pavel Machek , Peter Hurley , NeilBrown , "Dr . H . Nikolaus Schaller" , Arnd Bergmann , Linus Walleij , linux-bluetooth@vger.kernel.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 3/3] tty: serial_core: add uart controller registration Date: Wed, 17 Aug 2016 20:14:45 -0500 Message-Id: <20160818011445.22726-4-robh@kernel.org> X-Mailer: git-send-email 2.9.2 In-Reply-To: <20160818011445.22726-1-robh@kernel.org> References: <20160818011445.22726-1-robh@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Register serial ports with the uart device core as a controller and add a receive handler call. Signed-off-by: Rob Herring --- drivers/tty/serial/serial_core.c | 8 ++++++++ include/linux/serial_core.h | 1 + 2 files changed, 9 insertions(+) -- 2.9.2 diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 9dd444f..1552fee 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -2800,6 +2801,10 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *uport) uart_configure_port(drv, state, uport); + uport->ctrlr = uart_controller_alloc(uport->dev, 0); + uport->ctrlr->port = uport; + uart_controller_add(uport->ctrlr); + num_groups = 2; if (uport->attr_group) num_groups++; @@ -3027,6 +3032,9 @@ void uart_insert_char(struct uart_port *port, unsigned int status, { struct tty_port *tport = &port->state->port; + if (uart_controller_rx(port->ctrlr, ch) >= 0) + return; + if ((status & port->ignore_status_mask & ~overrun) == 0) if (tty_insert_flip_char(tport, ch, flag) == 0) ++port->icount.buf_overrun; diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index a27ca1f..7cde6a9 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -155,6 +155,7 @@ struct uart_port { unsigned int read_status_mask; /* driver specific */ unsigned int ignore_status_mask; /* driver specific */ + struct uart_controller *ctrlr; struct uart_state *state; /* pointer to parent state */ struct uart_icount icount; /* statistics */