Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1617417ybz; Thu, 30 Apr 2020 02:30:59 -0700 (PDT) X-Google-Smtp-Source: APiQypJ0XlkgNwDn5oieqQH5juwrLHlo9m9wq8BjlNCF1C+29HcrlI4OaiJv8qnkHJ59ZlzwI75T X-Received: by 2002:aa7:d48a:: with SMTP id b10mr1722052edr.284.1588239058797; Thu, 30 Apr 2020 02:30:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588239058; cv=none; d=google.com; s=arc-20160816; b=uWHzk+TTTA1havsj6mqZS+VCC9szF8/II9Q0vz+tApOxX1s28WJf5GAZiYhIuu+ckE rJQHJVUfLT7doYnctMVlpAs7oXW0CEUIGqZh0Klo+z1BwL91vRepIhgKddU8z4gReUnV KZT3SYUYvUMJIkbR38BVmSeD9U3+KwFFjFx9jtso91ETqZ0fdI7VuOshosw4hC5aX7xc nXWvU/6Nd67w3F7H31VS+AL2zXrV3fWATiCMAJsghdcrIbTQsCzlD/fAV0IIix7nV3gp CM/v3Mg3oGrFHJlS4HgHvqDil9kyda00LGmwuCSB5QT5NVh1m4pt7HLkpZ0aM9q54veC ys6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=qIeBQMBn9avrk9Wk30adQnq2+K+QbudxkM/KMRa/Enw=; b=nITiwrRC15YZCE1GsfiE4WcIBG8IRGw4C+Jw/XM3Lps3nx+xGG0epLTj66SDZdYBbU Hx3rXCMvAGMFuflcIdr4izAaMWreWkZFtnl1xfEgSYJv8PV6YoFt52+3Frj3sq4AgtDu 3b0Hlm8+wLCR4voRR8FUQfpqc/kXRh3I0NS9ahJx3fZ2bra7dYZUSmL4iZZAbN5LyE4E v2Q39kXmvYAT6n3K5PlJlGS7mwD/gZxHvfEE/AEEJXTfBnVliu/wd9bCXTPO+huhuoEn SOzs6yCXDTl8Q/pC6gp7wO4LXzLBgEKBLrNMgGz/z2Zr0ZO6SXJ6/WXmYOa8Mn7IcFCo eWhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=U7d4vPsm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=st.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id sd16si5874320ejb.106.2020.04.30.02.30.35; Thu, 30 Apr 2020 02:30:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=U7d4vPsm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=st.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726754AbgD3J3J (ORCPT + 99 others); Thu, 30 Apr 2020 05:29:09 -0400 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:16552 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726358AbgD3J3J (ORCPT ); Thu, 30 Apr 2020 05:29:09 -0400 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 03U9SX9C031500; Thu, 30 Apr 2020 11:28:58 +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=qIeBQMBn9avrk9Wk30adQnq2+K+QbudxkM/KMRa/Enw=; b=U7d4vPsmLuiTg2ZcPxstYLGyvd01PVFyI2Ndeaf6jS1f5jq1pIGQ1SyKlnO5NsReGTHa Q7vhdb3vQ3y3BuLJ/8q0cc9IlajfgjrY9VnGJEeFbmT08jWYZhfNdSRUhblOywPST9nH etPQr7v7zaHwnTVuU30ALsOkml37Ah7b+BSYb25cEJEpNc2je+879jx4tsLKq9ucmtlR /QmzwpvilClDy5mQOWkItLUwJHYE+HVfo6JthamAV85zZ7YkcxwYkGiXBCFQVTJitvEu VjgZRzF6VQ7S99PXUTX5i457R7Df9lZ/FY7ftebe7xoVRTs/RXo9XpIObSeZEy17wi8t Eg== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 30qst08vs1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 30 Apr 2020 11:28:58 +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 3D04D100038; Thu, 30 Apr 2020 11:28:57 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag5node3.st.com [10.75.127.15]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 2CD222B2B2F; Thu, 30 Apr 2020 11:28:57 +0200 (CEST) Received: from localhost (10.75.127.47) by SFHDAG5NODE3.st.com (10.75.127.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 30 Apr 2020 11:28:56 +0200 From: Fabrice Gasnier To: CC: , , , , , , , Subject: [PATCH] iio: adc: stm32-adc: fix device used to request dma Date: Thu, 30 Apr 2020 11:28:45 +0200 Message-ID: <1588238926-23964-1-git-send-email-fabrice.gasnier@st.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.75.127.47] X-ClientProxiedBy: SFHDAG2NODE2.st.com (10.75.127.5) To SFHDAG5NODE3.st.com (10.75.127.15) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.676 definitions=2020-04-30_05:2020-04-30,2020-04-30 signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org DMA channel request should use device struct from platform device struct. Currently it's using iio device struct. But at this stage when probing, device struct isn't yet registered (e.g. device_register is done in iio_device_register). Since commit 71723a96b8b1 ("dmaengine: Create symlinks between DMA channels and slaves"), a warning message is printed as the links in sysfs can't be created, due to device isn't yet registered: - Cannot create DMA slave symlink - Cannot create DMA dma:rx symlink Fix this by using device struct from platform device to request dma chan. Fixes: 2763ea0585c99 ("iio: adc: stm32: add optional dma support") Signed-off-by: Fabrice Gasnier --- drivers/iio/adc/stm32-adc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c index ae622ee..dfc3a30 100644 --- a/drivers/iio/adc/stm32-adc.c +++ b/drivers/iio/adc/stm32-adc.c @@ -1812,18 +1812,18 @@ static int stm32_adc_chan_of_init(struct iio_dev *indio_dev) return 0; } -static int stm32_adc_dma_request(struct iio_dev *indio_dev) +static int stm32_adc_dma_request(struct device *dev, struct iio_dev *indio_dev) { struct stm32_adc *adc = iio_priv(indio_dev); struct dma_slave_config config; int ret; - adc->dma_chan = dma_request_chan(&indio_dev->dev, "rx"); + adc->dma_chan = dma_request_chan(dev, "rx"); if (IS_ERR(adc->dma_chan)) { ret = PTR_ERR(adc->dma_chan); if (ret != -ENODEV) { if (ret != -EPROBE_DEFER) - dev_err(&indio_dev->dev, + dev_err(dev, "DMA channel request failed with %d\n", ret); return ret; @@ -1930,7 +1930,7 @@ static int stm32_adc_probe(struct platform_device *pdev) if (ret < 0) return ret; - ret = stm32_adc_dma_request(indio_dev); + ret = stm32_adc_dma_request(dev, indio_dev); if (ret < 0) return ret; -- 2.7.4