From patchwork Thu Sep 10 09:32:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alain Volmat X-Patchwork-Id: 11767259 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D49E2698 for ; Thu, 10 Sep 2020 09:34:01 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 95AA0207EA for ; Thu, 10 Sep 2020 09:33:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="YDgUd9ij"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=st.com header.i=@st.com header.b="qhQd43AV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 95AA0207EA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=st.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=Vf4no9cJXyFbVdNk94xGFZAL7zvPPCKo6e+wPP6s+Hg=; b=YDgUd9ijcmAj7bfo0VA5Kfl0qI kSXN2p2lrNh6+m29GOTTZYHC3mSGfCDKNSvzPYukeq+g2rjl26EtfhQdcCi27edrRUtS/+U6D6/Je PuF2lLsoOmJmR/34UQYTRb7tcqn9oo7FYqLQ7s0XO9IE6PTzALWpXRLVpJML/BwRKdJvEXqHyDQBO HoJxGHaIH0jvthTaDtVAp+7qpElXl8ViKM5FoKMvEZfLEIwtFbXCUdKKp6ZHL5doUDoFl+88CzZYx rSgW2qwDDMYw6AfxNAGO3ut/NtTa+jUhCUtLWHhljeThzRL4MxHYEIkSU/PMopMr7Q63ei/EvT0sU sOpGKDmA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kGIwX-0000Tj-CR; Thu, 10 Sep 2020 09:32:37 +0000 Received: from mx07-00178001.pphosted.com ([185.132.182.106]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kGIwU-0000Sw-M6 for linux-arm-kernel@lists.infradead.org; Thu, 10 Sep 2020 09:32:35 +0000 Received: from pps.filterd (m0046037.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 08A9QfoN032717; Thu, 10 Sep 2020 11:32:30 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=STMicroelectronics; bh=+COKLz+6WybyodfwHJziasnDtJLeiuO/fCZoNZW0ReY=; b=qhQd43AVtcAtVe1yYjZgrjJKsZeHIsn1fMqBGqkh+uy30fFquTmT/YHAAL1uGSygckVw J7GZh0ITHhQ1o0Grnr2Mz/GrSIWVo8cDQzyUFEmOdptjbUpQBxUmO36gpqiCCIofoDaq qI4Tq3/x5tgZfSrvhIP1TejKWVHFsVjUdzxYmUnwie6MGn1YweQrgtMhfqbCcX3YUFUY vLvcQk63RKwJUMrTnNGbHUXBSx2SGM6MX7iP0T6zQL3iPXIc40IMcumcPhURaDx/Ls1t X+6t92qT2TPCZni9udW0lPvH8lKdoSunFHLFeD+CtL6vbsnZpEZ5XEbM5rPWtcDEof0L Pw== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 33c0ev27vd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 10 Sep 2020 11:32:29 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 7F34C10002A; Thu, 10 Sep 2020 11:32:29 +0200 (CEST) Received: from Webmail-eu.st.com (gpxdag3node5.st.com [10.75.127.72]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 756DB21CA68; Thu, 10 Sep 2020 11:32:29 +0200 (CEST) Received: from localhost (10.75.127.50) by GPXDAG3NODE5.st.com (10.75.127.72) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 10 Sep 2020 11:32:28 +0200 From: Alain Volmat To: , Subject: [PATCH] i2c: stm32: do not display error when DMA is not requested Date: Thu, 10 Sep 2020 11:32:29 +0200 Message-ID: <1599730349-2160-1-git-send-email-alain.volmat@st.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [10.75.127.50] X-ClientProxiedBy: SFHDAG8NODE3.st.com (10.75.127.24) To GPXDAG3NODE5.st.com (10.75.127.72) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-09-10_01:2020-09-10, 2020-09-10 signatures=0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200910_053234_976496_A248AA5A X-CRM114-Status: GOOD ( 22.18 ) X-Spam-Score: -0.9 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [185.132.182.106 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alexandre.torgue@st.com, linux-kernel@vger.kernel.org, alain.volmat@st.com, linux-i2c@vger.kernel.org, fabrice.gasnier@st.com, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DMA usage is optional for the I2C driver. check for the -ENODEV error in order to avoid displaying an error when no DMA has been requested. Signed-off-by: Alain Volmat --- This patch should be applied on top of the patch [i2c: stm32: Simplify with dev_err_probe()] --- drivers/i2c/busses/i2c-stm32.c | 16 ++++++++++------ drivers/i2c/busses/i2c-stm32f7.c | 5 +++++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/drivers/i2c/busses/i2c-stm32.c b/drivers/i2c/busses/i2c-stm32.c index 198f848b7be9..91767156d63d 100644 --- a/drivers/i2c/busses/i2c-stm32.c +++ b/drivers/i2c/busses/i2c-stm32.c @@ -25,8 +25,11 @@ struct stm32_i2c_dma *stm32_i2c_dma_request(struct device *dev, /* Request and configure I2C TX dma channel */ dma->chan_tx = dma_request_chan(dev, "tx"); if (IS_ERR(dma->chan_tx)) { - ret = dev_err_probe(dev, PTR_ERR(dma->chan_tx), - "can't request DMA tx channel\n"); + if (PTR_ERR(dma->chan_tx) == -ENODEV) + ret = PTR_ERR(dma->chan_tx); + else + ret = dev_err_probe(dev, PTR_ERR(dma->chan_tx), + "can't request DMA tx channel\n"); goto fail_al; } @@ -44,8 +47,11 @@ struct stm32_i2c_dma *stm32_i2c_dma_request(struct device *dev, /* Request and configure I2C RX dma channel */ dma->chan_rx = dma_request_chan(dev, "rx"); if (IS_ERR(dma->chan_rx)) { - ret = dev_err_probe(dev, PTR_ERR(dma->chan_rx), - "can't request DMA rx channel\n"); + if (PTR_ERR(dma->chan_tx) == -ENODEV) + ret = PTR_ERR(dma->chan_tx); + else + ret = dev_err_probe(dev, PTR_ERR(dma->chan_rx), + "can't request DMA rx channel\n"); goto fail_tx; } @@ -73,8 +79,6 @@ struct stm32_i2c_dma *stm32_i2c_dma_request(struct device *dev, dma_release_channel(dma->chan_tx); fail_al: devm_kfree(dev, dma); - if (ret != -EPROBE_DEFER) - dev_info(dev, "can't use DMA\n"); return ERR_PTR(ret); } diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c index a8f1758e4c5b..58f342aea3c1 100644 --- a/drivers/i2c/busses/i2c-stm32f7.c +++ b/drivers/i2c/busses/i2c-stm32f7.c @@ -2049,6 +2049,11 @@ static int stm32f7_i2c_probe(struct platform_device *pdev) STM32F7_I2C_TXDR, STM32F7_I2C_RXDR); if (PTR_ERR(i2c_dev->dma) == -ENODEV) { + /* + * DMA usage is not mandatory for the I2C, it is not an error + * to receive -ENODEV + */ + dev_dbg(i2c_dev->dev, "not using DMA\n"); i2c_dev->dma = NULL; } else if (IS_ERR(i2c_dev->dma)) { ret = dev_err_probe(&pdev->dev, PTR_ERR(i2c_dev->dma),