From patchwork Thu Dec 12 13:55:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 181487 Delivered-To: patch@linaro.org Received: by 2002:ac9:44c4:0:0:0:0:0 with SMTP id t4csp802490och; Thu, 12 Dec 2019 05:56:18 -0800 (PST) X-Google-Smtp-Source: APXvYqwjY6P8kLTJg+F0C1vUvY+nJrfI2uRB/5bFE4MvKOM99jAXf9lS421a/U8XPmCkerWi29bb X-Received: by 2002:a9d:4789:: with SMTP id b9mr7667892otf.247.1576158977934; Thu, 12 Dec 2019 05:56:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576158977; cv=none; d=google.com; s=arc-20160816; b=oCS5uXbye2aWV4CMoRSY03q0SirACEQzrZXPMlxe21pLR+D5l2H0bey6sABGZh14ac wXLyBSrlkzxF866oR6tAqK1zzQPTNTjBhRQ5egxsFY9GVSZj6wV695vRfgTU/B52cGng MQtyrnq+wGYtOH+Yk12uyZsXI+lXQ2jIpGpVFJ4jL7mMn/2diE4v1U/muq5uIwdPt2ON TGSZs5Q38jAn/PrRA8F9QUhKsIy1rJMqmEsmYIDJLNEZRf35bo/cHwy9cjCvbXgHfFbK iHPUYbfabVcjD8tlSxaw72dbG/tyES172/CAW/n8az5eEZ2WGJTAW/yYQmKulguaYTyW 6+sg== 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=Nf2gNb/jS/G6cUNn8sWiq6/8AS6dlAnuvnEznHwOdRM=; b=Q2l1OIB5mnWoCtmEF+qCDM9rU0MUcdkwjwqtRjVNZ7AmiHmgWQoMvn95irSln0ov7n uiGFEblND0VXuU6FkU1Sr+6Mmdgs+gwoYnuB5g/ZdZX6oSIItJ7yIFJOYQmdyMyi44kg SLONbXEJPa7Q7zFtVgDN5UKoYSfv+SnH6DBpejT3Bh/XoB2gTdHZQ/2rINvbPMqEgZgw RZUo86j7Dw5gCOJLuptSuvZePhRykvL7jaMqVwZHRN7YSQpXylPx9zf6FPsULvZxuXjc 83yS6uRW0pQvDlsmDKpZNgZNTUoNHuErdCwJylGhKHef2kWQ5TPCKQGObNgXUzXILdlF yxMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=k6uYh5bU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 r8si2890812otp.194.2019.12.12.05.56.17; Thu, 12 Dec 2019 05:56:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=k6uYh5bU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S1729608AbfLLN4Q (ORCPT + 27 others); Thu, 12 Dec 2019 08:56:16 -0500 Received: from lelv0142.ext.ti.com ([198.47.23.249]:56958 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729583AbfLLN4N (ORCPT ); Thu, 12 Dec 2019 08:56:13 -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 xBCDu0cx130447; Thu, 12 Dec 2019 07:56:00 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1576158960; bh=Nf2gNb/jS/G6cUNn8sWiq6/8AS6dlAnuvnEznHwOdRM=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=k6uYh5bU2/zzgvk7pRIgiuqGcu8mz94qs7oiyHD8Ih1TVnUuBzZR0/ZYEYBOLJvD3 XJeSkDnN29o+7pHzUZrULOcrPZZzPRix0f7nPfoUaU7u0oBzHz/PcxY6r1NFHfrijW JfD2AOjbCNWzyhkgJ82tPVSPrQBpJD3NkuEks8nE= Received: from DLEE107.ent.ti.com (dlee107.ent.ti.com [157.170.170.37]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id xBCDu071116442; Thu, 12 Dec 2019 07:56:00 -0600 Received: from DLEE111.ent.ti.com (157.170.170.22) by DLEE107.ent.ti.com (157.170.170.37) 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:59 -0600 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE111.ent.ti.com (157.170.170.22) 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:59 -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 xBCDtdqU048444; Thu, 12 Dec 2019 07:55:56 -0600 From: Peter Ujfalusi To: , , , , , , , , , CC: , , , , , Subject: [PATCH 4/9] spi: img-spfi: Use dma_request_chan() instead dma_request_slave_channel() Date: Thu, 12 Dec 2019 15:55:45 +0200 Message-ID: <20191212135550.4634-5-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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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-img-spfi.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 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-img-spfi.c b/drivers/spi/spi-img-spfi.c index f4a8f470aecc..8543f5ed1099 100644 --- a/drivers/spi/spi-img-spfi.c +++ b/drivers/spi/spi-img-spfi.c @@ -666,8 +666,22 @@ static int img_spfi_probe(struct platform_device *pdev) master->unprepare_message = img_spfi_unprepare; master->handle_err = img_spfi_handle_err; - spfi->tx_ch = dma_request_slave_channel(spfi->dev, "tx"); - spfi->rx_ch = dma_request_slave_channel(spfi->dev, "rx"); + spfi->tx_ch = dma_request_chan(spfi->dev, "tx"); + if (IS_ERR(spfi->tx_ch)) { + ret = PTR_ERR(spfi->tx_ch); + spfi->tx_ch = NULL; + if (ret == -EPROBE_DEFER) + goto disable_pm; + } + + spfi->rx_ch = dma_request_chan(spfi->dev, "rx"); + if (IS_ERR(spfi->rx_ch)) { + ret = PTR_ERR(spfi->rx_ch); + spfi->rx_ch = NULL; + if (ret == -EPROBE_DEFER) + goto disable_pm; + } + if (!spfi->tx_ch || !spfi->rx_ch) { if (spfi->tx_ch) dma_release_channel(spfi->tx_ch); From patchwork Thu Dec 12 13:55:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 181488 Delivered-To: patch@linaro.org Received: by 2002:ac9:44c4:0:0:0:0:0 with SMTP id t4csp802550och; Thu, 12 Dec 2019 05:56:22 -0800 (PST) X-Google-Smtp-Source: APXvYqxkeW4AYtRUdqTLn1koqt4oU/L8YdfIp+LjdiP7iUo7nBQDfSAFLuqE4GJIBhqiI5FDSzmK X-Received: by 2002:a05:6830:1d6e:: with SMTP id l14mr8250320oti.32.1576158982111; Thu, 12 Dec 2019 05:56:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576158982; cv=none; d=google.com; s=arc-20160816; b=puwcAoU7rvTqpdxrqLlvrB2Lh+BCC58JOlSwW+I821SECHLkS7An0qDECZ1BUu3FA2 52UMCLxYZMAUEdwqbVZz2k/WP3aeO9Qy9mrHzTEc+2luqFHWArEfBLRDxrBuD13v3ucM eFdUahWLVnVjahAUAWx67BwImT4lwed0sTHg8Nlf6NlKqhswEiHwvxjxVsTxYMWjdtDL bexI5rRNeHhNm668eKD1nf6rCd6HTn8UUvMsdQpzrYYle7BetmQ0s5JzECiBBwnpyBlS oQl5cKDrKFbpAefnbOVEkdmep9yBaULJWm6wGcwa3JyCVYM9ErfWYqeAKaikHaCABoHZ /LPA== 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=HGBMZDd/fXGaR9XHTtH6bBkw3hSH9Gfrrw4s8QFXfZY=; b=K/qIxY/6POeBdK27Gjv1WWdr2EV9+oZ/MZriP3os39C6XjMOCY/n7voK5GJ1MkusUM 07TRRXGXBPK9zUeHZJSP9Of6BCmTxxsp7mgjkQHUFjhyUMc1TZkcuEY3ZXtHhYvEBU4+ hFhArzJT4DWfot0PC1Nb2y7ixmm/r14By9iKh2/cO1f9hWxevol2BugTJxxLkDzoOjtA DyX/Fje7LXlUbn9PPIEuoxL8b6XvYSLSXPTDrxIBbrV16NfprJZEp/YnKqHb0hiQ8O+I lp7NDI5Nd8+VlJVlbUV4D4NEf6WSwtUksMEVdLseEnvm6aWPKLmxdCuy8OlwRsCj90SO NXmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Mp5zn8V3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 r8si2890812otp.194.2019.12.12.05.56.21; Thu, 12 Dec 2019 05:56:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=Mp5zn8V3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S1729618AbfLLN4V (ORCPT + 27 others); Thu, 12 Dec 2019 08:56:21 -0500 Received: from fllv0015.ext.ti.com ([198.47.19.141]:49768 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729583AbfLLN4S (ORCPT ); Thu, 12 Dec 2019 08:56:18 -0500 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id xBCDu3Fc122268; Thu, 12 Dec 2019 07:56:03 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1576158964; bh=HGBMZDd/fXGaR9XHTtH6bBkw3hSH9Gfrrw4s8QFXfZY=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Mp5zn8V3y+JCkRTFQX9D4mJyoF/9IMo/SZliZ6Q1ilN0xwg9nT0LtLs/homGizKXQ NGxV+c73C2myeHlpqiY1BSJI5kQIhTC0hRNK2WJqYyqkybZzwaerhv8U+ZQmySjAKt JBi65Q7mlbFzS5dy/sxwtQWmhwUe0WyXaJHXfO0k= Received: from DLEE100.ent.ti.com (dlee100.ent.ti.com [157.170.170.30]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id xBCDu3jh019465 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 12 Dec 2019 07:56:03 -0600 Received: from DLEE110.ent.ti.com (157.170.170.21) by DLEE100.ent.ti.com (157.170.170.30) 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:56:03 -0600 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE110.ent.ti.com (157.170.170.21) 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:56:03 -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 xBCDtdqV048444; Thu, 12 Dec 2019 07:55:59 -0600 From: Peter Ujfalusi To: , , , , , , , , , CC: , , , , , Subject: [PATCH 5/9] spi: mxs: Use dma_request_chan() instead dma_request_slave_channel() Date: Thu, 12 Dec 2019 15:55:46 +0200 Message-ID: <20191212135550.4634-6-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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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-mxs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 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-mxs.c b/drivers/spi/spi-mxs.c index 996c1c8a9c71..dce85ee07cd0 100644 --- a/drivers/spi/spi-mxs.c +++ b/drivers/spi/spi-mxs.c @@ -590,10 +590,10 @@ static int mxs_spi_probe(struct platform_device *pdev) if (ret) goto out_master_free; - ssp->dmach = dma_request_slave_channel(&pdev->dev, "rx-tx"); - if (!ssp->dmach) { + ssp->dmach = dma_request_chan(&pdev->dev, "rx-tx"); + if (IS_ERR(ssp->dmach)) { dev_err(ssp->dev, "Failed to request DMA\n"); - ret = -ENODEV; + ret = PTR_ERR(ssp->dmach); goto out_master_free; }