From patchwork Fri Jul 4 16:34:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 4481971 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 78659BEEAA for ; Fri, 4 Jul 2014 16:35:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B920020357 for ; Fri, 4 Jul 2014 16:35:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DA7912026F for ; Fri, 4 Jul 2014 16:35:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753232AbaGDQeW (ORCPT ); Fri, 4 Jul 2014 12:34:22 -0400 Received: from www.linutronix.de ([62.245.132.108]:35598 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752129AbaGDQeV (ORCPT ); Fri, 4 Jul 2014 12:34:21 -0400 Received: from localhost ([127.0.0.1] helo=bazinga.breakpoint.cc) by Galois.linutronix.de with esmtp (Exim 4.80) (envelope-from ) id 1X36RG-0003sm-3U; Fri, 04 Jul 2014 18:34:18 +0200 From: Sebastian Andrzej Siewior To: linux-serial@vger.kernel.org Cc: linux-kernel@vger.kernel.org, balbi@ti.com, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, tony@atomide.com, Sebastian Andrzej Siewior Subject: [RFC PATCH 1/4] tty: serial: 8250 core: provide a function to export uart_8250_port Date: Fri, 4 Jul 2014 18:34:08 +0200 Message-Id: <1404491651-1388-1-git-send-email-bigeasy@linutronix.de> X-Mailer: git-send-email 2.0.0 X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1, SHORTCIRCUIT=-0.0001 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There is no access to access a struct uart_8250_port for a specific line. This is only required outside of the 8250/uart callbacks like for devices' suspend & remove callbacks. For those the 8250-core provides wrapper like serial8250_unregister_port() which passes the struct to the proper function based on the line argument. For runtime suspend I need access to this struct not only to make serial_out() work but also to properly restore up->ier and up->mcr. Signed-off-by: Sebastian Andrzej Siewior --- drivers/tty/serial/8250/8250.h | 2 ++ drivers/tty/serial/8250/8250_core.c | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/drivers/tty/serial/8250/8250.h b/drivers/tty/serial/8250/8250.h index 1ebf853..34c3cd1 100644 --- a/drivers/tty/serial/8250/8250.h +++ b/drivers/tty/serial/8250/8250.h @@ -110,6 +110,8 @@ static inline void serial_dl_write(struct uart_8250_port *up, int value) up->dl_write(up, value); } +struct uart_8250_port *serial8250_get_port(int line); + #if defined(__alpha__) && !defined(CONFIG_PCI) /* * Digital did something really horribly wrong with the OUT1 and OUT2 diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c index 7a91c6d..0c90160 100644 --- a/drivers/tty/serial/8250/8250_core.c +++ b/drivers/tty/serial/8250/8250_core.c @@ -2755,6 +2755,12 @@ static struct uart_ops serial8250_pops = { static struct uart_8250_port serial8250_ports[UART_NR]; +struct uart_8250_port *serial8250_get_port(int line) +{ + return &serial8250_ports[line]; +} +EXPORT_SYMBOL_GPL(serial8250_get_port); + static void (*serial8250_isa_config)(int port, struct uart_port *up, unsigned short *capabilities);