From patchwork Thu Jan 5 08:09:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: M'boumba Cedric Madianga X-Patchwork-Id: 9498597 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6F150606DE for ; Thu, 5 Jan 2017 08:10:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5EEE628066 for ; Thu, 5 Jan 2017 08:10:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 53DD228138; Thu, 5 Jan 2017 08:10:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2C7C328156 for ; Thu, 5 Jan 2017 08:10:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031441AbdAEIKK (ORCPT ); Thu, 5 Jan 2017 03:10:10 -0500 Received: from mail-wj0-f193.google.com ([209.85.210.193]:33730 "EHLO mail-wj0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1761060AbdAEIJz (ORCPT ); Thu, 5 Jan 2017 03:09:55 -0500 Received: by mail-wj0-f193.google.com with SMTP id kp2so78183709wjc.0; Thu, 05 Jan 2017 00:09:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=3fqbdjehfKmSRBS9Zc9vT+nQIQI/8KlWWo6FSNSXsI0=; b=pCuhQ/wBGQ5CY07G6tCQSG1+XxlZgn9TT+Q7ysX/rw4r5IFzPooqF3tir0Pq6Pim31 QoyoWv0yPABj7ppR6G3yolGsB4+T57l8RPtxbpeTEN57VbYk9rJiKt/dYJqa8PMpjhw1 PiXyC4dHI15+z83IB+V3jxB8IwK5sbxqPnVlBST2o+fx5370F0nLeICCkylJOXbrZWkE r420jeXrK0lBniiDgLDu5sL1R6BwHwZ37o/+yKkRTwqgpEFMFzCarXizU82Ot3BLJkA3 eRvgJxoN55F0C74kw+jSuZLlKboxtfhFGsqLU801p1THi5vJeIIHrKD7RR5RqB5rlGIr h9KA== 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; bh=3fqbdjehfKmSRBS9Zc9vT+nQIQI/8KlWWo6FSNSXsI0=; b=uiSxLalvJlP4ACUZxXL4Zvq7/eRwxsuL/l3iScgRjgdDf9rkn5FmampGUg9TU1N9V0 j/KVaRrBTrU0CKWlmcU1T4KLWzGjMimN7qz08lp4TfMX8oU+4P4sS9ZXwkcLTNGqrOCY Hm+8hX775uOWCOuNpkBer9ofk0FLqqzGzXqo+RLkX0HxnedpkGj9qQ0AjCyYvQ5lKJMo hFHmK446aDY7sC7pNREmkCtbJxcItkP5Xjs/EofAjnMxN/ctkZwRWd1m1+MjWc1NoYEp NJ/WO4t3158VDJCfjes1qOWusYcMke6QxmB5kpoA7pxM+mmkF0wYsDKlJ8LxqlnJusDi IuNA== X-Gm-Message-State: AIkVDXKi0AnihD/Mgpw4u3ncr/ARas937+SrqSW2gy4bKpDK5hnnqLIK6I2nseHJmxbyaA== X-Received: by 10.194.8.226 with SMTP id u2mr59608941wja.91.1483603793939; Thu, 05 Jan 2017 00:09:53 -0800 (PST) Received: from lmenx29w.st.com. ([37.166.177.121]) by smtp.gmail.com with ESMTPSA id ia7sm102017416wjb.23.2017.01.05.00.09.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 05 Jan 2017 00:09:53 -0800 (PST) From: M'boumba Cedric Madianga To: vinod.koul@intel.com, robh+dt@kernel.org, mark.rutland@arm.com, mcoquelin.stm32@gmail.com, alexandre.torgue@st.com, dan.j.williams@intel.com, dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: M'boumba Cedric Madianga Subject: [PATCH RESEND] dmaengine: stm32-dma: Add error messages if xlate fails Date: Thu, 5 Jan 2017 09:09:40 +0100 Message-Id: <1483603780-3368-1-git-send-email-cedric.madianga@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds some error messages when a slave device fails to request a channel. Signed-off-by: M'boumba Cedric Madianga Reviewed-by: Ludovic BARRE --- Resolve conflicts issue --- drivers/dma/stm32-dma.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/drivers/dma/stm32-dma.c b/drivers/dma/stm32-dma.c index fc9738e..4eacd9d 100644 --- a/drivers/dma/stm32-dma.c +++ b/drivers/dma/stm32-dma.c @@ -987,30 +987,36 @@ static struct dma_chan *stm32_dma_of_xlate(struct of_phandle_args *dma_spec, struct of_dma *ofdma) { struct stm32_dma_device *dmadev = ofdma->of_dma_data; + struct device *dev = dmadev->ddev.dev; struct stm32_dma_cfg cfg; struct stm32_dma_chan *chan; struct dma_chan *c; - if (dma_spec->args_count < 3) + if (dma_spec->args_count < 4) { + dev_err(dev, "Bad number of cells\n"); return NULL; + } cfg.channel_id = dma_spec->args[0]; cfg.request_line = dma_spec->args[1]; cfg.stream_config = dma_spec->args[2]; - cfg.threshold = 0; + cfg.threshold = dma_spec->args[3]; - if ((cfg.channel_id >= STM32_DMA_MAX_CHANNELS) || (cfg.request_line >= - STM32_DMA_MAX_REQUEST_ID)) + if ((cfg.channel_id >= STM32_DMA_MAX_CHANNELS) || + (cfg.request_line >= STM32_DMA_MAX_REQUEST_ID)) { + dev_err(dev, "Bad channel and/or request id\n"); return NULL; - - if (dma_spec->args_count > 3) - cfg.threshold = dma_spec->args[3]; + } chan = &dmadev->chan[cfg.channel_id]; c = dma_get_slave_channel(&chan->vchan.chan); - if (c) - stm32_dma_set_config(chan, &cfg); + if (!c) { + dev_err(dev, "No more channel avalaible\n"); + return NULL; + } + + stm32_dma_set_config(chan, &cfg); return c; }