From patchwork Mon Sep 25 13:44:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wadim Egorov X-Patchwork-Id: 144437 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6359:6f87:b0:13f:353d:d1ed with SMTP id tl7csp1137458rwb; Mon, 25 Sep 2023 07:21:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH62nSL1E4LgtOV1YwAAcbSyF/9syz0W0q9nA0b3DIa0ccferrkrUnL7AC9CGkCsL+Gru5h X-Received: by 2002:a05:6358:919c:b0:132:d32d:d929 with SMTP id j28-20020a056358919c00b00132d32dd929mr8533297rwa.20.1695651668308; Mon, 25 Sep 2023 07:21:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695651668; cv=none; d=google.com; s=arc-20160816; b=AoJqHbS4qZFDdSGgRJ4IyE3BhTxDlElCsz1bcXz4iZmlYAv57fa9BTjK8EEcxkoDgc Zgtlp8QECjJPl1kpG06y0oadKfTYEDu0f8oRh61dgSNi2OH2f7BjrsdVF2rouV9CkRrp FD7Sn66gq5YI9+csaVkSLUeE8b9Eu/2pOhPVqKMwg95LK++CZ+Teh0OofnaGdKapwEBb Z348hWWiTZk+SD2CDpEiAvd+nmWwJhvm2QVJu/zJYLNMi2A0Jcf9RoabWo2gi7+j/UZT 5fzo3ACH4uI4zQmY3AfTWEcgrYJ/vwIQTAEOFy0DQdnhifMm5SuJ7YCjF4IUp3eHzx0E SXrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=z2AK6YnxcWA5kq1NnPfgljwasG1PYWxAhLfeQhTbjbk=; fh=z/uSyYYV8sTLf333+4z2N/LG6xrWlVcGj3ca6oj+rWc=; b=GOzjQiBirK5/SENiRLVIL9OL0bRMdA/JiEoIHARlPk5mNR2Z2iHiqKbBTsW391xAr7 Yp00CFGw7znCQWjXSMovzK9XYBhYQLUundrMwc2niHg0taYyDkFykklEy7IY06W6QQkJ 1hm1WkX1iRdyuo7lnfVd9JzXGmqI+++ot+Kj/PUymVetEl4Wt0WJzvj1sejun5As77Qd bj2X4mCxJ+7R/cmhW3yc031PEMOUHcRrPuw9qs7UgoPfjfJvQ6Mc4UdZ3AqcORsEQ7wn rEBHHXc0oYH4+3cUCKN/0GwpMx+Mu4v8GCpBa7a8CXiT9S3y1i/MJFCu3n13XQAwpZWN jP4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@phytec.de header.s=a4 header.b=RZdzW+L5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id l11-20020a65560b000000b00563d9ff5157si10343991pgs.547.2023.09.25.07.21.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 07:21:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=fail header.i=@phytec.de header.s=a4 header.b=RZdzW+L5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 9F6E281F3307; Mon, 25 Sep 2023 06:44:49 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231880AbjIYNoq (ORCPT + 29 others); Mon, 25 Sep 2023 09:44:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230263AbjIYNop (ORCPT ); Mon, 25 Sep 2023 09:44:45 -0400 Received: from mickerik.phytec.de (mickerik.phytec.de [91.26.50.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4036CB3 for ; Mon, 25 Sep 2023 06:44:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; d=phytec.de; s=a4; c=relaxed/simple; q=dns/txt; i=@phytec.de; t=1695649476; x=1698241476; h=From:Sender:Reply-To:Subject:Date:Message-ID:To:CC:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=28PpxXcCjpk33cV4lxB4KctRi94rZLugQvUovFs5/Zg=; b=RZdzW+L50N9vktvglf7SBGehYNm1n+MOPrad16TEKaDVISlVbmLlUlsIjd2RL6mn ozwb60qknI0kQRSAfXuCgayeHfw5Kr0y47qDrdoW2ArG9B8UaTqRZqZIgksEZxoh mjLkNgkGVrWiyFzJRtdC62uzCDNoM7w8qeasmJbnCFE=; X-AuditID: ac14000a-6d65670000001e37-4d-65118ec4a100 Received: from berlix.phytec.de (Unknown_Domain [172.25.0.12]) (using TLS with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mickerik.phytec.de (PHYTEC Mail Gateway) with SMTP id FB.51.07735.4CE81156; Mon, 25 Sep 2023 15:44:36 +0200 (CEST) Received: from augenblix2.phytec.de (172.25.0.11) by Berlix.phytec.de (172.25.0.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.18; Mon, 25 Sep 2023 15:44:36 +0200 From: Wadim Egorov To: , , , , , CC: , , , Subject: [PATCH v2] iio: adc: ti_am335x_adc: Fix return value check of tiadc_request_dma() Date: Mon, 25 Sep 2023 15:44:27 +0200 Message-ID: <20230925134427.214556-1-w.egorov@phytec.de> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [172.25.0.11] X-ClientProxiedBy: Berlix.phytec.de (172.25.0.12) To Berlix.phytec.de (172.25.0.12) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrDLMWRmVeSWpSXmKPExsWyRpKBR/dIn2Cqwd1LfBb/H71mtXjQtIrJ Ysnk+awW8468Y7G4vGsOm8XVB+UWb36cZbKY9fEHq8X/PTvYLbrfqTtweWxa1cnm0d/dwuqx 5M0hVo/t1+Yxexy/sZ3J4/MmuQC2KC6blNSczLLUIn27BK6MRe/kC25wVjx79YG1gfE3excj J4eEgInEg5bTzF2MXBxCAkuYJG4u7mCEcJ4wSiyd+4UJpIpNQF3izoZvrCC2iEAjo8Td22Dd zAJZEju2nmIEsYUFoiQmbroNVs8ioCpx/MoZFhCbV8BCYtWGm6wQ2+QlZl76zg4RF5Q4OfMJ C8QceYnmrbOZIWwJiYMvXoDZQkDxF5eWs8D0Tjv3mhnCDpXY+mU70wRGgVlIRs1CMmoWklEL GJlXMQrlZiZnpxZlZusVZFSWpCbrpaRuYgTFgAgD1w7GvjkehxiZOBgPMUpwMCuJ8P56xpcq xJuSWFmVWpQfX1Sak1p8iFGag0VJnPd+D1OikEB6YklqdmpqQWoRTJaJg1OqgbGbzevf1/Bv 2V/lHBZMMbBf9ddUrSmkPe6YVJXRjE1cZ9bkzJxz4H7I1ytn/vkxpezpq1ngJi5zcs0eBucC hamLQ5a4tu44dYJjZ5gQq0O5VfZXma8dW3m4D7vdeKVUy7nR5f62pk/K0+6b3ZW5UuueuU1u gmSE1TNmx4V6VqIymXY6KrsmcCixFGckGmoxFxUnAgDtYSE7bwIAAA== X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 25 Sep 2023 06:44:49 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778019643698602465 X-GMAIL-MSGID: 1778019643698602465 Fix wrong handling of a DMA request where the probing only failed if -EPROPE_DEFER was returned. Instead, let us fail if a non -ENODEV value is returned. This makes DMAs explicitly optional. Even if the DMA request is unsuccessfully, the ADC can still work properly. We do also handle the defer probe case by making use of dev_err_probe(). Fixes: f438b9da75eb ("drivers: iio: ti_am335x_adc: add dma support") Signed-off-by: Wadim Egorov Reviewed-by: Bhavya Kapoor --- v2: - Update description - Drop line break after Fixes tag - Move decision about optional DMA into probe/caller --- drivers/iio/adc/ti_am335x_adc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c index 8db7a01cb5fb..5f8795986995 100644 --- a/drivers/iio/adc/ti_am335x_adc.c +++ b/drivers/iio/adc/ti_am335x_adc.c @@ -670,8 +670,10 @@ 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 && err != -ENODEV) { + dev_err_probe(&pdev->dev, err, "DMA request failed\n"); goto err_dma; + } return 0;