From patchwork Mon Apr 21 16:40:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 4025741 Return-Path: X-Original-To: patchwork-linux-samsung-soc@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 DBD4ABFF02 for ; Mon, 21 Apr 2014 16:41:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 10E312021B for ; Mon, 21 Apr 2014 16:41:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 377E720213 for ; Mon, 21 Apr 2014 16:41:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752052AbaDUQlZ (ORCPT ); Mon, 21 Apr 2014 12:41:25 -0400 Received: from mail-vc0-f201.google.com ([209.85.220.201]:56648 "EHLO mail-vc0-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753132AbaDUQkk (ORCPT ); Mon, 21 Apr 2014 12:40:40 -0400 Received: by mail-vc0-f201.google.com with SMTP id ik5so152834vcb.0 for ; Mon, 21 Apr 2014 09:40:39 -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; bh=1y266+UIJtgF8qvEzNLjsAQWN3/o9FpwNHh+tgh9R9w=; b=FxqbAv3rBq05QufvOTI9/8GUwR+bBImuDfPlhHwuMbQ2JOhttbcCk3wYJjczulKR2Q Kq5lYOjb6XmHL69ef9z6CdIgEgc5fz8A+KyRiSClk4i+gQq/GkG83q3C1XUw8SlZsC2g s3kXtQtgaqk7cAj5v6xfydGbbPp9TjUMpBTxIp43MGcC/GFjevskR29t61arRFtMK8e2 oaWRPk+ceFQkTOP49Y7/pqQY0F5ZUQLVPLWAd07ckffGfpC4OdMs2bgximLoTwu1SwfR BY+q6n5NtRBpoJwvsTk1gihcu9/MiG5I8pkJq8FhRAJeYLu7MXOG8C+wqJeVoR50dZbz 9qhA== X-Gm-Message-State: ALoCoQlSyHAeHOeu/8+KtKSuKT47tXlCHGsYEm3PSaetE59KwepNK/1WsY0mopqgm6yl91l+bF6+e+/Xf8jEjIe51thDkNkQjxOJCnepANdfeGbSEXU1oyI0/g4ZZnfUlpymP87IZ9ikccKnG8dpdyoi5x2aCWf462oCw2CehmVI6wtkl2LqGovARJ9zCQbPNctF70O8iU8uJs53AYXzcCLSXASFVUgeWg== X-Received: by 10.58.196.209 with SMTP id io17mr19926705vec.7.1398098439546; Mon, 21 Apr 2014 09:40:39 -0700 (PDT) Received: from corp2gmr1-1.hot.corp.google.com (corp2gmr1-1.hot.corp.google.com [172.24.189.92]) by gmr-mx.google.com with ESMTPS id f65si5233131yhg.7.2014.04.21.09.40.39 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 21 Apr 2014 09:40:39 -0700 (PDT) Received: from tictac.mtv.corp.google.com (tictac.mtv.corp.google.com [172.22.72.141]) by corp2gmr1-1.hot.corp.google.com (Postfix) with ESMTP id 6284D31C269; Mon, 21 Apr 2014 09:40:39 -0700 (PDT) Received: by tictac.mtv.corp.google.com (Postfix, from userid 121310) id 02022806E2; Mon, 21 Apr 2014 09:40:38 -0700 (PDT) From: Doug Anderson To: Greg Kroah-Hartman , linux-samsung-soc@vger.kernel.org Cc: olof@lixom.net, Doug Anderson , jslaby@suse.cz, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] serial: samsung: Use the passed in "port", fixing kgdb w/ no console Date: Mon, 21 Apr 2014 09:40:34 -0700 Message-Id: <1398098436-31895-1-git-send-email-dianders@chromium.org> X-Mailer: git-send-email 1.9.1.423.g4596e3a Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 The two functions in the samsung serial driver used for writing characters out to the port were inconsistent about whether they used the passed in "port" or the global "cons_uart". There was no reason to use the global and the use of the global in s3c24xx_serial_put_poll_char() caused a crash in the case where you used the serial port for kgdboc but not for console. Fix it so we used the passed in variable. Note that this doesn't fix all problems with the samsung serial driver. Specifically: * s3c24xx_serial_console_putchar() is still 99% identical to s3c24xx_serial_put_poll_char() (the function signature is different, but that's about it). A future patch will make them slightly less identical and judging by other serial drivers we may need yet more differences eventually. * The samsung serial driver still doesn't allow you to have more than one console port since it still uses the global cons_uart in s3c24xx_serial_console_write(). Signed-off-by: Doug Anderson --- drivers/tty/serial/samsung.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c index 23f4596..a8e8b79 100644 --- a/drivers/tty/serial/samsung.c +++ b/drivers/tty/serial/samsung.c @@ -1446,8 +1446,8 @@ static int s3c24xx_serial_get_poll_char(struct uart_port *port) static void s3c24xx_serial_put_poll_char(struct uart_port *port, unsigned char c) { - unsigned int ufcon = rd_regl(cons_uart, S3C2410_UFCON); - unsigned int ucon = rd_regl(cons_uart, S3C2410_UCON); + unsigned int ufcon = rd_regl(port, S3C2410_UFCON); + unsigned int ucon = rd_regl(port, S3C2410_UCON); /* not possible to xmit on unconfigured port */ if (!s3c24xx_port_configured(ucon)) @@ -1455,7 +1455,7 @@ static void s3c24xx_serial_put_poll_char(struct uart_port *port, while (!s3c24xx_serial_console_txrdy(port, ufcon)) cpu_relax(); - wr_regb(cons_uart, S3C2410_UTXH, c); + wr_regb(port, S3C2410_UTXH, c); } #endif /* CONFIG_CONSOLE_POLL */ @@ -1463,8 +1463,8 @@ static void s3c24xx_serial_put_poll_char(struct uart_port *port, static void s3c24xx_serial_console_putchar(struct uart_port *port, int ch) { - unsigned int ufcon = rd_regl(cons_uart, S3C2410_UFCON); - unsigned int ucon = rd_regl(cons_uart, S3C2410_UCON); + unsigned int ufcon = rd_regl(port, S3C2410_UFCON); + unsigned int ucon = rd_regl(port, S3C2410_UCON); /* not possible to xmit on unconfigured port */ if (!s3c24xx_port_configured(ucon)) @@ -1472,7 +1472,7 @@ s3c24xx_serial_console_putchar(struct uart_port *port, int ch) while (!s3c24xx_serial_console_txrdy(port, ufcon)) barrier(); - wr_regb(cons_uart, S3C2410_UTXH, ch); + wr_regb(port, S3C2410_UTXH, ch); } static void