From patchwork Tue Nov 8 07:49:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 16920 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2554619wru; Tue, 8 Nov 2022 00:08:00 -0800 (PST) X-Google-Smtp-Source: AMsMyM7SPTqtWUkSXP3h1SQGyRm7+mzxjU3sslPOUqs/BkNT+0hRvF0LVa+iio/tZO+ywmhI6/T6 X-Received: by 2002:a05:6402:4d9:b0:462:e787:3bf8 with SMTP id n25-20020a05640204d900b00462e7873bf8mr54400534edw.195.1667894880570; Tue, 08 Nov 2022 00:08:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667894880; cv=none; d=google.com; s=arc-20160816; b=MAqKB1JwEImi6dNh+sQVM7sgj/IOZrkY+8G6Oj3k4Aj0PFoP83OY3Ph9zjU5OxoqxA yiy85RO2j4KvwfEQ49diGGxdApGQaSOUAXsAHdo3FYblr39t+bsBLm6jFvWEvu+QK+SZ dVP6bCPXw7pIvfUnQ32xvqaggoYRdoAjMb0PprY0mg4xoGfQ4PDtmPWztIj/9NB3wp4+ m8O7mIvK8geUFXP2pGBFO90eOU6vlzRBAOqhDu/xYQZLLs4QLFKf3tL2WXEkPk6piG60 3kj4iBOQD61dI1LqK2zwTnjLnKIsL7DYE8uhsckTCL29S2m6rhFIfVaqfrhysYt2Ex75 LRDA== 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=YflkZhwKYCrnTSr9NNBORMBmxzajY8AMnsGOgMqhBAc=; b=ETnfBpXbNmBuEFS3TsKHLb2/0ov/CZLKcaGI8aEkBWHApHDg8YanTqC9RZEvMWEudL uCbTgV8njnuwUP6rUnMLMIN8roN2ID2uXqSfoWkLNcaFh9igCaNZpr1AbesuYUAXq2Fs Yqj5pxFIxx/TPdQ47pjQnImQ2PfWfdYTSZ1LPbzxsZzjAiyjMYodElSTm4/vNtP+Ygb9 KVyPCzY2ugmQWPYVLp7XHs77ujlmTmWzwX8k9NDCd1QdonSuhOzo4vPwfl90iiTtIG0r zgGm7CjlW0VtvT456CYENNvbLbDNaR9qXg3Y+fE7z+ouJt+rK3VJT5dDQGseHjoCIoQm 4fEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Imdug1vo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g16-20020a1709065d1000b00790058488dcsi5637079ejt.48.2022.11.08.00.07.37; Tue, 08 Nov 2022 00:08:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Imdug1vo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233663AbiKHHtY (ORCPT + 99 others); Tue, 8 Nov 2022 02:49:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233301AbiKHHtW (ORCPT ); Tue, 8 Nov 2022 02:49:22 -0500 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD6BB13D2E; Mon, 7 Nov 2022 23:49:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667893761; x=1699429761; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=4dh3IRHYQd4HH6cn+7mT19zqVvTBD88fHDivkBet2uM=; b=Imdug1vo9Jjmv1Jp2a+lwGzXlQsPKsQ4ulmFIUl4YtJaLrZcFiTMkUx+ LX9ZU7eJ7cLI2g7MSSMFeDLqoscts3Puow/zUu90tWYSVgvjD1h8rcfdl fMJXAZovkg3e+MNuvH7AtufU3gbzCDIC7ipVs4uLLHFONgajjhljrAb12 0XQRQJfCu05oDHZ8nr0FlW9ItKccxiGbDMQRlrhTxrsEjO2zykbqas6RO E5QO2nug5eNGWZ25WHU/jUCcmhZP480vAlzBIsBk1JBokjKJMfEAoTyYj mogEUHURaoBijKkmoN294LR2iLR2kORfoKPWNoXsDbryR/tvPDiMd1acE A==; X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="310630781" X-IronPort-AV: E=Sophos;i="5.96,147,1665471600"; d="scan'208";a="310630781" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Nov 2022 23:49:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="881423689" X-IronPort-AV: E=Sophos;i="5.96,147,1665471600"; d="scan'208";a="881423689" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga006.fm.intel.com with ESMTP; 07 Nov 2022 23:49:19 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 4E12DF7; Tue, 8 Nov 2022 09:49:43 +0200 (EET) From: Andy Shevchenko To: Vinod Koul , Tudor Ambarus , Nicolas Ferre , linux-arm-kernel@lists.infradead.org, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ludovic Desroches , Andy Shevchenko Subject: [PATCH v1 1/2] at_hdmac: check and return DMA_PAUSED status when suitable Date: Tue, 8 Nov 2022 09:49:37 +0200 Message-Id: <20221108074938.48853-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748914542055966781?= X-GMAIL-MSGID: =?utf-8?q?1748914542055966781?= device_tx_status() may return DMA_PAUSED status when driver supports it. Signed-off-by: Andy Shevchenko --- drivers/dma/at_hdmac.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c index 8858470246e1..a9d8dd990d6e 100644 --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c @@ -1669,9 +1669,19 @@ atc_tx_status(struct dma_chan *chan, int ret; dma_status = dma_cookie_status(chan, cookie, txstate); - if (dma_status == DMA_COMPLETE || !txstate) + if (dma_status == DMA_COMPLETE) return dma_status; + /* + * There's no point in calculating the residue if there's + * no txstate to store the value. + */ + if (!txstate) { + if (test_bit(ATC_IS_PAUSED, &atchan->status)) + return DMA_PAUSED; + return DMA_ERROR; + } + spin_lock_irqsave(&atchan->vc.lock, flags); /* Get number of bytes left in the active transactions */ ret = atc_get_residue(chan, cookie, &residue); @@ -1684,6 +1694,9 @@ atc_tx_status(struct dma_chan *chan, dma_set_residue(txstate, residue); } + if (test_bit(ATC_IS_PAUSED, &atchan->status)) + dma_status = DMA_PAUSED; + dev_vdbg(chan2dev(chan), "tx_status %d: cookie = %d residue = %u\n", dma_status, cookie, residue); From patchwork Tue Nov 8 07:49:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 16921 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2554688wru; Tue, 8 Nov 2022 00:08:08 -0800 (PST) X-Google-Smtp-Source: AMsMyM5XwUn5WTnvIxIJ4ldgDZdLOo6eg54Sh0E5h6mcG96vDQh6WFOzh7CW0abcqoJ5rz3Ktubs X-Received: by 2002:a17:907:b14:b0:7ad:c0d5:bdf6 with SMTP id h20-20020a1709070b1400b007adc0d5bdf6mr46928894ejl.222.1667894888677; Tue, 08 Nov 2022 00:08:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667894888; cv=none; d=google.com; s=arc-20160816; b=SOnk9kr6H8V/Vz64MQAtmqddba0jvWndcNsqFu0t9ljNLLpfW1ZZsFIjIUJUmvNrAx L334GQxq26PaAi4Vedo23F6uPnq+w20F9jGRnkSqPQWaf5eQrQErKTFmr8CjERE07tXi um3RtDaNN6PMOiRtCWZLHiq7SEGew0hYANJEiseGQfT/RNHqpjVPYbfGonbr70spXyet km3XivVUHRN0Vc816/fyxd03ur6wzyewsFozpuqwU/IVn6+7YDMwJC+Y0XnFgk6riUkE nHzs7xBQBNT4IJn6sjtomwny33GDWpizRSJ6+ipLlH9BuoISMZ9Jg5koV1ztU34LWZ4V sDyw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/dCI4erplegQrGnPREigrUQadGJLrgc0tZbz17LuFVM=; b=PEkspUSP5lO+9N9E2xtP91uW/uXnSc2+uvZBEOWSMPaQJRYyPCfluNFMuAGJLaucy8 uObBF2OQVMwyoEKp98R5FfUETUSUmSsdFpZ4vos/DBlcbRvSKY6uekLYta2VcyXv7/hC mr3FCD7kCLNJnzSsBTHUYtuReeL3hKQWBY48NvAY/9XP9TwwBB/+Lk9s9x2wLUb4n+6d QylbHHOcynOID7n/kcMgAL9uNmECGwc4mCoormrc3ooMsjstRXWI3ZXKGcUA9c8MQ9On 9xEpXHCbapTYD22m2w86q+QN45PNdGV953JxH1hSqeTc3CQp4914YetESlsylBdbbkdL 263g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=OGYPdk5H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gb12-20020a170907960c00b007a11c253eaasi13527880ejc.809.2022.11.08.00.07.45; Tue, 08 Nov 2022 00:08:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=OGYPdk5H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233699AbiKHHt2 (ORCPT + 99 others); Tue, 8 Nov 2022 02:49:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233412AbiKHHtW (ORCPT ); Tue, 8 Nov 2022 02:49:22 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 314FA13D3F; Mon, 7 Nov 2022 23:49:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667893762; x=1699429762; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rDiKYYjFpjjWtrYxiCT/r9k/W3/JQ0t2Kz7s3ZTXOAY=; b=OGYPdk5HR54T6Nok04p9yKDoruiDGhvy/1O5LKFej1fCCuzldNF3+qzP aEyC1hD9GRCq1T3qGHRVd8JgqmJKqjV5Vq6wH2FIDt/mi92cfv7YIuwfS QziVKOqrwWJrLxGcmG5mTMwC6/wx/Pjdf/Ha8eUZtuZ54bKolXDkrNSSV ST7UaxzYXFyz2fCDFLs607BOoSKTGdi2F1C2lzsmNNFG24rSwBR4eZ3wP eYAkb27iubQP3aSEsWk5Is/9AAe23LDFhNYl3iI8LOh5XeDg+FKUp0yHL X95sAmjmpb6Lu94miqQTZkQP7eCYUPaSYpmudwBa0sxOgrGHahFWeJ1a6 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="308252779" X-IronPort-AV: E=Sophos;i="5.96,147,1665471600"; d="scan'208";a="308252779" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Nov 2022 23:49:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="725470502" X-IronPort-AV: E=Sophos;i="5.96,147,1665471600"; d="scan'208";a="725470502" Received: from black.fi.intel.com ([10.237.72.28]) by FMSMGA003.fm.intel.com with ESMTP; 07 Nov 2022 23:49:19 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 5DCE9B7; Tue, 8 Nov 2022 09:49:43 +0200 (EET) From: Andy Shevchenko To: Vinod Koul , Tudor Ambarus , Nicolas Ferre , linux-arm-kernel@lists.infradead.org, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ludovic Desroches , Andy Shevchenko Subject: [PATCH v1 2/2] at_hdmac: return actual status when txstatus parameter is NULL Date: Tue, 8 Nov 2022 09:49:38 +0200 Message-Id: <20221108074938.48853-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221108074938.48853-1-andriy.shevchenko@linux.intel.com> References: <20221108074938.48853-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748914550879021447?= X-GMAIL-MSGID: =?utf-8?q?1748914550879021447?= There is no point to return DMA_ERROR if txstatus parameter is NULL. It's a valid case and should be handled correspondingly. Signed-off-by: Andy Shevchenko --- drivers/dma/at_hdmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c index a9d8dd990d6e..4035d5438530 100644 --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c @@ -1679,7 +1679,7 @@ atc_tx_status(struct dma_chan *chan, if (!txstate) { if (test_bit(ATC_IS_PAUSED, &atchan->status)) return DMA_PAUSED; - return DMA_ERROR; + return dma_status; } spin_lock_irqsave(&atchan->vc.lock, flags);