From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6ADFCD37B3 for ; Sun, 17 Sep 2023 10:46:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229776AbjIQKqW (ORCPT ); Sun, 17 Sep 2023 06:46:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236043AbjIQKqG (ORCPT ); Sun, 17 Sep 2023 06:46:06 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D35A122; Sun, 17 Sep 2023 03:46:01 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9D28C433C8; Sun, 17 Sep 2023 10:45:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694947561; bh=tuneXaC50fCB7oGzaG6oE2MeWCqJV7+eq3Gj9nnslX4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=jDjT/cL3+CCoFlvprORtsAbBRN2ODlzr2Q3fu1KXSLOidUQ9dVk7iffauAKhax+nf +CCJ9RnIu8V2B/z6uBB0SqKpswGh/4rn5erdbuDsUyYZ+62deV570WXEfFSg9a+gsc nrRNbZPb+3rMXQBRVtVmn7a5m0SK00AHwQyk2F9R3Qyg7ZdHUiDmdKz3ZsR+/GfIeZ dGvYhbZY/owWv/wn3cYWFtJXasd9huEYYRsx6cI0AGrohIoxWXMK5sGt+4ZIcSxnyi UECG95/5NsEwygGPkmVSDctPTrCdSuGqUshKD3yYENxC3NrUTDEWKftgUx5nUyitQ1 mWGLICm/AZayQ== Date: Sun, 17 Sep 2023 11:45:52 +0100 From: Jonathan Cameron To: Wadim Egorov Cc: , , , , , , , , Subject: Re: [PATCH] iio: adc: ti_am335x_adc: Make DMAs optional Message-ID: <20230917114552.3f5cd081@jic23-huawei> In-Reply-To: <20230914121300.845493-1-w.egorov@phytec.de> References: <20230914121300.845493-1-w.egorov@phytec.de> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org On Thu, 14 Sep 2023 14:13:00 +0200 Wadim Egorov wrote: > DMAs are optional. Even if the DMA request is unsuccessfully, > the ADC can still work properly. > Make tiadc_request_dma() not fail if we do not provide dmas & > dma-names properties. > > This actually fixes the wrong error handling of the tiadc_request_dma() > result where the probing only failed if -EPROPE_DEFER was returned. > > Fixes: f438b9da75eb ("drivers: iio: ti_am335x_adc: add dma support") > No line break here. Fixes tag is part of the main tag block. > Signed-off-by: Wadim Egorov > --- > drivers/iio/adc/ti_am335x_adc.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c > index 8db7a01cb5fb..e14aa9254ab1 100644 > --- a/drivers/iio/adc/ti_am335x_adc.c > +++ b/drivers/iio/adc/ti_am335x_adc.c > @@ -543,8 +543,11 @@ static int tiadc_request_dma(struct platform_device *pdev, > if (IS_ERR(dma->chan)) { > int ret = PTR_ERR(dma->chan); > > + if (ret != -ENODEV) > + return dev_err_probe(&pdev->dev, ret, > + "RX DMA channel request failed\n"); > dma->chan = NULL; > - return ret; > + return 0; > } > > /* RX buffer */ > @@ -670,7 +673,7 @@ static int tiadc_probe(struct platform_device *pdev) > platform_set_drvdata(pdev, indio_dev); > > err = tiadc_request_dma(pdev, adc_dev); > - if (err && err == -EPROBE_DEFER) > + if (err) So this looks like a more subtle change than you are describing. In the original code, we backed off only if the return was a PROBE_DEFER, otherwise we carried on. Your change seems to make that happen for any non -ENODEV error, including PROBE_DEFER. That's fine, but it's not what the description implies. Whilst tiadc_request_dma will fail today if the dmas etc is not provided, that seems like correct behavior to me. A function requesting dma fails if it isn't available. The handling of whether to carry on the job for the caller. So I think it should just be if (err && err != -EINVAL) goto err_dma; and no change in tiadc_request_dma() However, the case you describe should have worked find with existing code as it wasn't -EPROBE_DEFER, so I don't understand why you were looking at this code block in the first place? Jonathan > goto err_dma; > > return 0;