From patchwork Tue Dec 17 10:52:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 181858 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp5569504ile; Tue, 17 Dec 2019 02:52:41 -0800 (PST) X-Google-Smtp-Source: APXvYqz90qe6zL/XueS/flyKwE6qShJhWOHYq55F2S3NKUNmBiIYLE2X4GZVx3wscqRVHY3hV+9A X-Received: by 2002:a9d:6b06:: with SMTP id g6mr37365429otp.93.1576579961073; Tue, 17 Dec 2019 02:52:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576579961; cv=none; d=google.com; s=arc-20160816; b=X4OmTUK9SSVb3ffeyNkr5sWs/VF2vCf24mWTiGiY3q7B4tqnzSOVW1cw3ajoBC62SB PQauHOaQQQp10zKFHpW+NoNTu/XpvXfS531+yc16AORVW0ZdHkB352bN76EPv8zHPus/ 8q3f/U6biXEdod8np7DodKydrTvL1EFjQp88qxAx0vcqJkijbpvsAZPxjkR6RwGntjrW dAvXc15MAlZoPctYWh62CRTf6s5IvdTD32OomCJFWPznlhPQrHeYKCfDT7dhFC5fr0gs yCw1vSSFx0D3qKuLi8XwFEwcTWEAH8S7eMRtZNEgxTPeT/cpvMrI8M4CiYJWRrL5xyXl K4kw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=MnppYqWFagjABTCEaRtDQDACXWEBFJi+7m0e6X3GYEg=; b=IZ4wr5zYQ0njujSoHWjjCVlsIjJU+rHjGRmUYtJeTnvc8nqELfgZlkBQYLcbiWKDUN bHHm3WCHOy/2ARFWduk2XzJib5DDS2/j/M9V5IsY8VgQBvaZevox+A3bbQay24snj0KK Nkcfz2djZaa0bLF1e1jE+sz7LyjbYWSA2hHw7O+wEda31Hgzz93RdDZTjBKO4dOFDgXE 4zg/K8SYNQjh2x1owH8W4rbEKCq/Aq+d+hYJMmb5c3mLrwg6EIu5x+0mDEZkklXS0gGf M8N9UhpnMp84/GZc3TtpqUNsrrR16kuSiJcRThia5EVTJW/G0He8IbPgvpXdE06ZRo9W OUCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="Shbo92/q"; 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 r14si11327502oic.12.2019.12.17.02.52.40; Tue, 17 Dec 2019 02:52:41 -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="Shbo92/q"; 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 S1727466AbfLQKwi (ORCPT + 27 others); Tue, 17 Dec 2019 05:52:38 -0500 Received: from fllv0016.ext.ti.com ([198.47.19.142]:48270 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725940AbfLQKwi (ORCPT ); Tue, 17 Dec 2019 05:52:38 -0500 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id xBHAqSQ7021780; Tue, 17 Dec 2019 04:52:28 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1576579948; bh=MnppYqWFagjABTCEaRtDQDACXWEBFJi+7m0e6X3GYEg=; h=From:To:CC:Subject:Date; b=Shbo92/qOmBGGLk11XqpYELmm0D1uRJRMJ9jCixaDdvt/SF+hVm12KhOJNKX0pUvP Uti6aZhRY8dfh0OpBi4Bzib0b6MVhex7jbCc+HdJB69nu4BcnwpgJQ5w+JPnrN6fBO d6hlpBLbcLhP20nUW4n9vMEfpK5HiZN+oKDIqAjQ= Received: from DLEE103.ent.ti.com (dlee103.ent.ti.com [157.170.170.33]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id xBHAqSPP068295 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 17 Dec 2019 04:52:28 -0600 Received: from DLEE113.ent.ti.com (157.170.170.24) by DLEE103.ent.ti.com (157.170.170.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3; Tue, 17 Dec 2019 04:52:28 -0600 Received: from fllv0040.itg.ti.com (10.64.41.20) by DLEE113.ent.ti.com (157.170.170.24) 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; Tue, 17 Dec 2019 04:52:28 -0600 Received: from feketebors.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id xBHAqP6G047872; Tue, 17 Dec 2019 04:52:26 -0600 From: Peter Ujfalusi To: , , , CC: , , , Subject: [PATCH] mfd: stm32-timers: Use dma_request_chan() instead dma_request_slave_channel() Date: Tue, 17 Dec 2019 12:52:40 +0200 Message-ID: <20191217105240.25648-1-peter.ujfalusi@ti.com> X-Mailer: git-send-email 2.24.0 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/mfd/stm32-timers.c | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) -- Peter Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki diff --git a/drivers/mfd/stm32-timers.c b/drivers/mfd/stm32-timers.c index efcd4b980c94..34747e8a4a40 100644 --- a/drivers/mfd/stm32-timers.c +++ b/drivers/mfd/stm32-timers.c @@ -167,10 +167,11 @@ static void stm32_timers_get_arr_size(struct stm32_timers *ddata) regmap_write(ddata->regmap, TIM_ARR, 0x0); } -static void stm32_timers_dma_probe(struct device *dev, +static int stm32_timers_dma_probe(struct device *dev, struct stm32_timers *ddata) { int i; + int ret = 0; char name[4]; init_completion(&ddata->dma.completion); @@ -179,14 +180,22 @@ static void stm32_timers_dma_probe(struct device *dev, /* Optional DMA support: get valid DMA channel(s) or NULL */ for (i = STM32_TIMERS_DMA_CH1; i <= STM32_TIMERS_DMA_CH4; i++) { snprintf(name, ARRAY_SIZE(name), "ch%1d", i + 1); - ddata->dma.chans[i] = dma_request_slave_channel(dev, name); + ddata->dma.chans[i] = dma_request_chan(dev, name); } - ddata->dma.chans[STM32_TIMERS_DMA_UP] = - dma_request_slave_channel(dev, "up"); - ddata->dma.chans[STM32_TIMERS_DMA_TRIG] = - dma_request_slave_channel(dev, "trig"); - ddata->dma.chans[STM32_TIMERS_DMA_COM] = - dma_request_slave_channel(dev, "com"); + ddata->dma.chans[STM32_TIMERS_DMA_UP] = dma_request_chan(dev, "up"); + ddata->dma.chans[STM32_TIMERS_DMA_TRIG] = dma_request_chan(dev, "trig"); + ddata->dma.chans[STM32_TIMERS_DMA_COM] = dma_request_chan(dev, "com"); + + for (i = STM32_TIMERS_DMA_CH1; i < STM32_TIMERS_MAX_DMAS; i++) { + if (IS_ERR(ddata->dma.chans[i])) { + if (PTR_ERR(ddata->dma.chans[i]) == -EPROBE_DEFER) + ret = -EPROBE_DEFER; + + ddata->dma.chans[i] = NULL; + } + } + + return ret; } static void stm32_timers_dma_remove(struct device *dev, @@ -230,7 +239,11 @@ static int stm32_timers_probe(struct platform_device *pdev) stm32_timers_get_arr_size(ddata); - stm32_timers_dma_probe(dev, ddata); + ret = stm32_timers_dma_probe(dev, ddata); + if (ret) { + stm32_timers_dma_remove(dev, ddata); + return ret; + } platform_set_drvdata(pdev, ddata);