From patchwork Tue Dec 17 07:51:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 181841 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp5410575ile; Mon, 16 Dec 2019 23:51:50 -0800 (PST) X-Google-Smtp-Source: APXvYqx59+ggmxghneL7lWXQukSRRvUvTP/d3bFj6dZ414yi1jCFZPLZWlyaBGupstK3Kmu6zLUN X-Received: by 2002:a05:6830:1d1:: with SMTP id r17mr38519962ota.151.1576569110441; Mon, 16 Dec 2019 23:51:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576569110; cv=none; d=google.com; s=arc-20160816; b=bc8Wfv9uSW+nKAsZ7SwWVzdIOo/LnKoxB/esDNTntMOR8BzafzfWwDv39m7f8V84KS 2ei2zblzfBK91P7WRA0u4wPI7Z0OHeYJWxDiofJCdIlnTvDLIyBNLskZYE97jJZkIlaA q5PdkQzAQ8nDbSEjxe/tMjn93U0Yr2XuBgOV8nNtbyYvkGA8CF4D5qaOhs8O2YhuWNu1 U8BYko1rZkXrq0paCMYY5rarAP3UqrHYHL8xp2FKh0c0aTXImDJaOCifdUERbEbEfkMX Hpz5FRu7W/9I87YBixJmeFks2ErcLL0hXtSkUWEDijDBSy8eP/mw8chN/DZ6xb9rO7Mh EQZA== 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=vr+rDIyiyiSRUk7SbDjg1Nmfg457lbFChtazZnMn724=; b=fSozE634bp2mTwT/s53eNja4/FYGMY6FTi8PBtK6ubbur88DfBBz0lt5HJbp7Dey13 B0noytxepBkyFBQvnuKTNymIn1Xyib7dEZ01iK53eJBYuhXHztly3adV+wBY7oh069kH 1YeOMyih7rgEpX4ulBHsdz80Of38WRzTFTmGfnV4qwi+Marn0uS8QU4uXhO+iaeIfjH6 +qy1gCCFu54Df+IrRlNK5Ntq4XZyowhmoTplJS6C3ExCuX5PjgG6C6AHruRLaJdGthOU p+PJDK+41ZTUYq+awMvtirbnDsuvBviiITs7tiX0G3RpLfVyovT0uaVGvEpy1xAopmHz q+6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="vvQV/uff"; 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 s126si11287422oib.84.2019.12.16.23.51.50; Mon, 16 Dec 2019 23:51:50 -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="vvQV/uff"; 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 S1726752AbfLQHvt (ORCPT + 27 others); Tue, 17 Dec 2019 02:51:49 -0500 Received: from fllv0016.ext.ti.com ([198.47.19.142]:53838 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725730AbfLQHvt (ORCPT ); Tue, 17 Dec 2019 02:51:49 -0500 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id xBH7pfCO082727; Tue, 17 Dec 2019 01:51:41 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1576569101; bh=vr+rDIyiyiSRUk7SbDjg1Nmfg457lbFChtazZnMn724=; h=From:To:CC:Subject:Date; b=vvQV/uffjYX24QZ1ZdNe5KqcieAeJyGacD8mkWzu+PJdslRFkZEuykTjTyvTGH8eq joS6boyNTaHmUA6xzkNOhtX2CM7bza0+p8mHDUf0EnaE89RMhelOzb9JSKrEH4OcfU bzJfgLQ7syPo5vaLrj8QrncI8EqvrgRJWZ1u2M+k= Received: from DLEE100.ent.ti.com (dlee100.ent.ti.com [157.170.170.30]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id xBH7pfWm028490; Tue, 17 Dec 2019 01:51:41 -0600 Received: from DLEE104.ent.ti.com (157.170.170.34) 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; Tue, 17 Dec 2019 01:51:40 -0600 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE104.ent.ti.com (157.170.170.34) 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 01:51:40 -0600 Received: from feketebors.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id xBH7pb6M088250; Tue, 17 Dec 2019 01:51:38 -0600 From: Peter Ujfalusi To: , , CC: , , , , Subject: [PATCH] iio: adc: stm32-adc: Use dma_request_chan() instead dma_request_slave_channel() Date: Tue, 17 Dec 2019 09:51:53 +0200 Message-ID: <20191217075153.23766-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/iio/adc/stm32-adc.c | 10 ++++++++-- 1 file changed, 8 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/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c index 3b291d72701c..5dab23f1fdee 100644 --- a/drivers/iio/adc/stm32-adc.c +++ b/drivers/iio/adc/stm32-adc.c @@ -1746,9 +1746,15 @@ static int stm32_adc_dma_request(struct iio_dev *indio_dev) struct dma_slave_config config; int ret; - adc->dma_chan = dma_request_slave_channel(&indio_dev->dev, "rx"); - if (!adc->dma_chan) + adc->dma_chan = dma_request_chan(&indio_dev->dev, "rx"); + if (IS_ERR(adc->dma_chan)) { + if (PTR_ERR(adc->dma_chan) == -EPROBE_DEFER) + return -EPROBE_DEFER; + + /* Ignore errors to fall back to IRQ mode */ + adc->dma_chan = NULL; return 0; + } adc->rx_buf = dma_alloc_coherent(adc->dma_chan->device->dev, STM32_DMA_BUFFER_SIZE,