From patchwork Thu Jul 16 18:21:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 6810271 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D750BC05AC for ; Thu, 16 Jul 2015 18:22:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E033D20673 for ; Thu, 16 Jul 2015 18:22:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D8D7620674 for ; Thu, 16 Jul 2015 18:22:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752344AbbGPSWT (ORCPT ); Thu, 16 Jul 2015 14:22:19 -0400 Received: from michel.telenet-ops.be ([195.130.137.88]:49769 "EHLO michel.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756210AbbGPSWE (ORCPT ); Thu, 16 Jul 2015 14:22:04 -0400 Received: from ayla.of.borg ([84.193.93.87]) by michel.telenet-ops.be with bizsmtp id t6N21q0101t5w8s066N2q9; Thu, 16 Jul 2015 20:22:03 +0200 Received: from ramsan.of.borg ([192.168.97.29] helo=ramsan) by ayla.of.borg with esmtp (Exim 4.82) (envelope-from ) id 1ZFnnF-000089-TI; Thu, 16 Jul 2015 20:22:02 +0200 Received: from geert by ramsan with local (Exim 4.82) (envelope-from ) id 1ZFnnH-0007Kk-0T; Thu, 16 Jul 2015 20:22:03 +0200 From: Geert Uytterhoeven To: Magnus Damm , Laurent Pinchart , Nobuhiro Iwamatsu , Yoshihiro Kaneko , Kazuya Mizuguchi , Koji Matsuoka , Wolfram Sang , Guennadi Liakhovetski Cc: linux-sh@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH/RFC v2 10/29] serial: sh-sci: Improve DMA error messages Date: Thu, 16 Jul 2015 20:21:41 +0200 Message-Id: <1437070920-28069-11-git-send-email-geert+renesas@glider.be> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1437070920-28069-1-git-send-email-geert+renesas@glider.be> References: <1437070920-28069-1-git-send-email-geert+renesas@glider.be> Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-8.2 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 Make the life of the driver developer/debugger easier: - Add __func__ prefix to identical messages, - Add DMA directions to messages, - Add TX failure messages, - Always use "cookie %d" for DMA cookies, - "#%d" is reserved for the DMA cookie/descriptor index. Signed-off-by: Geert Uytterhoeven --- v2: - Add "cookie %d" and ""#%d" consistency. --- drivers/tty/serial/sh-sci.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index 36a1d1735dd562cd..2156fc914bea0a50 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -1323,7 +1323,8 @@ static int sci_dma_rx_push(struct sci_port *s, size_t count) } else if (s->active_rx == s->cookie_rx[1]) { active = 1; } else { - dev_err(port->dev, "cookie %d not found!\n", s->active_rx); + dev_err(port->dev, "%s: Rx cookie %d not found!\n", __func__, + s->active_rx); return 0; } @@ -1349,8 +1350,8 @@ static void sci_dma_rx_complete(void *arg) unsigned long flags; int count; - dev_dbg(port->dev, "%s(%d) active #%d\n", - __func__, port->line, s->active_rx); + dev_dbg(port->dev, "%s(%d) active cookie %d\n", __func__, port->line, + s->active_rx); spin_lock_irqsave(&port->lock, flags); @@ -1433,12 +1434,12 @@ static void sci_submit_rx(struct sci_port *s) s->cookie_rx[i] = -EINVAL; } dev_warn(s->port.dev, - "failed to re-start DMA, using PIO\n"); + "Failed to re-start Rx DMA, using PIO\n"); sci_rx_dma_release(s, true); return; } - dev_dbg(s->port.dev, "%s(): cookie %d to #%d\n", - __func__, s->cookie_rx[i], i); + dev_dbg(s->port.dev, "%s(): cookie %d to #%d\n", __func__, + s->cookie_rx[i], i); } s->active_rx = s->cookie_rx[0]; @@ -1458,7 +1459,8 @@ static void work_fn_rx(struct work_struct *work) } else if (s->active_rx == s->cookie_rx[1]) { new = 1; } else { - dev_err(port->dev, "cookie %d not found!\n", s->active_rx); + dev_err(port->dev, "%s: Rx cookie %d not found!\n", __func__, + s->active_rx); return; } desc = s->desc_rx[new]; @@ -1497,7 +1499,7 @@ static void work_fn_rx(struct work_struct *work) s->active_rx = s->cookie_rx[!new]; - dev_dbg(port->dev, "%s: cookie %d #%d, new active #%d\n", + dev_dbg(port->dev, "%s: cookie %d #%d, new active cookie %d\n", __func__, s->cookie_rx[new], new, s->active_rx); } @@ -1532,6 +1534,7 @@ static void work_fn_tx(struct work_struct *work) sg, s->sg_len_tx, DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT | DMA_CTRL_ACK); if (!desc) { + dev_warn(port->dev, "Failed preparing Tx DMA descriptor\n"); /* switch to PIO */ sci_tx_dma_release(s, true); return; @@ -1718,13 +1721,15 @@ static void sci_request_dma(struct uart_port *port) sg_init_one(&s->sg_tx, port->state->xmit.buf, UART_XMIT_SIZE); nent = dma_map_sg(chan->device->dev, &s->sg_tx, 1, DMA_TO_DEVICE); - if (!nent) + if (!nent) { + dev_warn(port->dev, "Failed mapping Tx DMA descriptor\n"); sci_tx_dma_release(s, false); - else + } else { dev_dbg(port->dev, "%s: mapped %d@%p to %pad\n", __func__, sg_dma_len(&s->sg_tx), port->state->xmit.buf, &sg_dma_address(&s->sg_tx)); + } s->sg_len_tx = nent; @@ -1752,7 +1757,7 @@ static void sci_request_dma(struct uart_port *port) if (!buf[0]) { dev_warn(port->dev, - "failed to allocate dma buffer, using PIO\n"); + "Failed to allocate Rx dma buffer, using PIO\n"); sci_rx_dma_release(s, true); return; }