From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9D55C43461 for ; Thu, 10 Sep 2020 09:33:54 +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 4BA71207EA for ; Thu, 10 Sep 2020 09:33:54 +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 4BA71207EA 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+linux-arm-kernel=archiver.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-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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.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), -- 2.7.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel