From patchwork Thu Dec 12 13:55:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 181484 Delivered-To: patch@linaro.org Received: by 2002:ac9:44c4:0:0:0:0:0 with SMTP id t4csp802293och; Thu, 12 Dec 2019 05:56:06 -0800 (PST) X-Google-Smtp-Source: APXvYqxGrBpdW7CsxxvMVP03YQ+FsBc96Y311oUFskVy1DQj9wrgP7pjLjlOf8xGzY+JJlpUu0Jl X-Received: by 2002:a9d:7342:: with SMTP id l2mr8245293otk.98.1576158965952; Thu, 12 Dec 2019 05:56:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576158965; cv=none; d=google.com; s=arc-20160816; b=H1HWIdexpcfGmcaxZ36k7I7+wBfjsneu/ngLSAZd5BCFHDL3Wiuj1nALnB4LPT1gd2 GDEFfO+g12JsrkcDqiMNsqx0STpjlfQE4P5lCgsZ5HYC+H9rYG5jH7mgVNCIsDAJRl3p Xph5y+g1T1LBqCZRVsz7u+FBu4d2Bf89BtnDLLID18djx7QYd2/5xw3hy389aCpebw2d i2WJXIzy6t63WsE/qdDGxuoCktgunkB9sOW1QtsQ4vrOPgW9wm8WhkVsGc6e0IcBT3Nz z/XPSF9Suf5NnQnJSOx4dDMmApV1Xul7ANVEEDJyQfP8L3vk/OaXMM8zLPDZDV5IeyOW wr9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3gLGICxAzTQwTc/DkihTZhEXH6qumJS8Bb6FHHUYzCY=; b=B5/RCNTKlkJ9M/ben0JNjvkp73DHBOMKHoLkMCwkuspuwWOIQtKszaGYO6zdlHrw4I 8FE/QDxoAPr7iTvRCnm/NWJ5VUGm2GzAZMhmYExhVAUxcZ1lma7lCJ0l1Y7OFX6pw29b sHXTBDTnyhcplF0AYpPN3jEmBiZNUXXlIMM/l3zVrej/sE5VeoTKUwVv+QlgA79HsVoj z5NOcpnxDlQ2QRb4rh2R9tjQ+OLd2tGlNbteswTC1g+RinuE+do7owiWa2a9AMDkbRGe b3pvrMLi8b5tpxDoImp5xBMiWk/5bhTvhjE0SSGBgS5putKcjLkVlYj8mdzGDgUebgna SexQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=ZqyfX6ql; spf=pass (google.com: best guess record for domain of linux-spi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-spi-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v26si3122000otj.0.2019.12.12.05.56.05; Thu, 12 Dec 2019 05:56:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-spi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=ZqyfX6ql; spf=pass (google.com: best guess record for domain of linux-spi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-spi-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729523AbfLLN4F (ORCPT + 2 others); Thu, 12 Dec 2019 08:56:05 -0500 Received: from lelv0142.ext.ti.com ([198.47.23.249]:56930 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729465AbfLLN4F (ORCPT ); Thu, 12 Dec 2019 08:56:05 -0500 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id xBCDtmCj130390; Thu, 12 Dec 2019 07:55:48 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1576158948; bh=3gLGICxAzTQwTc/DkihTZhEXH6qumJS8Bb6FHHUYzCY=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=ZqyfX6ql8GX4aJtV6oPEPl3Z5XmrYLPR/tKcuub+H+f5XcD2+sZbfxPHww3j1HtAk UROBweX/WDXlNJKJoN8bU5Z4BCYDe4KZ9OrtdyGsse4nIIYOLRKNhAnGBjkpdIA3Nv D1UWa6yx/NB7bmQPQT3EbftiiJt8c1PA2SU/k1RY= Received: from DFLE101.ent.ti.com (dfle101.ent.ti.com [10.64.6.22]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id xBCDtmVE116297; Thu, 12 Dec 2019 07:55:48 -0600 Received: from DFLE102.ent.ti.com (10.64.6.23) by DFLE101.ent.ti.com (10.64.6.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3; Thu, 12 Dec 2019 07:55:47 -0600 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE102.ent.ti.com (10.64.6.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3 via Frontend Transport; Thu, 12 Dec 2019 07:55:47 -0600 Received: from feketebors.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id xBCDtdqR048444; Thu, 12 Dec 2019 07:55:44 -0600 From: Peter Ujfalusi To: , , , , , , , , , CC: , , , , , Subject: [PATCH 1/9] spi: atmel: Use dma_request_chan() instead dma_request_slave_channel() Date: Thu, 12 Dec 2019 15:55:42 +0200 Message-ID: <20191212135550.4634-2-peter.ujfalusi@ti.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191212135550.4634-1-peter.ujfalusi@ti.com> References: <20191212135550.4634-1-peter.ujfalusi@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org dma_request_slave_channel() is a wrapper on top of dma_request_chan() eating up the error code. By using dma_request_chan() directly the driver can support deferred probing against DMA. Signed-off-by: Peter Ujfalusi --- drivers/spi/spi-atmel.c | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) -- Peter Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c index 56f0ca361deb..013458cabe3c 100644 --- a/drivers/spi/spi-atmel.c +++ b/drivers/spi/spi-atmel.c @@ -514,26 +514,19 @@ static int atmel_spi_configure_dma(struct spi_master *master, master->dma_tx = dma_request_chan(dev, "tx"); if (IS_ERR(master->dma_tx)) { err = PTR_ERR(master->dma_tx); - if (err == -EPROBE_DEFER) { - dev_warn(dev, "no DMA channel available at the moment\n"); - goto error_clear; - } - dev_err(dev, - "DMA TX channel not available, SPI unable to use DMA\n"); - err = -EBUSY; + if (err != -EPROBE_DEFER) + dev_err(dev, "No TX DMA channel, DMA is disabled\n"); goto error_clear; } - /* - * No reason to check EPROBE_DEFER here since we have already requested - * tx channel. If it fails here, it's for another reason. - */ - master->dma_rx = dma_request_slave_channel(dev, "rx"); - - if (!master->dma_rx) { - dev_err(dev, - "DMA RX channel not available, SPI unable to use DMA\n"); - err = -EBUSY; + master->dma_rx = dma_request_chan(dev, "rx"); + if (IS_ERR(master->dma_rx)) { + err = PTR_ERR(master->dma_rx); + /* + * No reason to check EPROBE_DEFER here since we have already + * requested tx channel. + */ + dev_err(dev, "No RX DMA channel, DMA is disabled\n"); goto error; } @@ -548,7 +541,7 @@ static int atmel_spi_configure_dma(struct spi_master *master, return 0; error: - if (master->dma_rx) + if (!IS_ERR(master->dma_rx)) dma_release_channel(master->dma_rx); if (!IS_ERR(master->dma_tx)) dma_release_channel(master->dma_tx);