From patchwork Sun Feb 2 22:28:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11361879 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DFDE11398 for ; Sun, 2 Feb 2020 22:31:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BE1542080D for ; Sun, 2 Feb 2020 22:31:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jzZ9q2KM" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727072AbgBBW3v (ORCPT ); Sun, 2 Feb 2020 17:29:51 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:34381 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726995AbgBBW3v (ORCPT ); Sun, 2 Feb 2020 17:29:51 -0500 Received: by mail-lj1-f196.google.com with SMTP id x7so12652355ljc.1; Sun, 02 Feb 2020 14:29:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pIr+hEI5jiVDIpgzntOp1SJ5U4uzX7Mt42pGHqVvxOQ=; b=jzZ9q2KMJmouDEZbcdN00RjfC/PXjwhT4TmtiW7J42rS2MEHcKIScPd9Y0ORk95AJy PxYEElGLVUDJiRpYNmkz3fIIzoa/Akt4CHjOUiMSK6xo+GNcOx+caWi3KN4jsEwxmIac B7le2/u3AaYhum9IRbWB5mVmbS5hRtHTiwsuW/Omorkfb+/hnCW+QdyK1hekz2jlTj4h ELkXuGVqIO9aMcev96bpWaHzTByqePNA2Pc3LhCLr5oS7FzWvoDWd9JvaaX6Rki0fvvx /liKmuD2St21iBj52CXv1LSvYDZcu9AgH6qsufLo7sLeWPlahCxmVWNmDJVDjBoP1unP F1rA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pIr+hEI5jiVDIpgzntOp1SJ5U4uzX7Mt42pGHqVvxOQ=; b=riwbi3ok38uVaLRNvMaS4JLEDBKFiBaCMcmAMbKNwCZReFQuZtkbm64cchYKpJvitT j5MDDxGeqdZoVapf7/VJAnvlu3kM0SEaHAX4JkEmsRfT5qtTcKnA+jBx9G2GAATLP8kV kyTSRwhFpP/DS5REysmpe9ebN2VunAoc4HxCMp4Bvt2DD3YzEjc3nlrCZegMitxcX2uY Kw7jDWNzsUkFI0Nm5udObN9AmCPkvTc5zwYwPHROGDOT/MG92Z2TQzqmDvFjv3/Q1LHY dwk4FsqquGet/R60nlMhnGaKtrlR8Q78QZi5DwBOwwKw3dHlDl6/PJe/d/Qqq5h5FwGZ IEkQ== X-Gm-Message-State: APjAAAX85PzR25F/UQlxL/wDGWwf7fU5jYASBetT5w0RdgMvE0e+MzV0 TFCIIF4tbxgXbiW0GcPgNmE= X-Google-Smtp-Source: APXvYqyHvhQscqat+8sWrjPwl3MB67ecQ11g38sjzPkkZRRFvgRzby3QJz1PyX4eMOyLq859q6JYTA== X-Received: by 2002:a05:651c:1bb:: with SMTP id c27mr12522033ljn.277.1580682589492; Sun, 02 Feb 2020 14:29:49 -0800 (PST) Received: from localhost.localdomain (79-139-233-37.dynamic.spd-mgts.ru. [79.139.233.37]) by smtp.gmail.com with ESMTPSA id b190sm8050307lfd.39.2020.02.02.14.29.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Feb 2020 14:29:49 -0800 (PST) From: Dmitry Osipenko To: Laxman Dewangan , Vinod Koul , Dan Williams , Thierry Reding , Jonathan Hunter , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Cc: dmaengine@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 01/19] dmaengine: tegra-apb: Fix use-after-free Date: Mon, 3 Feb 2020 01:28:36 +0300 Message-Id: <20200202222854.18409-2-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200202222854.18409-1-digetx@gmail.com> References: <20200202222854.18409-1-digetx@gmail.com> MIME-Version: 1.0 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org I was doing some experiments with I2C and noticed that Tegra APB DMA driver crashes sometime after I2C DMA transfer termination. The crash happens because tegra_dma_terminate_all() bails out immediately if pending list is empty, and thus, it doesn't release the half-completed descriptors which are getting re-used before ISR tasklet kicks-in. tegra-i2c 7000c400.i2c: DMA transfer timeout elants_i2c 0-0010: elants_i2c_irq: failed to read data: -110 ------------[ cut here ]------------ WARNING: CPU: 0 PID: 142 at lib/list_debug.c:45 __list_del_entry_valid+0x45/0xac list_del corruption, ddbaac44->next is LIST_POISON1 (00000100) Modules linked in: CPU: 0 PID: 142 Comm: kworker/0:2 Not tainted 5.5.0-rc2-next-20191220-00175-gc3605715758d-dirty #538 Hardware name: NVIDIA Tegra SoC (Flattened Device Tree) Workqueue: events_freezable_power_ thermal_zone_device_check [] (unwind_backtrace) from [] (show_stack+0x11/0x14) [] (show_stack) from [] (dump_stack+0x85/0x94) [] (dump_stack) from [] (__warn+0xc1/0xc4) [] (__warn) from [] (warn_slowpath_fmt+0x61/0x78) [] (warn_slowpath_fmt) from [] (__list_del_entry_valid+0x45/0xac) [] (__list_del_entry_valid) from [] (tegra_dma_tasklet+0x5b/0x154) [] (tegra_dma_tasklet) from [] (tasklet_action_common.constprop.0+0x41/0x7c) [] (tasklet_action_common.constprop.0) from [] (__do_softirq+0xd3/0x2a8) [] (__do_softirq) from [] (irq_exit+0x7b/0x98) [] (irq_exit) from [] (__handle_domain_irq+0x45/0x80) [] (__handle_domain_irq) from [] (gic_handle_irq+0x45/0x7c) [] (gic_handle_irq) from [] (__irq_svc+0x65/0x94) Exception stack(0xde2ebb90 to 0xde2ebbd8) Cc: Acked-by: Jon Hunter Signed-off-by: Dmitry Osipenko --- drivers/dma/tegra20-apb-dma.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c index 3a45079d11ec..319f31d27014 100644 --- a/drivers/dma/tegra20-apb-dma.c +++ b/drivers/dma/tegra20-apb-dma.c @@ -756,10 +756,6 @@ static int tegra_dma_terminate_all(struct dma_chan *dc) bool was_busy; spin_lock_irqsave(&tdc->lock, flags); - if (list_empty(&tdc->pending_sg_req)) { - spin_unlock_irqrestore(&tdc->lock, flags); - return 0; - } if (!tdc->busy) goto skip_dma_stop; From patchwork Sun Feb 2 22:28:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11361873 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8C3DC1398 for ; Sun, 2 Feb 2020 22:31:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 69D742082E for ; Sun, 2 Feb 2020 22:31:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EM0X7sgb" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727097AbgBBW3x (ORCPT ); Sun, 2 Feb 2020 17:29:53 -0500 Received: from mail-lf1-f66.google.com ([209.85.167.66]:46173 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727044AbgBBW3x (ORCPT ); Sun, 2 Feb 2020 17:29:53 -0500 Received: by mail-lf1-f66.google.com with SMTP id z26so8310337lfg.13; Sun, 02 Feb 2020 14:29:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iQvpC9Xx1OhKhnLZoMg+HnSAUjrYIEp03EqAINcI86Q=; b=EM0X7sgbng3x4dktJbQeFp9yA7QcvBQcMnHhoD6kgwIh+gjOG47z1HOOHO2Z0TjMJI YLwYWOsktgo7+EvwnqMmrOUaTeXcRAWW+aZksSc2tyd3Uw53NdGiPzWjDb1xILxuxdkK 3M+//YX0coXAt6iiVSctJ2f2pLwlaQ+u06cQepSsvvgAiqcy+tMim/QJW5WFklrjCESz 2TKfbDykDVxFdYlV7tV3CBEkfEvNU57CnJJqSOMmuZcqm3tdjy4ejmAFAduou/kg+HBu Oq2Y+t3w8DIhW8Ei+O0qWRSJ5e+Au0StYoJdVaP4d8PHSPcD8o+uRyR315U70VLszFKf dZOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iQvpC9Xx1OhKhnLZoMg+HnSAUjrYIEp03EqAINcI86Q=; b=k0UMdaM/As2C06xYHNk5Pcob9UA32PqUvs+RSVTXA8K1MjvlTzNfDlVghwmOtd/Eem qN2SzTsh5xonECfScbAAI2Jy5wuy/mAIDBCgv4Cjb/hjGqXDg7PbDOR0ELAfTaGWsPx6 IDj6rjblFbXFFNdmtXcEq7mKT8v9V42usDRy3fxIM0wFvUYZzwGPrmjO/sj098Ah5wTS GffXlz/M7Oeo2LsGbH/tie6QFjzpHAx9C070FBSmdU2rriM48wf59nFA+QMv4r1mZNir Bi88FsQF1ZsYabQY7739DYmmCBAO+4th/BW5n3J5tCCXtUXLsswOYopet1A7VJYsMh+u NIDQ== X-Gm-Message-State: APjAAAXCAU4St2ec/7WDIpWAveVKFCbYXPqwHwG0nqMZbWlpMU+uuILN tySZRED/nyxqHmjV1AwYPUw= X-Google-Smtp-Source: APXvYqzZZIRAWD1QW/C1T/vkHQgSiYk/SsKeBvJduu/OlQALoN1xg6VXm+h6JeCSgOvE+erAc866iw== X-Received: by 2002:ac2:4422:: with SMTP id w2mr10571236lfl.178.1580682590369; Sun, 02 Feb 2020 14:29:50 -0800 (PST) Received: from localhost.localdomain (79-139-233-37.dynamic.spd-mgts.ru. [79.139.233.37]) by smtp.gmail.com with ESMTPSA id b190sm8050307lfd.39.2020.02.02.14.29.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Feb 2020 14:29:49 -0800 (PST) From: Dmitry Osipenko To: Laxman Dewangan , Vinod Koul , Dan Williams , Thierry Reding , Jonathan Hunter , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Cc: dmaengine@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 02/19] dmaengine: tegra-apb: Prevent race conditions of tasklet vs free list Date: Mon, 3 Feb 2020 01:28:37 +0300 Message-Id: <20200202222854.18409-3-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200202222854.18409-1-digetx@gmail.com> References: <20200202222854.18409-1-digetx@gmail.com> MIME-Version: 1.0 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org The interrupt handler puts a half-completed DMA descriptor on a free list and then schedules tasklet to process bottom half of the descriptor that executes client's callback, this creates possibility to pick up the busy descriptor from the free list. Thus, let's disallow descriptor's re-use until it is fully processed. Cc: Acked-by: Jon Hunter Signed-off-by: Dmitry Osipenko --- drivers/dma/tegra20-apb-dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c index 319f31d27014..4a750e29bfb5 100644 --- a/drivers/dma/tegra20-apb-dma.c +++ b/drivers/dma/tegra20-apb-dma.c @@ -281,7 +281,7 @@ static struct tegra_dma_desc *tegra_dma_desc_get( /* Do not allocate if desc are waiting for ack */ list_for_each_entry(dma_desc, &tdc->free_dma_desc, node) { - if (async_tx_test_ack(&dma_desc->txd)) { + if (async_tx_test_ack(&dma_desc->txd) && !dma_desc->cb_count) { list_del(&dma_desc->node); spin_unlock_irqrestore(&tdc->lock, flags); dma_desc->txd.flags = 0; From patchwork Sun Feb 2 22:28:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11361877 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5571614E3 for ; Sun, 2 Feb 2020 22:31:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 336122080D for ; Sun, 2 Feb 2020 22:31:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Vjd2LIBn" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727034AbgBBWbA (ORCPT ); Sun, 2 Feb 2020 17:31:00 -0500 Received: from mail-lf1-f66.google.com ([209.85.167.66]:33007 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726995AbgBBW3x (ORCPT ); Sun, 2 Feb 2020 17:29:53 -0500 Received: by mail-lf1-f66.google.com with SMTP id n25so8399837lfl.0; Sun, 02 Feb 2020 14:29:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7zuEhMyyRsm4yoSSRhgi3ZRMmTyTt2unt4jqJAWf7Xs=; b=Vjd2LIBnzhFjM8DunE+XTSL68He5AzXn78FifJB55OI2tTDmg7ap6leEdDLBF1VVmm SNW4P4IbbJOyDp1UtXz2xRNiGuI2EI5eYnzLFYyTQYSiB4TsYKWLXPpfwXX2hQtwAILF 1OTbtD30AhPmM+xnnuaX+8UTQZwn4KPOsOapRfKEFbsBy48VFaZ0zAkCFFMP+S/jIO6H A+ohdLGQuE0qPuf/s6esc7PjrlEgJmF1cpA6h8l3kLw1rVgTvc2iOFkg23cd3J1k1bod iAawRjDe0BIOk6E3W3oca60MBN5pCeV0wuCcnHxA4doy3HuwSa3e4oRBDC0nBFziVsNn A8QA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7zuEhMyyRsm4yoSSRhgi3ZRMmTyTt2unt4jqJAWf7Xs=; b=Lk8wACfIfaRbptz1w5zItqnV/VpUTLGWuVU4PhBk8ePvZde0OpYWUxCyGRHcTDI8vQ lOE8tmfMXABWcWeJ1ecHVQ/ebK/GlSRxBKPTNYe0nfBwy2KTrp0BYQn9CnV8CDud+h/7 CpoF5NIGRWfI9klwVgYxzA6Sk0VuHVo1gX39IUli5jHrNLRuBZEHVS/YdSjI1FbSTA+P p4dqpwSkehNiVxeUwadf2pUMTSD0dmPTxLg4DddndwJroS/7QOCK1472LDD9QB9or+c3 dxyc++DuzDqZ+oBvDfyRSUKjbkCAxTCnNwNqLoMydcNnjoa5hFEZMxUvAQVpIIluCwXM o+Fg== X-Gm-Message-State: APjAAAXz10GzVz8AcOWETtGIUOl1kZh/7z2k4o1YHZMWvkRemvvflJ4K UK2Pw0kA5A25Hg93VoJjBJk= X-Google-Smtp-Source: APXvYqxXRg7x6L0yFByVVBf6PfucuRpLsn5tbc9KuzPll93JKq4R/8CEoN9yn8OQQ45zWIRQXkZbJQ== X-Received: by 2002:a05:6512:1cc:: with SMTP id f12mr10749904lfp.128.1580682591273; Sun, 02 Feb 2020 14:29:51 -0800 (PST) Received: from localhost.localdomain (79-139-233-37.dynamic.spd-mgts.ru. [79.139.233.37]) by smtp.gmail.com with ESMTPSA id b190sm8050307lfd.39.2020.02.02.14.29.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Feb 2020 14:29:50 -0800 (PST) From: Dmitry Osipenko To: Laxman Dewangan , Vinod Koul , Dan Williams , Thierry Reding , Jonathan Hunter , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Cc: dmaengine@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 03/19] dmaengine: tegra-apb: Implement synchronization hook Date: Mon, 3 Feb 2020 01:28:38 +0300 Message-Id: <20200202222854.18409-4-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200202222854.18409-1-digetx@gmail.com> References: <20200202222854.18409-1-digetx@gmail.com> MIME-Version: 1.0 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org The ISR tasklet could be kept scheduled after DMA transfer termination, let's add synchronization hook which blocks until tasklet is finished. Acked-by: Jon Hunter Signed-off-by: Dmitry Osipenko --- drivers/dma/tegra20-apb-dma.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c index 4a750e29bfb5..f56881500a23 100644 --- a/drivers/dma/tegra20-apb-dma.c +++ b/drivers/dma/tegra20-apb-dma.c @@ -798,6 +798,13 @@ static int tegra_dma_terminate_all(struct dma_chan *dc) return 0; } +static void tegra_dma_synchronize(struct dma_chan *dc) +{ + struct tegra_dma_channel *tdc = to_tegra_dma_chan(dc); + + tasklet_kill(&tdc->tasklet); +} + static unsigned int tegra_dma_sg_bytes_xferred(struct tegra_dma_channel *tdc, struct tegra_dma_sg_req *sg_req) { @@ -1506,6 +1513,7 @@ static int tegra_dma_probe(struct platform_device *pdev) tdma->dma_dev.residue_granularity = DMA_RESIDUE_GRANULARITY_BURST; tdma->dma_dev.device_config = tegra_dma_slave_config; tdma->dma_dev.device_terminate_all = tegra_dma_terminate_all; + tdma->dma_dev.device_synchronize = tegra_dma_synchronize; tdma->dma_dev.device_tx_status = tegra_dma_tx_status; tdma->dma_dev.device_issue_pending = tegra_dma_issue_pending; From patchwork Sun Feb 2 22:28:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11361871 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AC1971398 for ; Sun, 2 Feb 2020 22:30:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8B1292087E for ; Sun, 2 Feb 2020 22:30:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Foz5rILV" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727148AbgBBW3y (ORCPT ); Sun, 2 Feb 2020 17:29:54 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:47036 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727034AbgBBW3y (ORCPT ); Sun, 2 Feb 2020 17:29:54 -0500 Received: by mail-lj1-f195.google.com with SMTP id x14so12554779ljd.13; Sun, 02 Feb 2020 14:29:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZP2sBFBGkO5bsS7Y1zFf5pSNHFa7vlci0txeV2iOQs8=; b=Foz5rILVXxvGYBMBZLrVoGtWArCXNaGGwQ6xHp1AzJMc9crUGa2ucphj3ibX0DovEw mriYWnlneCYIIAflakMGGPTTI+2icDh6V8XZqJvpQTAPZk31yHAOamprgbgPe2CJUrp9 zoW5bbGA3v6nhenmjeGBu7zK5Cwt17OP8ZTgfOSh2ZiVsiEheAA/oifiCEmvcQSElDbm sWbR9Ab+VmcXaFKXr5TCsCIa3xlvP2ULMlSFX7X80X2Cl0CCZLLOjETaEiV1/AOBUXyR /i09JuIkxzURaG8Oo51ZXoXZ94LCbFlKBoeDqv/v1sTvxZTwj623oeMKgYxLxixbuvDB vupw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZP2sBFBGkO5bsS7Y1zFf5pSNHFa7vlci0txeV2iOQs8=; b=hbNiIFhbhbrIcNJR6YpMyXPtG1AMoVMUmA/UJ/fOGXjejTeVS9EdhvwOQ5KPyJYTYM lpH4NwavI8oRE2rjKUSB8oOENgOSmO5gS0bF0dA6qciK3MeyiFoqS2WffIygoXFHLIXK rtbREut/dgYigWFX9kWouK3VLYG/IY6xLiumPV9XZyU2l84fICCYoxbZh7PoYMmZIErI nMrAjgCsuE3zPCE08P8KgO30LM7SUVZj2j5PCcRN8J5QU5RKTtvGQVosOVcV3QzaiuzC fKhSDQN8jdmNPLg0Hfv79T6Kfnl2wH8WXQoPt9CT/LfZ5lxfnPiKPArYCBPRUffnhrmE HqHg== X-Gm-Message-State: APjAAAWl60wygNT4U9wYsCENiKPm+kyUadasizj+O5vOpYO304g7kjjK tt7P0G4fB4WYH1XUDRsT/rxbOQPt X-Google-Smtp-Source: APXvYqzRCGNXj+IOjPjeU03a0TzNCfEW4cu1YI3DZXwXaGg8TKKygCW7AJVzHhjJgyWzM5GUUJvbmg== X-Received: by 2002:a2e:574d:: with SMTP id r13mr11918813ljd.63.1580682592154; Sun, 02 Feb 2020 14:29:52 -0800 (PST) Received: from localhost.localdomain (79-139-233-37.dynamic.spd-mgts.ru. [79.139.233.37]) by smtp.gmail.com with ESMTPSA id b190sm8050307lfd.39.2020.02.02.14.29.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Feb 2020 14:29:51 -0800 (PST) From: Dmitry Osipenko To: Laxman Dewangan , Vinod Koul , Dan Williams , Thierry Reding , Jonathan Hunter , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Cc: dmaengine@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 04/19] dmaengine: tegra-apb: Prevent race conditions on channel's freeing Date: Mon, 3 Feb 2020 01:28:39 +0300 Message-Id: <20200202222854.18409-5-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200202222854.18409-1-digetx@gmail.com> References: <20200202222854.18409-1-digetx@gmail.com> MIME-Version: 1.0 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org It's incorrect to check the channel's "busy" state without taking a lock. That shouldn't cause any real troubles, nevertheless it's always better not to have any race conditions in the code. Acked-by: Jon Hunter Signed-off-by: Dmitry Osipenko --- drivers/dma/tegra20-apb-dma.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c index f56881500a23..766c2c9eac8e 100644 --- a/drivers/dma/tegra20-apb-dma.c +++ b/drivers/dma/tegra20-apb-dma.c @@ -1294,8 +1294,7 @@ static void tegra_dma_free_chan_resources(struct dma_chan *dc) dev_dbg(tdc2dev(tdc), "Freeing channel %d\n", tdc->id); - if (tdc->busy) - tegra_dma_terminate_all(dc); + tegra_dma_terminate_all(dc); spin_lock_irqsave(&tdc->lock, flags); list_splice_init(&tdc->pending_sg_req, &sg_req_list); From patchwork Sun Feb 2 22:28:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11361841 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EB1EB1398 for ; Sun, 2 Feb 2020 22:29:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C364E20658 for ; Sun, 2 Feb 2020 22:29:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fCKGiLwn" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727169AbgBBW34 (ORCPT ); Sun, 2 Feb 2020 17:29:56 -0500 Received: from mail-lf1-f67.google.com ([209.85.167.67]:33009 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727142AbgBBW3z (ORCPT ); Sun, 2 Feb 2020 17:29:55 -0500 Received: by mail-lf1-f67.google.com with SMTP id n25so8399873lfl.0; Sun, 02 Feb 2020 14:29:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GC/z2ZWZ2YFoOCLaKR682od65UK+N/gvRCg6ifsNRc4=; b=fCKGiLwny+rl/sC22taBWekzseGF3PfRzLzxP0yqdXO8SkO/sQFCcvL6Ov7YzP7OEH RWk+ESSb/Qw06cqsMpv4prFkk1fzCGnL3jZRyx5HIgDjqXkQH2s+hLaZj3x/REwim6pz QzePOZYIGDhZ0PQMeVEJMOCk4jVe967C1oX37qX7vmCBXg+ofKnRhlbDL9eAM0mMpi5D fAGWS5ap5qBJ4vga8aTWLwFG+cXwr9LtHH1BoYxQey7CgWoSbFSj9tjF1BBI/OckrJgI 8DW9XWfxNXVeERKeWeKPr9tJXlSVlSXiUSpXLH0lI3dbk4AKKq1OW4lk/El7nAmAOxCD 4Wag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GC/z2ZWZ2YFoOCLaKR682od65UK+N/gvRCg6ifsNRc4=; b=Vb75NJJwzuW57lBwE5S21AQ1j7SwXhJXUNAb3vXvvdMlVqpUa4sRgNLRJKPCleWNv4 8EwQy8fUPpIp2RdSNJTJYBzSAlHm3s+kbLcfp253lbNCbd2QsYH7uSbdlxsXJnhzJPCf VuctUi4dI1ZnJqo/fBmfxfOsC1SOZwmTuSTP8M8uGza5bHmVxAVQdl4rTCYi5IQ9rPUu PI9g1icnvX7kY6Ntjl1JrSHWrKxWsSqRNBpVXCwh/gIKxTKQjrtUN/Ur4IW6+JQJVhI2 BMLW4Va8darktCv5T5wzp94ZMDIWdJqDIdQA4BOdFpzvCj+BesXpiW3tD2wdY0G+1hzJ c22w== X-Gm-Message-State: APjAAAW5AY4KbecGgRNa0uFkz/vBDAUBAOF64d7JK7nB//1PHqCqKzTF jB/sr3bB/WPIYniizg8x94w= X-Google-Smtp-Source: APXvYqyejqLOO2Cz7Nqf8FE0ab5NsMxMcHsODdW3rSsA7pZGAsTDRHR+3MILxRjru071EEBvjHe+jw== X-Received: by 2002:a19:23d0:: with SMTP id j199mr2642264lfj.137.1580682593041; Sun, 02 Feb 2020 14:29:53 -0800 (PST) Received: from localhost.localdomain (79-139-233-37.dynamic.spd-mgts.ru. [79.139.233.37]) by smtp.gmail.com with ESMTPSA id b190sm8050307lfd.39.2020.02.02.14.29.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Feb 2020 14:29:52 -0800 (PST) From: Dmitry Osipenko To: Laxman Dewangan , Vinod Koul , Dan Williams , Thierry Reding , Jonathan Hunter , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Cc: dmaengine@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 05/19] dmaengine: tegra-apb: Clean up tasklet releasing Date: Mon, 3 Feb 2020 01:28:40 +0300 Message-Id: <20200202222854.18409-6-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200202222854.18409-1-digetx@gmail.com> References: <20200202222854.18409-1-digetx@gmail.com> MIME-Version: 1.0 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org There is no need to kill tasklet when driver's probe fails because tasklet can't be scheduled at this time. It is also cleaner to kill tasklet on channel's freeing rather than to kill it on driver's removal, otherwise tasklet could perform a dummy execution after channel's releasing, which isn't very nice. Acked-by: Jon Hunter Signed-off-by: Dmitry Osipenko --- drivers/dma/tegra20-apb-dma.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c index 766c2c9eac8e..aafad50d075e 100644 --- a/drivers/dma/tegra20-apb-dma.c +++ b/drivers/dma/tegra20-apb-dma.c @@ -1287,7 +1287,6 @@ static void tegra_dma_free_chan_resources(struct dma_chan *dc) struct tegra_dma_sg_req *sg_req; struct list_head dma_desc_list; struct list_head sg_req_list; - unsigned long flags; INIT_LIST_HEAD(&dma_desc_list); INIT_LIST_HEAD(&sg_req_list); @@ -1295,15 +1294,14 @@ static void tegra_dma_free_chan_resources(struct dma_chan *dc) dev_dbg(tdc2dev(tdc), "Freeing channel %d\n", tdc->id); tegra_dma_terminate_all(dc); + tasklet_kill(&tdc->tasklet); - spin_lock_irqsave(&tdc->lock, flags); list_splice_init(&tdc->pending_sg_req, &sg_req_list); list_splice_init(&tdc->free_sg_req, &sg_req_list); list_splice_init(&tdc->free_dma_desc, &dma_desc_list); INIT_LIST_HEAD(&tdc->cb_desc); tdc->config_init = false; tdc->isr_handler = NULL; - spin_unlock_irqrestore(&tdc->lock, flags); while (!list_empty(&dma_desc_list)) { dma_desc = list_first_entry(&dma_desc_list, @@ -1542,7 +1540,6 @@ static int tegra_dma_probe(struct platform_device *pdev) struct tegra_dma_channel *tdc = &tdma->channels[i]; free_irq(tdc->irq, tdc); - tasklet_kill(&tdc->tasklet); } pm_runtime_disable(&pdev->dev); @@ -1562,7 +1559,6 @@ static int tegra_dma_remove(struct platform_device *pdev) for (i = 0; i < tdma->chip_data->nr_channels; ++i) { tdc = &tdma->channels[i]; free_irq(tdc->irq, tdc); - tasklet_kill(&tdc->tasklet); } pm_runtime_disable(&pdev->dev); From patchwork Sun Feb 2 22:28:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11361867 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 83D2414B4 for ; Sun, 2 Feb 2020 22:30:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 617A72082E for ; Sun, 2 Feb 2020 22:30:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NLHV/wiP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727180AbgBBW34 (ORCPT ); Sun, 2 Feb 2020 17:29:56 -0500 Received: from mail-lf1-f66.google.com ([209.85.167.66]:33009 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727154AbgBBW34 (ORCPT ); Sun, 2 Feb 2020 17:29:56 -0500 Received: by mail-lf1-f66.google.com with SMTP id n25so8399886lfl.0; Sun, 02 Feb 2020 14:29:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yfyyd1gAYNfQRVTzzie9M6MUShefAhN4x9LLDsJ6WIA=; b=NLHV/wiPfZzmPrjZ1UyodOf2ossRUjX/7bposBEtIXVb6CA0pF8w6INGEI8OcJ07fr OARfQNa2FTBLSgWGhTTP4vSuTG9VLOjGIbMruLYJ9R5GMXCeJ+fDYhRaos/0nh8XVLMm KIL0Zud/paO0xVGkS+/477OJO4GiUOzpyptVdRQm7ESQgMeb5uzjNndXc2OExGFATXmY Y83fwcj74H/0Roiopun2TvvYV4juWdnjxN/rU78V/GE8YK76+wLoQbSsog936sY721VO srbKk1PgeLZixc9RT0EvdbP6c5ZeuiIShp/On8rcM2e4zd1M+e6mHB+YOMLyGu9M1XTB c55A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yfyyd1gAYNfQRVTzzie9M6MUShefAhN4x9LLDsJ6WIA=; b=YXchHGkO1jMwfyieXbX6Krt1M8lzgaNwLCYDS3X8ABIe9GXxsdnBa8n8OEGI6rq/Hr cLY4NE6J++e6p1SOE1QZHEbnLQqfX9mImwl1cgIc8BUfDux7LwaI7rJve4Zq3gAfw1p0 oadJQd54CB6OHGfpnkv1BUQsZVWx2dRoqxB2vjOqipLXiLb+c9F258W1OfmnOyyLh9w8 Gbe4xOg4J3e/l0fvDiyjSz6jEm+DyHnB2v2F8TO6iCx+20ihjGXqJgUIK8tQQJ8dB4PL tggUIjAuaG0ppzSWy01KXqdkveb/5PFd3IIUnTlojDHCKTuCsAAjgNFCcsPRhXkkI1Xk 3zMA== X-Gm-Message-State: APjAAAWSIU6Cc2bXVa7Z3mBUBu7hqWq91kOCWMIzYVE7MuycgJWIDZrk uTfn5E18UXMDzqP32mA104s= X-Google-Smtp-Source: APXvYqz/Kq8S6eLWP0lHLgJKcP5oQESWIj/ZoJu9Ky6H6wxILPV/RTvgQ6kf/894RJRKrsAVKbQgJA== X-Received: by 2002:ac2:4849:: with SMTP id 9mr10303996lfy.11.1580682594100; Sun, 02 Feb 2020 14:29:54 -0800 (PST) Received: from localhost.localdomain (79-139-233-37.dynamic.spd-mgts.ru. [79.139.233.37]) by smtp.gmail.com with ESMTPSA id b190sm8050307lfd.39.2020.02.02.14.29.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Feb 2020 14:29:53 -0800 (PST) From: Dmitry Osipenko To: Laxman Dewangan , Vinod Koul , Dan Williams , Thierry Reding , Jonathan Hunter , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Cc: dmaengine@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 06/19] dmaengine: tegra-apb: Use devm_platform_ioremap_resource Date: Mon, 3 Feb 2020 01:28:41 +0300 Message-Id: <20200202222854.18409-7-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200202222854.18409-1-digetx@gmail.com> References: <20200202222854.18409-1-digetx@gmail.com> MIME-Version: 1.0 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org Use devm_platform_ioremap_resource to keep code cleaner a tad. Acked-by: Jon Hunter Signed-off-by: Dmitry Osipenko --- drivers/dma/tegra20-apb-dma.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c index aafad50d075e..f44291207928 100644 --- a/drivers/dma/tegra20-apb-dma.c +++ b/drivers/dma/tegra20-apb-dma.c @@ -1402,8 +1402,7 @@ static int tegra_dma_probe(struct platform_device *pdev) tdma->chip_data = cdata; platform_set_drvdata(pdev, tdma); - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - tdma->base_addr = devm_ioremap_resource(&pdev->dev, res); + tdma->base_addr = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(tdma->base_addr)) return PTR_ERR(tdma->base_addr); From patchwork Sun Feb 2 22:28:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11361869 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F18401398 for ; Sun, 2 Feb 2020 22:30:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C504B2087E for ; Sun, 2 Feb 2020 22:30:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GSgA5sin" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727198AbgBBWaw (ORCPT ); Sun, 2 Feb 2020 17:30:52 -0500 Received: from mail-lf1-f65.google.com ([209.85.167.65]:44996 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727034AbgBBW35 (ORCPT ); Sun, 2 Feb 2020 17:29:57 -0500 Received: by mail-lf1-f65.google.com with SMTP id v201so8332942lfa.11; Sun, 02 Feb 2020 14:29:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iIeXeqWybCn0khYUW1LlWp0vQo+B3g3sVK/buP+mLKA=; b=GSgA5sinURsKJzokpH9byrODCH2UCS0yyqX0plpxTjmqSRuLU+euElXG/b+lwyNCMy e4mDpJtH331DYBkZOTrRkRrplHztE42eioL1cfJQlQ8qw31yDrVvUx8/+byzsfdfBjAT qpqu1pB771P5C337sDqrRlZ/EOyHyEYJJ1lc/a21yAU3YdnU7heRuOeV5M9SJxVB8Fc2 mdl3d5Le0QxHq7zesU83Vy8v5wWXQFQYoAZF8cLJ+BDu87Ap/wrBwyQmadznK8BUh5Pf Zq7XSCgRbv8Z7WxIH75+XIa4HeOlkQrVJMpYUuy9RLJ2JJE/8+Kt+Q9vOIQ3tlbTX676 NVKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iIeXeqWybCn0khYUW1LlWp0vQo+B3g3sVK/buP+mLKA=; b=LnkSKob7tpCVwE/ZG6KqyW0qxmvU3l9KLEwg8RDbtQv+1JNQTkhQI9HjuB7oHU/8C2 EODFFQ6hE1zoSoAfbqmJyNTsdel1QZh4Pzw/gfSqvy9wDhFXuEL1Ea/M5dJMVTNap2jC 5uA0gXY5fONA4GltTixHLICe/hU6VXoviwudv+QmXgLXCwgIrQ3VqVbXw1jz+Nob0F6d 8giFBCcT+VMpRN9xTBQahm4qKlhH7+lznJwnj29ktCUAp0DbqU9Cyy9+ZbtIbu6BFkVR 8tuS6gloPOi6z8AS2iv/u8IQO9a1novabU1cVsesbRzgjIdyi+KU7T+hvR1NYZTrIkgT QNug== X-Gm-Message-State: APjAAAUqNSya1Ow+LgnKgMF5boCE5RoGy8n7RXnrxADdxgXOC+jxhkod wogF3l2kd8c35gfQVgV+Hc0I0/H7 X-Google-Smtp-Source: APXvYqxk+fSiEVrkrrG+JlcJRvG2Im3oDtktNgZrbpGITdaHwfF735CLCYSjpeuS8w884HPb+cqMnQ== X-Received: by 2002:a19:cc07:: with SMTP id c7mr10465320lfg.177.1580682595078; Sun, 02 Feb 2020 14:29:55 -0800 (PST) Received: from localhost.localdomain (79-139-233-37.dynamic.spd-mgts.ru. [79.139.233.37]) by smtp.gmail.com with ESMTPSA id b190sm8050307lfd.39.2020.02.02.14.29.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Feb 2020 14:29:54 -0800 (PST) From: Dmitry Osipenko To: Laxman Dewangan , Vinod Koul , Dan Williams , Thierry Reding , Jonathan Hunter , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Cc: dmaengine@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 07/19] dmaengine: tegra-apb: Use devm_request_irq Date: Mon, 3 Feb 2020 01:28:42 +0300 Message-Id: <20200202222854.18409-8-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200202222854.18409-1-digetx@gmail.com> References: <20200202222854.18409-1-digetx@gmail.com> MIME-Version: 1.0 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org Use resource-managed variant of request_irq for brevity. Acked-by: Jon Hunter Signed-off-by: Dmitry Osipenko --- drivers/dma/tegra20-apb-dma.c | 35 +++++++++++------------------------ 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c index f44291207928..dff21e80ffa4 100644 --- a/drivers/dma/tegra20-apb-dma.c +++ b/drivers/dma/tegra20-apb-dma.c @@ -182,7 +182,6 @@ struct tegra_dma_channel { char name[12]; bool config_init; int id; - int irq; void __iomem *chan_addr; spinlock_t lock; bool busy; @@ -1380,7 +1379,6 @@ static const struct tegra_dma_chip_data tegra148_dma_chip_data = { static int tegra_dma_probe(struct platform_device *pdev) { - struct resource *res; struct tegra_dma *tdma; int ret; int i; @@ -1446,25 +1444,27 @@ static int tegra_dma_probe(struct platform_device *pdev) INIT_LIST_HEAD(&tdma->dma_dev.channels); for (i = 0; i < cdata->nr_channels; i++) { struct tegra_dma_channel *tdc = &tdma->channels[i]; + int irq; tdc->chan_addr = tdma->base_addr + TEGRA_APBDMA_CHANNEL_BASE_ADD_OFFSET + (i * cdata->channel_reg_size); - res = platform_get_resource(pdev, IORESOURCE_IRQ, i); - if (!res) { - ret = -EINVAL; + irq = platform_get_irq(pdev, i); + if (irq < 0) { + ret = irq; dev_err(&pdev->dev, "No irq resource for chan %d\n", i); - goto err_irq; + goto err_pm_disable; } - tdc->irq = res->start; + snprintf(tdc->name, sizeof(tdc->name), "apbdma.%d", i); - ret = request_irq(tdc->irq, tegra_dma_isr, 0, tdc->name, tdc); + ret = devm_request_irq(&pdev->dev, irq, tegra_dma_isr, 0, + tdc->name, tdc); if (ret) { dev_err(&pdev->dev, "request_irq failed with err %d channel %d\n", ret, i); - goto err_irq; + goto err_pm_disable; } tdc->dma_chan.device = &tdma->dma_dev; @@ -1517,7 +1517,7 @@ static int tegra_dma_probe(struct platform_device *pdev) if (ret < 0) { dev_err(&pdev->dev, "Tegra20 APB DMA driver registration failed %d\n", ret); - goto err_irq; + goto err_pm_disable; } ret = of_dma_controller_register(pdev->dev.of_node, @@ -1534,13 +1534,7 @@ static int tegra_dma_probe(struct platform_device *pdev) err_unregister_dma_dev: dma_async_device_unregister(&tdma->dma_dev); -err_irq: - while (--i >= 0) { - struct tegra_dma_channel *tdc = &tdma->channels[i]; - - free_irq(tdc->irq, tdc); - } - +err_pm_disable: pm_runtime_disable(&pdev->dev); if (!pm_runtime_status_suspended(&pdev->dev)) tegra_dma_runtime_suspend(&pdev->dev); @@ -1550,16 +1544,9 @@ static int tegra_dma_probe(struct platform_device *pdev) static int tegra_dma_remove(struct platform_device *pdev) { struct tegra_dma *tdma = platform_get_drvdata(pdev); - int i; - struct tegra_dma_channel *tdc; dma_async_device_unregister(&tdma->dma_dev); - for (i = 0; i < tdma->chip_data->nr_channels; ++i) { - tdc = &tdma->channels[i]; - free_irq(tdc->irq, tdc); - } - pm_runtime_disable(&pdev->dev); if (!pm_runtime_status_suspended(&pdev->dev)) tegra_dma_runtime_suspend(&pdev->dev); From patchwork Sun Feb 2 22:28:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11361863 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 56E5514B4 for ; Sun, 2 Feb 2020 22:30:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 17B542084E for ; Sun, 2 Feb 2020 22:30:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Y/d+H29v" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727210AbgBBWaA (ORCPT ); Sun, 2 Feb 2020 17:30:00 -0500 Received: from mail-lf1-f68.google.com ([209.85.167.68]:44999 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727185AbgBBW37 (ORCPT ); Sun, 2 Feb 2020 17:29:59 -0500 Received: by mail-lf1-f68.google.com with SMTP id v201so8332958lfa.11; Sun, 02 Feb 2020 14:29:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=px0ZMFqZZ7nOhjXoG4C7Max9iwkk+IiVhi7Ai505Rxg=; b=Y/d+H29vqmSQYs3XUjpNZQ73hRcQJ0TQlnDnkWgAqs9icg6XZU+gHAXRPM5ESNLW8F G+oZQ/Fu8BndsOiRnddI/P0+0YQxwuslA+DP5eYWo1hS9uQ80yekwYrx6P58vXDXvwF2 NLGmWB2vQ8PTGUw2SSwKcSfN/y5GUx6KUrA6bQEpltkjd48oLO/QMv7sGjdLjaop9I90 yTHq1THyp5tSSxA8vzmXjLvEzSrHCp7shYSbqi8XYdmX1NJ5IeWqvpmP0xSEulWfqF8A 3CcbJaTC0gDGSNfrHFnXfWVgqTMCBXo/hllwajm389brG8ZbiKtGV2wDlo1CPGeqnF0s SJCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=px0ZMFqZZ7nOhjXoG4C7Max9iwkk+IiVhi7Ai505Rxg=; b=X25OsY8Twcj3tEH/TJyVWTZAyfkhB2DQBZXRKVRBMcmmpj4urw4mgsrg535UC8TeNg aHHCtgtHgmQm3+Ov9uujvJBvYTJ1xPN8jx3zjxPvRmZ8I6mdT9ecwXj2/wCLCALEqwa0 N26dQvh3mcA51NPsWzIEHZkFiAC/J62MxBLiLM80XAz4BUUixvMg59yrOk/dbj/sFI4i XeVa9h+qKxQ+04WilfmoBwjugXmLTiD3Y1CdIghPIRbzg6598o/jpJowDRuPgo6fwkVo tzCfIGMZEZDxW4TxV9D02znoO4nVLHXGChEak/fb7y27t1aFhn/QIQv0LAIbVatDkgF5 IzKA== X-Gm-Message-State: APjAAAXxGbMqvIAEL+x6bldf0f6ufhg4Fn6pQ3ST70FKZPkHR11JnSsP GsaT0elkl0rmMOAvYjtMMtw= X-Google-Smtp-Source: APXvYqxGBH/4VtFTWTgu8aZJYMRdHHwFxESw4QxHIG3HvvMfoEYt9DijDdmtyv9AZ3CyQpExVN5+RA== X-Received: by 2002:ac2:51de:: with SMTP id u30mr10084937lfm.69.1580682596054; Sun, 02 Feb 2020 14:29:56 -0800 (PST) Received: from localhost.localdomain (79-139-233-37.dynamic.spd-mgts.ru. [79.139.233.37]) by smtp.gmail.com with ESMTPSA id b190sm8050307lfd.39.2020.02.02.14.29.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Feb 2020 14:29:55 -0800 (PST) From: Dmitry Osipenko To: Laxman Dewangan , Vinod Koul , Dan Williams , Thierry Reding , Jonathan Hunter , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Cc: dmaengine@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 08/19] dmaengine: tegra-apb: Fix coding style problems Date: Mon, 3 Feb 2020 01:28:43 +0300 Message-Id: <20200202222854.18409-9-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200202222854.18409-1-digetx@gmail.com> References: <20200202222854.18409-1-digetx@gmail.com> MIME-Version: 1.0 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org This patch fixes few dozens of coding style problems reported by checkpatch and prettifies code where makes sense. Acked-by: Jon Hunter Signed-off-by: Dmitry Osipenko --- drivers/dma/tegra20-apb-dma.c | 275 ++++++++++++++++++---------------- 1 file changed, 144 insertions(+), 131 deletions(-) diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c index dff21e80ffa4..b4535b3a07ce 100644 --- a/drivers/dma/tegra20-apb-dma.c +++ b/drivers/dma/tegra20-apb-dma.c @@ -59,7 +59,7 @@ #define TEGRA_APBDMA_STATUS_COUNT_MASK 0xFFFC #define TEGRA_APBDMA_CHAN_CSRE 0x00C -#define TEGRA_APBDMA_CHAN_CSRE_PAUSE (1 << 31) +#define TEGRA_APBDMA_CHAN_CSRE_PAUSE BIT(31) /* AHB memory address */ #define TEGRA_APBDMA_CHAN_AHBPTR 0x010 @@ -120,21 +120,21 @@ struct tegra_dma; * @support_separate_wcount_reg: Support separate word count register. */ struct tegra_dma_chip_data { - int nr_channels; - int channel_reg_size; - int max_dma_count; + unsigned int nr_channels; + unsigned int channel_reg_size; + unsigned int max_dma_count; bool support_channel_pause; bool support_separate_wcount_reg; }; /* DMA channel registers */ struct tegra_dma_channel_regs { - unsigned long csr; - unsigned long ahb_ptr; - unsigned long apb_ptr; - unsigned long ahb_seq; - unsigned long apb_seq; - unsigned long wcount; + u32 csr; + u32 ahb_ptr; + u32 apb_ptr; + u32 ahb_seq; + u32 apb_seq; + u32 wcount; }; /* @@ -168,7 +168,7 @@ struct tegra_dma_desc { struct list_head node; struct list_head tx_list; struct list_head cb_node; - int cb_count; + unsigned int cb_count; }; struct tegra_dma_channel; @@ -181,7 +181,7 @@ struct tegra_dma_channel { struct dma_chan dma_chan; char name[12]; bool config_init; - int id; + unsigned int id; void __iomem *chan_addr; spinlock_t lock; bool busy; @@ -201,7 +201,7 @@ struct tegra_dma_channel { /* Channel-slave specific configuration */ unsigned int slave_id; struct dma_slave_config dma_sconfig; - struct tegra_dma_channel_regs channel_reg; + struct tegra_dma_channel_regs channel_reg; }; /* tegra_dma: Tegra DMA specific information */ @@ -239,7 +239,7 @@ static inline u32 tdma_read(struct tegra_dma *tdma, u32 reg) } static inline void tdc_write(struct tegra_dma_channel *tdc, - u32 reg, u32 val) + u32 reg, u32 val) { writel(val, tdc->chan_addr + reg); } @@ -254,8 +254,8 @@ static inline struct tegra_dma_channel *to_tegra_dma_chan(struct dma_chan *dc) return container_of(dc, struct tegra_dma_channel, dma_chan); } -static inline struct tegra_dma_desc *txd_to_tegra_dma_desc( - struct dma_async_tx_descriptor *td) +static inline struct tegra_dma_desc * +txd_to_tegra_dma_desc(struct dma_async_tx_descriptor *td) { return container_of(td, struct tegra_dma_desc, txd); } @@ -270,8 +270,7 @@ static int tegra_dma_runtime_suspend(struct device *dev); static int tegra_dma_runtime_resume(struct device *dev); /* Get DMA desc from free list, if not there then allocate it. */ -static struct tegra_dma_desc *tegra_dma_desc_get( - struct tegra_dma_channel *tdc) +static struct tegra_dma_desc *tegra_dma_desc_get(struct tegra_dma_channel *tdc) { struct tegra_dma_desc *dma_desc; unsigned long flags; @@ -298,11 +297,12 @@ static struct tegra_dma_desc *tegra_dma_desc_get( dma_async_tx_descriptor_init(&dma_desc->txd, &tdc->dma_chan); dma_desc->txd.tx_submit = tegra_dma_tx_submit; dma_desc->txd.flags = 0; + return dma_desc; } static void tegra_dma_desc_put(struct tegra_dma_channel *tdc, - struct tegra_dma_desc *dma_desc) + struct tegra_dma_desc *dma_desc) { unsigned long flags; @@ -313,29 +313,29 @@ static void tegra_dma_desc_put(struct tegra_dma_channel *tdc, spin_unlock_irqrestore(&tdc->lock, flags); } -static struct tegra_dma_sg_req *tegra_dma_sg_req_get( - struct tegra_dma_channel *tdc) +static struct tegra_dma_sg_req * +tegra_dma_sg_req_get(struct tegra_dma_channel *tdc) { - struct tegra_dma_sg_req *sg_req = NULL; + struct tegra_dma_sg_req *sg_req; unsigned long flags; spin_lock_irqsave(&tdc->lock, flags); if (!list_empty(&tdc->free_sg_req)) { - sg_req = list_first_entry(&tdc->free_sg_req, - typeof(*sg_req), node); + sg_req = list_first_entry(&tdc->free_sg_req, typeof(*sg_req), + node); list_del(&sg_req->node); spin_unlock_irqrestore(&tdc->lock, flags); return sg_req; } spin_unlock_irqrestore(&tdc->lock, flags); - sg_req = kzalloc(sizeof(struct tegra_dma_sg_req), GFP_NOWAIT); + sg_req = kzalloc(sizeof(*sg_req), GFP_NOWAIT); return sg_req; } static int tegra_dma_slave_config(struct dma_chan *dc, - struct dma_slave_config *sconfig) + struct dma_slave_config *sconfig) { struct tegra_dma_channel *tdc = to_tegra_dma_chan(dc); @@ -352,11 +352,12 @@ static int tegra_dma_slave_config(struct dma_chan *dc, tdc->slave_id = sconfig->slave_id; } tdc->config_init = true; + return 0; } static void tegra_dma_global_pause(struct tegra_dma_channel *tdc, - bool wait_for_burst_complete) + bool wait_for_burst_complete) { struct tegra_dma *tdma = tdc->tdma; @@ -391,13 +392,13 @@ static void tegra_dma_global_resume(struct tegra_dma_channel *tdc) } static void tegra_dma_pause(struct tegra_dma_channel *tdc, - bool wait_for_burst_complete) + bool wait_for_burst_complete) { struct tegra_dma *tdma = tdc->tdma; if (tdma->chip_data->support_channel_pause) { tdc_write(tdc, TEGRA_APBDMA_CHAN_CSRE, - TEGRA_APBDMA_CHAN_CSRE_PAUSE); + TEGRA_APBDMA_CHAN_CSRE_PAUSE); if (wait_for_burst_complete) udelay(TEGRA_APBDMA_BURST_COMPLETE_TIME); } else { @@ -409,17 +410,15 @@ static void tegra_dma_resume(struct tegra_dma_channel *tdc) { struct tegra_dma *tdma = tdc->tdma; - if (tdma->chip_data->support_channel_pause) { + if (tdma->chip_data->support_channel_pause) tdc_write(tdc, TEGRA_APBDMA_CHAN_CSRE, 0); - } else { + else tegra_dma_global_resume(tdc); - } } static void tegra_dma_stop(struct tegra_dma_channel *tdc) { - u32 csr; - u32 status; + u32 csr, status; /* Disable interrupts */ csr = tdc_read(tdc, TEGRA_APBDMA_CHAN_CSR); @@ -440,7 +439,7 @@ static void tegra_dma_stop(struct tegra_dma_channel *tdc) } static void tegra_dma_start(struct tegra_dma_channel *tdc, - struct tegra_dma_sg_req *sg_req) + struct tegra_dma_sg_req *sg_req) { struct tegra_dma_channel_regs *ch_regs = &sg_req->ch_regs; @@ -454,11 +453,11 @@ static void tegra_dma_start(struct tegra_dma_channel *tdc, /* Start DMA */ tdc_write(tdc, TEGRA_APBDMA_CHAN_CSR, - ch_regs->csr | TEGRA_APBDMA_CSR_ENB); + ch_regs->csr | TEGRA_APBDMA_CSR_ENB); } static void tegra_dma_configure_for_next(struct tegra_dma_channel *tdc, - struct tegra_dma_sg_req *nsg_req) + struct tegra_dma_sg_req *nsg_req) { unsigned long status; @@ -492,9 +491,9 @@ static void tegra_dma_configure_for_next(struct tegra_dma_channel *tdc, tdc_write(tdc, TEGRA_APBDMA_CHAN_AHBPTR, nsg_req->ch_regs.ahb_ptr); if (tdc->tdma->chip_data->support_separate_wcount_reg) tdc_write(tdc, TEGRA_APBDMA_CHAN_WCOUNT, - nsg_req->ch_regs.wcount); + nsg_req->ch_regs.wcount); tdc_write(tdc, TEGRA_APBDMA_CHAN_CSR, - nsg_req->ch_regs.csr | TEGRA_APBDMA_CSR_ENB); + nsg_req->ch_regs.csr | TEGRA_APBDMA_CSR_ENB); nsg_req->configured = true; nsg_req->words_xferred = 0; @@ -508,8 +507,7 @@ static void tdc_start_head_req(struct tegra_dma_channel *tdc) if (list_empty(&tdc->pending_sg_req)) return; - sg_req = list_first_entry(&tdc->pending_sg_req, - typeof(*sg_req), node); + sg_req = list_first_entry(&tdc->pending_sg_req, typeof(*sg_req), node); tegra_dma_start(tdc, sg_req); sg_req->configured = true; sg_req->words_xferred = 0; @@ -518,34 +516,35 @@ static void tdc_start_head_req(struct tegra_dma_channel *tdc) static void tdc_configure_next_head_desc(struct tegra_dma_channel *tdc) { - struct tegra_dma_sg_req *hsgreq; - struct tegra_dma_sg_req *hnsgreq; + struct tegra_dma_sg_req *hsgreq, *hnsgreq; if (list_empty(&tdc->pending_sg_req)) return; hsgreq = list_first_entry(&tdc->pending_sg_req, typeof(*hsgreq), node); if (!list_is_last(&hsgreq->node, &tdc->pending_sg_req)) { - hnsgreq = list_first_entry(&hsgreq->node, - typeof(*hnsgreq), node); + hnsgreq = list_first_entry(&hsgreq->node, typeof(*hnsgreq), + node); tegra_dma_configure_for_next(tdc, hnsgreq); } } -static inline int get_current_xferred_count(struct tegra_dma_channel *tdc, - struct tegra_dma_sg_req *sg_req, unsigned long status) +static inline unsigned int +get_current_xferred_count(struct tegra_dma_channel *tdc, + struct tegra_dma_sg_req *sg_req, + unsigned long status) { return sg_req->req_len - (status & TEGRA_APBDMA_STATUS_COUNT_MASK) - 4; } static void tegra_dma_abort_all(struct tegra_dma_channel *tdc) { - struct tegra_dma_sg_req *sgreq; struct tegra_dma_desc *dma_desc; + struct tegra_dma_sg_req *sgreq; while (!list_empty(&tdc->pending_sg_req)) { - sgreq = list_first_entry(&tdc->pending_sg_req, - typeof(*sgreq), node); + sgreq = list_first_entry(&tdc->pending_sg_req, typeof(*sgreq), + node); list_move_tail(&sgreq->node, &tdc->free_sg_req); if (sgreq->last_sg) { dma_desc = sgreq->dma_desc; @@ -555,7 +554,7 @@ static void tegra_dma_abort_all(struct tegra_dma_channel *tdc) /* Add in cb list if it is not there. */ if (!dma_desc->cb_count) list_add_tail(&dma_desc->cb_node, - &tdc->cb_desc); + &tdc->cb_desc); dma_desc->cb_count++; } } @@ -563,9 +562,10 @@ static void tegra_dma_abort_all(struct tegra_dma_channel *tdc) } static bool handle_continuous_head_request(struct tegra_dma_channel *tdc, - struct tegra_dma_sg_req *last_sg_req, bool to_terminate) + struct tegra_dma_sg_req *last_sg_req, + bool to_terminate) { - struct tegra_dma_sg_req *hsgreq = NULL; + struct tegra_dma_sg_req *hsgreq; if (list_empty(&tdc->pending_sg_req)) { dev_err(tdc2dev(tdc), "DMA is running without req\n"); @@ -589,14 +589,15 @@ static bool handle_continuous_head_request(struct tegra_dma_channel *tdc, /* Configure next request */ if (!to_terminate) tdc_configure_next_head_desc(tdc); + return true; } static void handle_once_dma_done(struct tegra_dma_channel *tdc, - bool to_terminate) + bool to_terminate) { - struct tegra_dma_sg_req *sgreq; struct tegra_dma_desc *dma_desc; + struct tegra_dma_sg_req *sgreq; tdc->busy = false; sgreq = list_first_entry(&tdc->pending_sg_req, typeof(*sgreq), node); @@ -622,10 +623,10 @@ static void handle_once_dma_done(struct tegra_dma_channel *tdc, } static void handle_cont_sngl_cycle_dma_done(struct tegra_dma_channel *tdc, - bool to_terminate) + bool to_terminate) { - struct tegra_dma_sg_req *sgreq; struct tegra_dma_desc *dma_desc; + struct tegra_dma_sg_req *sgreq; bool st; sgreq = list_first_entry(&tdc->pending_sg_req, typeof(*sgreq), node); @@ -657,13 +658,13 @@ static void tegra_dma_tasklet(unsigned long data) struct tegra_dma_channel *tdc = (struct tegra_dma_channel *)data; struct dmaengine_desc_callback cb; struct tegra_dma_desc *dma_desc; + unsigned int cb_count; unsigned long flags; - int cb_count; spin_lock_irqsave(&tdc->lock, flags); while (!list_empty(&tdc->cb_desc)) { - dma_desc = list_first_entry(&tdc->cb_desc, - typeof(*dma_desc), cb_node); + dma_desc = list_first_entry(&tdc->cb_desc, typeof(*dma_desc), + cb_node); list_del(&dma_desc->cb_node); dmaengine_desc_get_callback(&dma_desc->txd, &cb); cb_count = dma_desc->cb_count; @@ -681,8 +682,8 @@ static void tegra_dma_tasklet(unsigned long data) static irqreturn_t tegra_dma_isr(int irq, void *dev_id) { struct tegra_dma_channel *tdc = dev_id; - unsigned long status; unsigned long flags; + u32 status; spin_lock_irqsave(&tdc->lock, flags); @@ -697,8 +698,9 @@ static irqreturn_t tegra_dma_isr(int irq, void *dev_id) } spin_unlock_irqrestore(&tdc->lock, flags); - dev_info(tdc2dev(tdc), - "Interrupt already served status 0x%08lx\n", status); + dev_info(tdc2dev(tdc), "Interrupt already served status 0x%08x\n", + status); + return IRQ_NONE; } @@ -714,6 +716,7 @@ static dma_cookie_t tegra_dma_tx_submit(struct dma_async_tx_descriptor *txd) cookie = dma_cookie_assign(&dma_desc->txd); list_splice_tail_init(&dma_desc->tx_list, &tdc->pending_sg_req); spin_unlock_irqrestore(&tdc->lock, flags); + return cookie; } @@ -747,11 +750,10 @@ static void tegra_dma_issue_pending(struct dma_chan *dc) static int tegra_dma_terminate_all(struct dma_chan *dc) { struct tegra_dma_channel *tdc = to_tegra_dma_chan(dc); - struct tegra_dma_sg_req *sgreq; struct tegra_dma_desc *dma_desc; + struct tegra_dma_sg_req *sgreq; unsigned long flags; - unsigned long status; - unsigned long wcount; + u32 status, wcount; bool was_busy; spin_lock_irqsave(&tdc->lock, flags); @@ -777,8 +779,8 @@ static int tegra_dma_terminate_all(struct dma_chan *dc) tegra_dma_stop(tdc); if (!list_empty(&tdc->pending_sg_req) && was_busy) { - sgreq = list_first_entry(&tdc->pending_sg_req, - typeof(*sgreq), node); + sgreq = list_first_entry(&tdc->pending_sg_req, typeof(*sgreq), + node); sgreq->dma_desc->bytes_transferred += get_current_xferred_count(tdc, sgreq, wcount); } @@ -788,12 +790,13 @@ static int tegra_dma_terminate_all(struct dma_chan *dc) tegra_dma_abort_all(tdc); while (!list_empty(&tdc->cb_desc)) { - dma_desc = list_first_entry(&tdc->cb_desc, - typeof(*dma_desc), cb_node); + dma_desc = list_first_entry(&tdc->cb_desc, typeof(*dma_desc), + cb_node); list_del(&dma_desc->cb_node); dma_desc->cb_count = 0; } spin_unlock_irqrestore(&tdc->lock, flags); + return 0; } @@ -807,7 +810,7 @@ static void tegra_dma_synchronize(struct dma_chan *dc) static unsigned int tegra_dma_sg_bytes_xferred(struct tegra_dma_channel *tdc, struct tegra_dma_sg_req *sg_req) { - unsigned long status, wcount = 0; + u32 status, wcount = 0; if (!list_is_first(&sg_req->node, &tdc->pending_sg_req)) return 0; @@ -864,7 +867,8 @@ static unsigned int tegra_dma_sg_bytes_xferred(struct tegra_dma_channel *tdc, } static enum dma_status tegra_dma_tx_status(struct dma_chan *dc, - dma_cookie_t cookie, struct dma_tx_state *txstate) + dma_cookie_t cookie, + struct dma_tx_state *txstate) { struct tegra_dma_channel *tdc = to_tegra_dma_chan(dc); struct tegra_dma_desc *dma_desc; @@ -911,11 +915,12 @@ static enum dma_status tegra_dma_tx_status(struct dma_chan *dc, trace_tegra_dma_tx_status(&tdc->dma_chan, cookie, txstate); spin_unlock_irqrestore(&tdc->lock, flags); + return ret; } -static inline int get_bus_width(struct tegra_dma_channel *tdc, - enum dma_slave_buswidth slave_bw) +static inline unsigned int get_bus_width(struct tegra_dma_channel *tdc, + enum dma_slave_buswidth slave_bw) { switch (slave_bw) { case DMA_SLAVE_BUSWIDTH_1_BYTE: @@ -928,16 +933,17 @@ static inline int get_bus_width(struct tegra_dma_channel *tdc, return TEGRA_APBDMA_APBSEQ_BUS_WIDTH_64; default: dev_warn(tdc2dev(tdc), - "slave bw is not supported, using 32bits\n"); + "slave bw is not supported, using 32bits\n"); return TEGRA_APBDMA_APBSEQ_BUS_WIDTH_32; } } -static inline int get_burst_size(struct tegra_dma_channel *tdc, - u32 burst_size, enum dma_slave_buswidth slave_bw, int len) +static inline unsigned int get_burst_size(struct tegra_dma_channel *tdc, + u32 burst_size, + enum dma_slave_buswidth slave_bw, + u32 len) { - int burst_byte; - int burst_ahb_width; + unsigned int burst_byte, burst_ahb_width; /* * burst_size from client is in terms of the bus_width. @@ -964,9 +970,12 @@ static inline int get_burst_size(struct tegra_dma_channel *tdc, } static int get_transfer_param(struct tegra_dma_channel *tdc, - enum dma_transfer_direction direction, unsigned long *apb_addr, - unsigned long *apb_seq, unsigned long *csr, unsigned int *burst_size, - enum dma_slave_buswidth *slave_bw) + enum dma_transfer_direction direction, + u32 *apb_addr, + u32 *apb_seq, + u32 *csr, + unsigned int *burst_size, + enum dma_slave_buswidth *slave_bw) { switch (direction) { case DMA_MEM_TO_DEV: @@ -987,13 +996,15 @@ static int get_transfer_param(struct tegra_dma_channel *tdc, default: dev_err(tdc2dev(tdc), "DMA direction is not supported\n"); - return -EINVAL; + break; } + return -EINVAL; } static void tegra_dma_prep_wcount(struct tegra_dma_channel *tdc, - struct tegra_dma_channel_regs *ch_regs, u32 len) + struct tegra_dma_channel_regs *ch_regs, + u32 len) { u32 len_field = (len - 4) & 0xFFFC; @@ -1003,20 +1014,23 @@ static void tegra_dma_prep_wcount(struct tegra_dma_channel *tdc, ch_regs->csr |= len_field; } -static struct dma_async_tx_descriptor *tegra_dma_prep_slave_sg( - struct dma_chan *dc, struct scatterlist *sgl, unsigned int sg_len, - enum dma_transfer_direction direction, unsigned long flags, - void *context) +static struct dma_async_tx_descriptor * +tegra_dma_prep_slave_sg(struct dma_chan *dc, + struct scatterlist *sgl, + unsigned int sg_len, + enum dma_transfer_direction direction, + unsigned long flags, + void *context) { struct tegra_dma_channel *tdc = to_tegra_dma_chan(dc); + struct tegra_dma_sg_req *sg_req = NULL; + u32 csr, ahb_seq, apb_ptr, apb_seq; + enum dma_slave_buswidth slave_bw; struct tegra_dma_desc *dma_desc; - unsigned int i; - struct scatterlist *sg; - unsigned long csr, ahb_seq, apb_ptr, apb_seq; struct list_head req_list; - struct tegra_dma_sg_req *sg_req = NULL; - u32 burst_size; - enum dma_slave_buswidth slave_bw; + struct scatterlist *sg; + unsigned int burst_size; + unsigned int i; if (!tdc->config_init) { dev_err(tdc2dev(tdc), "DMA channel is not configured\n"); @@ -1028,7 +1042,7 @@ static struct dma_async_tx_descriptor *tegra_dma_prep_slave_sg( } if (get_transfer_param(tdc, direction, &apb_ptr, &apb_seq, &csr, - &burst_size, &slave_bw) < 0) + &burst_size, &slave_bw) < 0) return NULL; INIT_LIST_HEAD(&req_list); @@ -1074,7 +1088,7 @@ static struct dma_async_tx_descriptor *tegra_dma_prep_slave_sg( len = sg_dma_len(sg); if ((len & 3) || (mem & 3) || - (len > tdc->tdma->chip_data->max_dma_count)) { + len > tdc->tdma->chip_data->max_dma_count) { dev_err(tdc2dev(tdc), "DMA length/memory address is not supported\n"); tegra_dma_desc_put(tdc, dma_desc); @@ -1126,20 +1140,21 @@ static struct dma_async_tx_descriptor *tegra_dma_prep_slave_sg( return &dma_desc->txd; } -static struct dma_async_tx_descriptor *tegra_dma_prep_dma_cyclic( - struct dma_chan *dc, dma_addr_t buf_addr, size_t buf_len, - size_t period_len, enum dma_transfer_direction direction, - unsigned long flags) +static struct dma_async_tx_descriptor * +tegra_dma_prep_dma_cyclic(struct dma_chan *dc, dma_addr_t buf_addr, + size_t buf_len, + size_t period_len, + enum dma_transfer_direction direction, + unsigned long flags) { struct tegra_dma_channel *tdc = to_tegra_dma_chan(dc); - struct tegra_dma_desc *dma_desc = NULL; struct tegra_dma_sg_req *sg_req = NULL; - unsigned long csr, ahb_seq, apb_ptr, apb_seq; - int len; - size_t remain_len; - dma_addr_t mem = buf_addr; - u32 burst_size; + u32 csr, ahb_seq, apb_ptr, apb_seq; enum dma_slave_buswidth slave_bw; + struct tegra_dma_desc *dma_desc; + dma_addr_t mem = buf_addr; + unsigned int burst_size; + size_t len, remain_len; if (!buf_len || !period_len) { dev_err(tdc2dev(tdc), "Invalid buffer/period len\n"); @@ -1173,13 +1188,13 @@ static struct dma_async_tx_descriptor *tegra_dma_prep_dma_cyclic( len = period_len; if ((len & 3) || (buf_addr & 3) || - (len > tdc->tdma->chip_data->max_dma_count)) { + len > tdc->tdma->chip_data->max_dma_count) { dev_err(tdc2dev(tdc), "Req len/mem address is not correct\n"); return NULL; } if (get_transfer_param(tdc, direction, &apb_ptr, &apb_seq, &csr, - &burst_size, &slave_bw) < 0) + &burst_size, &slave_bw) < 0) return NULL; ahb_seq = TEGRA_APBDMA_AHBSEQ_INTR_ENB; @@ -1303,8 +1318,8 @@ static void tegra_dma_free_chan_resources(struct dma_chan *dc) tdc->isr_handler = NULL; while (!list_empty(&dma_desc_list)) { - dma_desc = list_first_entry(&dma_desc_list, - typeof(*dma_desc), node); + dma_desc = list_first_entry(&dma_desc_list, typeof(*dma_desc), + node); list_del(&dma_desc->node); kfree(dma_desc); } @@ -1323,8 +1338,8 @@ static struct dma_chan *tegra_dma_of_xlate(struct of_phandle_args *dma_spec, struct of_dma *ofdma) { struct tegra_dma *tdma = ofdma->of_dma_data; - struct dma_chan *chan; struct tegra_dma_channel *tdc; + struct dma_chan *chan; if (dma_spec->args[0] > TEGRA_APBDMA_CSR_REQ_SEL_MASK) { dev_err(tdma->dev, "Invalid slave id: %d\n", dma_spec->args[0]); @@ -1379,20 +1394,16 @@ static const struct tegra_dma_chip_data tegra148_dma_chip_data = { static int tegra_dma_probe(struct platform_device *pdev) { + const struct tegra_dma_chip_data *cdata; struct tegra_dma *tdma; + unsigned int i; + size_t size; int ret; - int i; - const struct tegra_dma_chip_data *cdata; cdata = of_device_get_match_data(&pdev->dev); - if (!cdata) { - dev_err(&pdev->dev, "Error: No device match data found\n"); - return -ENODEV; - } + size = struct_size(tdma, channels, cdata->nr_channels); - tdma = devm_kzalloc(&pdev->dev, - struct_size(tdma, channels, cdata->nr_channels), - GFP_KERNEL); + tdma = devm_kzalloc(&pdev->dev, size, GFP_KERNEL); if (!tdma) return -ENOMEM; @@ -1424,10 +1435,8 @@ static int tegra_dma_probe(struct platform_device *pdev) else ret = pm_runtime_get_sync(&pdev->dev); - if (ret < 0) { - pm_runtime_disable(&pdev->dev); - return ret; - } + if (ret < 0) + goto err_pm_disable; /* Reset DMA controller */ reset_control_assert(tdma->rst); @@ -1470,13 +1479,13 @@ static int tegra_dma_probe(struct platform_device *pdev) tdc->dma_chan.device = &tdma->dma_dev; dma_cookie_init(&tdc->dma_chan); list_add_tail(&tdc->dma_chan.device_node, - &tdma->dma_dev.channels); + &tdma->dma_dev.channels); tdc->tdma = tdma; tdc->id = i; tdc->slave_id = TEGRA_APBDMA_SLAVE_ID_INVALID; tasklet_init(&tdc->tasklet, tegra_dma_tasklet, - (unsigned long)tdc); + (unsigned long)tdc); spin_lock_init(&tdc->lock); INIT_LIST_HEAD(&tdc->pending_sg_req); @@ -1528,16 +1537,19 @@ static int tegra_dma_probe(struct platform_device *pdev) goto err_unregister_dma_dev; } - dev_info(&pdev->dev, "Tegra20 APB DMA driver register %d channels\n", - cdata->nr_channels); + dev_info(&pdev->dev, "Tegra20 APB DMA driver registered %u channels\n", + cdata->nr_channels); + return 0; err_unregister_dma_dev: dma_async_device_unregister(&tdma->dma_dev); + err_pm_disable: pm_runtime_disable(&pdev->dev); if (!pm_runtime_status_suspended(&pdev->dev)) tegra_dma_runtime_suspend(&pdev->dev); + return ret; } @@ -1557,7 +1569,7 @@ static int tegra_dma_remove(struct platform_device *pdev) static int tegra_dma_runtime_suspend(struct device *dev) { struct tegra_dma *tdma = dev_get_drvdata(dev); - int i; + unsigned int i; tdma->reg_gen = tdma_read(tdma, TEGRA_APBDMA_GENERAL); for (i = 0; i < tdma->chip_data->nr_channels; i++) { @@ -1586,7 +1598,8 @@ static int tegra_dma_runtime_suspend(struct device *dev) static int tegra_dma_runtime_resume(struct device *dev) { struct tegra_dma *tdma = dev_get_drvdata(dev); - int i, ret; + unsigned int i; + int ret; ret = clk_prepare_enable(tdma->dma_clk); if (ret < 0) { @@ -1614,7 +1627,7 @@ static int tegra_dma_runtime_resume(struct device *dev) tdc_write(tdc, TEGRA_APBDMA_CHAN_AHBSEQ, ch_reg->ahb_seq); tdc_write(tdc, TEGRA_APBDMA_CHAN_AHBPTR, ch_reg->ahb_ptr); tdc_write(tdc, TEGRA_APBDMA_CHAN_CSR, - (ch_reg->csr & ~TEGRA_APBDMA_CSR_ENB)); + ch_reg->csr & ~TEGRA_APBDMA_CSR_ENB); } return 0; From patchwork Sun Feb 2 22:28:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11361861 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 22E2214B4 for ; Sun, 2 Feb 2020 22:30:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F411720658 for ; Sun, 2 Feb 2020 22:30:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BT6NBPWD" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727399AbgBBWam (ORCPT ); Sun, 2 Feb 2020 17:30:42 -0500 Received: from mail-lf1-f68.google.com ([209.85.167.68]:38682 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727201AbgBBWaA (ORCPT ); Sun, 2 Feb 2020 17:30:00 -0500 Received: by mail-lf1-f68.google.com with SMTP id r14so8363318lfm.5; Sun, 02 Feb 2020 14:29:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AVyPwwbkLVlQVChdUAgWIuplnsUu4TqO1h0F/ALyeGY=; b=BT6NBPWDT9XXx3I7JWAbZfF/MldaBwHEh6FrGINT3JMqTn6ZXwosU0S6PU/b7OtLkp ILhTaeVxByGOzMRyBhMQe+hSLjZR6clmW0S6RrFnpYId2GzK8fnl3E81MBt55BDsyhDW 33T55HeiYOJZDBUsz9TD/eJeBrGljTMAE1FC11GGsu1Xc7GY3PKC5sAnvG7NQXSnoX/J TRe1JK0o5HnHbICXHENOuOJhSbBBPWXdyS7tLLdMGUsWubLbWagqG9jRiutZvJ2Swyme oib3l9Ee9hYGcCiXw3PlvyfrVZmbZZvhU1izAq5JYeA4mr3R4MqFJ1uSXuH9HdH61Agi RWyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AVyPwwbkLVlQVChdUAgWIuplnsUu4TqO1h0F/ALyeGY=; b=OdmA9pzWVgrK8UYzj6Yl8rK4MO2e8wxFoEVCd/Egn2JBYAJU38mlSG4mt3HdTCLs3f F4PzjSVujt5in0kFY2j+VhMD5CFdCRjvXYVEmM272OoEv2AJ6JOLswPx+8E/xZMZS4/0 lqRK7i3ZCVIDT2dA02Sj4ypEBQUrJFDpbWKyF9n5+cROgvsdzi/lLMm8DsbCz0leNR3y UBCTp4RT6ilPW46iCs80oyMKQiEryN2jUWbpDSHteaVWkIDUV2rm1oTg8fxj6SoyV6Sf iYQZJUX+K9c3wfNJSJhlMBJAjFGpAMCr4YdHMzaqqHOsA8LZ7HqJIA4usIlnFGRV1T++ TtSg== X-Gm-Message-State: APjAAAVQT7Og2MyvJDLt81ium1UZ5xPx7darc6CsOWcGNGhdqbAqz31i PSJlxcNqOVGGLqtNKs7FveQ= X-Google-Smtp-Source: APXvYqyhjv6RYvQnsapfrQLG6Ipzr1HVKlrPEc1HWgpwwUac17cMcdoS8yF/RHoYDHcw7mTWsoA+PA== X-Received: by 2002:a19:c307:: with SMTP id t7mr10545318lff.166.1580682597227; Sun, 02 Feb 2020 14:29:57 -0800 (PST) Received: from localhost.localdomain (79-139-233-37.dynamic.spd-mgts.ru. [79.139.233.37]) by smtp.gmail.com with ESMTPSA id b190sm8050307lfd.39.2020.02.02.14.29.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Feb 2020 14:29:56 -0800 (PST) From: Dmitry Osipenko To: Laxman Dewangan , Vinod Koul , Dan Williams , Thierry Reding , Jonathan Hunter , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Cc: dmaengine@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 09/19] dmaengine: tegra-apb: Remove unneeded initialization of tdc->config_init Date: Mon, 3 Feb 2020 01:28:44 +0300 Message-Id: <20200202222854.18409-10-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200202222854.18409-1-digetx@gmail.com> References: <20200202222854.18409-1-digetx@gmail.com> MIME-Version: 1.0 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org There is no need to re-initialize the already initialized variables. The tdc->config_init=false after driver's probe and after channel's freeing, so there is no need to re-initialize it on the channel's allocation. Acked-by: Jon Hunter Signed-off-by: Dmitry Osipenko --- drivers/dma/tegra20-apb-dma.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c index b4535b3a07ce..7158bd3145c4 100644 --- a/drivers/dma/tegra20-apb-dma.c +++ b/drivers/dma/tegra20-apb-dma.c @@ -1284,7 +1284,6 @@ static int tegra_dma_alloc_chan_resources(struct dma_chan *dc) int ret; dma_cookie_init(&tdc->dma_chan); - tdc->config_init = false; ret = pm_runtime_get_sync(tdma->dev); if (ret < 0) From patchwork Sun Feb 2 22:28:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11361865 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CFC8D1398 for ; Sun, 2 Feb 2020 22:30:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ABE342082E for ; Sun, 2 Feb 2020 22:30:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PY3MH52l" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727170AbgBBWaq (ORCPT ); Sun, 2 Feb 2020 17:30:46 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:34386 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727198AbgBBWaA (ORCPT ); Sun, 2 Feb 2020 17:30:00 -0500 Received: by mail-lj1-f194.google.com with SMTP id x7so12652548ljc.1; Sun, 02 Feb 2020 14:29:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=EA2aX2gMwFfc16iv548oZvQgKjYnmWGj0LmTyLTJTmM=; b=PY3MH52l9pxtCP2F/2ZmM5mlLagJFgJiTefeZGJoQMoBPuVbi7vYq6n3gXWPJPMhim gcni1v88jLTz8wgYv1reUV8H/24N7pQTa6AIj31bASbU36AEwbpjBHZ0+MrJ3apoEaF8 hmCoiU7jUkQy3sb+BJUcpxORpjYCWsJ0XzMfm/V90Reej94N2FNXPl22J6TnaZQTIIts XhDKzQYbFnYFBalh0yMmhN+ajRf4PojQBjGmbympQZa7rxvL+fxjgUu+7WGOFz/CAFT7 O7vNK8Q7npEXCa4/CCp5402LyfR0tmdS2W19SQCDkPxJIpA7LoWwAxpFPewOspyzdf1N fMsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EA2aX2gMwFfc16iv548oZvQgKjYnmWGj0LmTyLTJTmM=; b=A+cPCu0mD8oONzBQ3heAfkPfdQKNhQUThN7S4hd+I7Vo9tq/WX8QVRCYWkYB96CbGQ Y1/jaDOWGyzctZ/LF+yvGUcEH+VZPROIPjF4vvgMcvfQD5Sr8e5LATAAvsSNBuWDfO5Q kdPLdNDOmrHpfeoOD9N22mjn3uQG8jskZiX01N85o/Z/GIu9eCnrtIEuIA0YgEtW36tZ x3oFEtuvhxzhzXEBGDduf4yiH4suEh/eYwEH3yz4JxE2E4QmNdeRVFbZnvrmtJUyzUz4 yyCH5LeGnN3z8KEpt26y+8VtmRzX964dbtLA//5FyJ98m45rM3ektiCKe+mYOmSIVQdX Nxpg== X-Gm-Message-State: APjAAAUsxNZymN8dGjrxQ9b3QCmsfYH+Sk9QYR751OrHG+5WlrmpCgTm m7hh4in1+CfoqcnbENoeZgc= X-Google-Smtp-Source: APXvYqxfaRoK07R8BsmkSfRO2NTdt3KR7Wc3WMNRtUOVfpnGcFBRbxNRX/hsfF53N1ljiGppDSg0rg== X-Received: by 2002:a2e:5304:: with SMTP id h4mr12169905ljb.75.1580682598234; Sun, 02 Feb 2020 14:29:58 -0800 (PST) Received: from localhost.localdomain (79-139-233-37.dynamic.spd-mgts.ru. [79.139.233.37]) by smtp.gmail.com with ESMTPSA id b190sm8050307lfd.39.2020.02.02.14.29.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Feb 2020 14:29:57 -0800 (PST) From: Dmitry Osipenko To: Laxman Dewangan , Vinod Koul , Dan Williams , Thierry Reding , Jonathan Hunter , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Cc: dmaengine@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 10/19] dmaengine: tegra-apb: Remove assumptions about unavailable runtime PM Date: Mon, 3 Feb 2020 01:28:45 +0300 Message-Id: <20200202222854.18409-11-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200202222854.18409-1-digetx@gmail.com> References: <20200202222854.18409-1-digetx@gmail.com> MIME-Version: 1.0 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org The runtime PM is always available on all Tegra SoCs since the commit 40b2bb1b132a ("ARM: tegra: enforce PM requirement"), so there is no need to handle the case of unavailable RPM in the code anymore. Signed-off-by: Dmitry Osipenko Acked-by: Jon Hunter --- drivers/dma/tegra20-apb-dma.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c index 7158bd3145c4..22b88ccff05d 100644 --- a/drivers/dma/tegra20-apb-dma.c +++ b/drivers/dma/tegra20-apb-dma.c @@ -1429,11 +1429,8 @@ static int tegra_dma_probe(struct platform_device *pdev) spin_lock_init(&tdma->global_lock); pm_runtime_enable(&pdev->dev); - if (!pm_runtime_enabled(&pdev->dev)) - ret = tegra_dma_runtime_resume(&pdev->dev); - else - ret = pm_runtime_get_sync(&pdev->dev); + ret = pm_runtime_get_sync(&pdev->dev); if (ret < 0) goto err_pm_disable; @@ -1546,8 +1543,6 @@ static int tegra_dma_probe(struct platform_device *pdev) err_pm_disable: pm_runtime_disable(&pdev->dev); - if (!pm_runtime_status_suspended(&pdev->dev)) - tegra_dma_runtime_suspend(&pdev->dev); return ret; } @@ -1557,10 +1552,7 @@ static int tegra_dma_remove(struct platform_device *pdev) struct tegra_dma *tdma = platform_get_drvdata(pdev); dma_async_device_unregister(&tdma->dma_dev); - pm_runtime_disable(&pdev->dev); - if (!pm_runtime_status_suspended(&pdev->dev)) - tegra_dma_runtime_suspend(&pdev->dev); return 0; } From patchwork Sun Feb 2 22:28:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11361859 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 052071398 for ; Sun, 2 Feb 2020 22:30:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D6AF120658 for ; Sun, 2 Feb 2020 22:30:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EtlSw4Vz" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727387AbgBBWah (ORCPT ); Sun, 2 Feb 2020 17:30:37 -0500 Received: from mail-lf1-f68.google.com ([209.85.167.68]:33013 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727205AbgBBWaB (ORCPT ); Sun, 2 Feb 2020 17:30:01 -0500 Received: by mail-lf1-f68.google.com with SMTP id n25so8399948lfl.0; Sun, 02 Feb 2020 14:29:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=H3P3Xm7krLErQ+kdYVou7oYRT/1iV81misjOxlroqdY=; b=EtlSw4Vzb963Z4sdrr9Hjxky46zygzXDvQ2t0LrlIyBwf0g41aHb4DlU0KdSxVss5T SdS83D67zbFEp51h/SCC4KMI+EPh3AnDgK6JvRCY9UnNlqdUn4ZVAd6IKaYa7MTYRh94 6Zt/aMt6uzqFkfzoolew5Yc6rqUT/++D+qHIhdAjhWi952Q0aC28YR/LozAT1To1vbCH 6jBQ7pdCYOjAWivgJe0fXVCX/lpTToxmjKjJFMZEhOmFkNN2PLx0qQZ2xUDg2wztjsDA kTD5n/fwbOfiW4/RdtwM03jpH3pKhG5W8xURuu6vEOi+ZtUe/PYdIVPJQOqzdSs29s+G G08w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=H3P3Xm7krLErQ+kdYVou7oYRT/1iV81misjOxlroqdY=; b=sNlvwXD2PWUoFHXuQRBTmQett/qnfEl4Hkso+R231sSBbhocxIDCCDhlfjbA5Yh35S by5RcnD4X/ocYajTF5l4Lx/cU+LTr4hXP070XjTfPCnD+Ypr93ZXU+FE1eP/8OGDQ9YX mNobYH195UrzzrhAr9uvIhrG5SzPmTO5FPoYt+XewKp+DxBCppJxhitScAwJ8RCfgfHv R3d5gnCwj5R1r7aeJnpXr8MQi5kwB3VFZnVNyqc9JOam1xPgjQ+azD7kWxW0Vc/yHclK 44isonIASiFCrRuKDNbn1+CZVVm2x1taX4Q5jXZjbIUXqJV5FhUf3urjekTdbYdUNJUi M+8w== X-Gm-Message-State: APjAAAUASzfxce1mIpOaQbYQfZBQfqx+u1kso2MMumq0zyKN5fynbmgW P6x+o2dtq4VubJvm967GEDM= X-Google-Smtp-Source: APXvYqy+YsqJZmFYyGEAwrGxPgGHTJEZ/x1eVS0e32A9zDmwBx/2UxeTG0j5uv5QMwMN3vJmyqP1RQ== X-Received: by 2002:a19:9d0:: with SMTP id 199mr10596002lfj.110.1580682599120; Sun, 02 Feb 2020 14:29:59 -0800 (PST) Received: from localhost.localdomain (79-139-233-37.dynamic.spd-mgts.ru. [79.139.233.37]) by smtp.gmail.com with ESMTPSA id b190sm8050307lfd.39.2020.02.02.14.29.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Feb 2020 14:29:58 -0800 (PST) From: Dmitry Osipenko To: Laxman Dewangan , Vinod Koul , Dan Williams , Thierry Reding , Jonathan Hunter , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Cc: dmaengine@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 11/19] dmaengine: tegra-apb: Remove pending_sg_req checking from tdc_start_head_req Date: Mon, 3 Feb 2020 01:28:46 +0300 Message-Id: <20200202222854.18409-12-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200202222854.18409-1-digetx@gmail.com> References: <20200202222854.18409-1-digetx@gmail.com> MIME-Version: 1.0 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org There are only two places in the driver that use tdc_start_head_req() and both these places check whether pending_sg_req list is empty before invoking tdc_start_head_req(). Signed-off-by: Dmitry Osipenko Acked-by: Jon Hunter --- drivers/dma/tegra20-apb-dma.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c index 22b88ccff05d..62d181bd5e62 100644 --- a/drivers/dma/tegra20-apb-dma.c +++ b/drivers/dma/tegra20-apb-dma.c @@ -504,9 +504,6 @@ static void tdc_start_head_req(struct tegra_dma_channel *tdc) { struct tegra_dma_sg_req *sg_req; - if (list_empty(&tdc->pending_sg_req)) - return; - sg_req = list_first_entry(&tdc->pending_sg_req, typeof(*sg_req), node); tegra_dma_start(tdc, sg_req); sg_req->configured = true; From patchwork Sun Feb 2 22:28:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11361843 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3F86814B4 for ; Sun, 2 Feb 2020 22:30:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1C78820658 for ; Sun, 2 Feb 2020 22:30:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Wg340Ay3" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727242AbgBBWaC (ORCPT ); Sun, 2 Feb 2020 17:30:02 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:44421 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727223AbgBBWaC (ORCPT ); Sun, 2 Feb 2020 17:30:02 -0500 Received: by mail-lj1-f195.google.com with SMTP id q8so12580582ljj.11; Sun, 02 Feb 2020 14:30:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=oV29kakgRgYYyDRbHczEOv6xyT6QVwpRMqzYCQR5kaM=; b=Wg340Ay3uYAb1EmgfeQg34Kf9wHf0k8rvo5n4ZXj85FweoZYj2fY6V2rFesF/ig5ui MLE299cKNy6AOBJInzCS6k3JoJp4teQSdzLeidppi3mq5esoyGTkY80RwL7vIjNSDcwf GBMG1qwMkNdnjGDXhaBfzUW/mWrCcaj6TOhhPAhbSIWnppNM1vg14bxVnamjPtfvQKA5 uOHKOXlDiDyRNMPdz+5yai29JhemgD9CmAYOI19hHxlsRmxenRqxE7RR8iqeVyNaAN6O WzWZkxLXvjkbTF1l1hOAY6i0ACUSVPtGihGkXxRbeII9rKyPwYCwRniHU5HaT11dtLjp B4cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oV29kakgRgYYyDRbHczEOv6xyT6QVwpRMqzYCQR5kaM=; b=AggPoo5fpVwzrbnIK4ne5szC3jV2rPPQk4uZGk1xlotj6DHQmwDEiIDxHGj8QxnIr3 V4wjX4hpwsNE1cqgeF1JWPxTvRFDaOAectJF9vaBHxM1ay4F4mTxx0U0jZ///2sm1BuP 7FHxFMNWYk4fiujxdIWJah507pvaxExDpb9EfSnN8Hq03khXMyV++r9B6rZH+sHZN/gm +hoGnq9Z0q8JfO/fi3iTg1p4pZUc+2y3H7lb7oh1hwx9LRlJIe+p+x3CYh/RaHcIPPg2 1G+7RAaIN2h1nHChALnkTSCOTAMFhhJQcxuGCRyVraChEsL6+SBaYIgQQL/cqMzGwzB3 Sb9Q== X-Gm-Message-State: APjAAAWwkMR6UP1qT6tjOStrAKcxWFIcVMMORiXg7DZ2cJlp+OFRrYot FS/Qp0E0f3aZrZDbmo7Yxf8= X-Google-Smtp-Source: APXvYqzqXNPeS/zTglgjyVmBjf9m59MEtfDozO+pfjw8vruqJ714sLeGVPeB2m5EN6M7tXlo/2sBiQ== X-Received: by 2002:a2e:b60d:: with SMTP id r13mr12022595ljn.40.1580682600000; Sun, 02 Feb 2020 14:30:00 -0800 (PST) Received: from localhost.localdomain (79-139-233-37.dynamic.spd-mgts.ru. [79.139.233.37]) by smtp.gmail.com with ESMTPSA id b190sm8050307lfd.39.2020.02.02.14.29.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Feb 2020 14:29:59 -0800 (PST) From: Dmitry Osipenko To: Laxman Dewangan , Vinod Koul , Dan Williams , Thierry Reding , Jonathan Hunter , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Cc: dmaengine@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 12/19] dmaengine: tegra-apb: Remove handling of unrealistic error condition Date: Mon, 3 Feb 2020 01:28:47 +0300 Message-Id: <20200202222854.18409-13-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200202222854.18409-1-digetx@gmail.com> References: <20200202222854.18409-1-digetx@gmail.com> MIME-Version: 1.0 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org The pending_sg_req list can't ever be empty because: 1. If it was empty, then handle_cont_sngl_cycle_dma_done() shall crash before of handle_continuous_head_request() invocation. 2. The handle_cont_sngl_cycle_dma_done() can't happen after stopping DMA. Signed-off-by: Dmitry Osipenko --- drivers/dma/tegra20-apb-dma.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c index 62d181bd5e62..c7dc27ef1856 100644 --- a/drivers/dma/tegra20-apb-dma.c +++ b/drivers/dma/tegra20-apb-dma.c @@ -564,12 +564,6 @@ static bool handle_continuous_head_request(struct tegra_dma_channel *tdc, { struct tegra_dma_sg_req *hsgreq; - if (list_empty(&tdc->pending_sg_req)) { - dev_err(tdc2dev(tdc), "DMA is running without req\n"); - tegra_dma_stop(tdc); - return false; - } - /* * Check that head req on list should be in flight. * If it is not in flight then abort transfer as From patchwork Sun Feb 2 22:28:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11361855 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0D0B514E3 for ; Sun, 2 Feb 2020 22:30:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E05242080D for ; Sun, 2 Feb 2020 22:30:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="s6ej2B0Q" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727341AbgBBWaZ (ORCPT ); Sun, 2 Feb 2020 17:30:25 -0500 Received: from mail-lf1-f65.google.com ([209.85.167.65]:43155 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727234AbgBBWaD (ORCPT ); Sun, 2 Feb 2020 17:30:03 -0500 Received: by mail-lf1-f65.google.com with SMTP id 9so8338520lfq.10; Sun, 02 Feb 2020 14:30:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XNJyMXICFd8y4YXTQRsGlsU//nAmuF2hHmBllvy2XVc=; b=s6ej2B0Q0D8KFLNOUJqvAcWJ0X6xJT9wkIaGy1fCGX1hfbq8PR9yNDXmp7q9DXfhWj ot4PCfzzf6akB98TjVN+lXdxYda+8FZWLRkBazeNtv25esRV2FHEwWEbfLBbsK8IvN+r kOKu3Z5bGKYw11YGTtn8HnnxBIQA8eNhkowBc4gDhcqt8NyBuDlvU33vL/+8jHBC3qm1 TAfELSJ6QoUiUVRDj6+pMBPUIomMVOEE5AINmqNYpdvCoa/z1+u7Aw4qiBSB0fpi2UeY XDQ4yq3AGeO4jJxFAp06ZfKYduJYPvmWTu8bNeYE5gZvORW1grXg0kcC6pRjlkkGqm8G rEbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XNJyMXICFd8y4YXTQRsGlsU//nAmuF2hHmBllvy2XVc=; b=N00cgsB0CMbYfzs/NQ3hRu7Vz/0GZPbdbH6GHk7KBc+8pmfbMIbvC+f5dZ/HR2kSKE pl62rqY+RcD9G7rd2VQ1hF/xd3QRMfw+/1KiJpwNQfFw8pw4eUHyZQju1mTqJ/HIJGwR GuZ2R5/tcdPqXGO9HgLdrxcHjNpAwEQgDPR2MMEpy/o5RSO0Kiu2MEPUoBqdWf2dfUJf +S2Uw4YOUgv6CTRnrJ8ubt7gBtXoIau97sMD60gLcFcXNrNU6QO6fuFBw5T5H5OmY4Uj Xsv41O1Pl+w7zu/UIBlEOOFyPAjI7YMr1YqSl5cGADqfPwad2ZRUcqDWV7dhZh9CNB+d 0C/A== X-Gm-Message-State: APjAAAUPj6t98oC/PldmejZgoJiIvv6D5yDDleryvUjAAMtmapvqZ90L qABj46gveB5bCbQ/SMzbAZ8= X-Google-Smtp-Source: APXvYqzaxDrsS1AoBFj/pdbJXJyUtiKqya888AEKUXPD1rDESikYiIpCKiXQ7eowxiWucnaZvqYekw== X-Received: by 2002:a19:6449:: with SMTP id b9mr10478816lfj.5.1580682600916; Sun, 02 Feb 2020 14:30:00 -0800 (PST) Received: from localhost.localdomain (79-139-233-37.dynamic.spd-mgts.ru. [79.139.233.37]) by smtp.gmail.com with ESMTPSA id b190sm8050307lfd.39.2020.02.02.14.30.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Feb 2020 14:30:00 -0800 (PST) From: Dmitry Osipenko To: Laxman Dewangan , Vinod Koul , Dan Williams , Thierry Reding , Jonathan Hunter , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Cc: dmaengine@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 13/19] dmaengine: tegra-apb: Don't stop cyclic DMA in a case of error condition Date: Mon, 3 Feb 2020 01:28:48 +0300 Message-Id: <20200202222854.18409-14-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200202222854.18409-1-digetx@gmail.com> References: <20200202222854.18409-1-digetx@gmail.com> MIME-Version: 1.0 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org There is no harm in keeping DMA active in the case of error condition, which should never happen in practice anyways. This will become useful for the next patch, which will keep RPM enabled only during of DMA transfer, and thus, it will be much nicer if cyclic DMA handler could not touch the DMA-enable state. Signed-off-by: Dmitry Osipenko --- drivers/dma/tegra20-apb-dma.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c index c7dc27ef1856..50abce608318 100644 --- a/drivers/dma/tegra20-apb-dma.c +++ b/drivers/dma/tegra20-apb-dma.c @@ -571,9 +571,7 @@ static bool handle_continuous_head_request(struct tegra_dma_channel *tdc, */ hsgreq = list_first_entry(&tdc->pending_sg_req, typeof(*hsgreq), node); if (!hsgreq->configured) { - tegra_dma_stop(tdc); - dev_err(tdc2dev(tdc), "Error in DMA transfer, aborting DMA\n"); - tegra_dma_abort_all(tdc); + dev_err_ratelimited(tdc2dev(tdc), "Error in DMA transfer\n"); return false; } @@ -772,7 +770,10 @@ static int tegra_dma_terminate_all(struct dma_chan *dc) if (!list_empty(&tdc->pending_sg_req) && was_busy) { sgreq = list_first_entry(&tdc->pending_sg_req, typeof(*sgreq), node); - sgreq->dma_desc->bytes_transferred += + dma_desc = sgreq->dma_desc; + + if (dma_desc->dma_status != DMA_ERROR) + dma_desc->bytes_transferred += get_current_xferred_count(tdc, sgreq, wcount); } tegra_dma_resume(tdc); From patchwork Sun Feb 2 22:28:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11361847 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A57D514B4 for ; Sun, 2 Feb 2020 22:30:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8304220679 for ; Sun, 2 Feb 2020 22:30:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mJo7XMHl" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727276AbgBBWaJ (ORCPT ); Sun, 2 Feb 2020 17:30:09 -0500 Received: from mail-lf1-f66.google.com ([209.85.167.66]:43156 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727239AbgBBWaE (ORCPT ); Sun, 2 Feb 2020 17:30:04 -0500 Received: by mail-lf1-f66.google.com with SMTP id 9so8338535lfq.10; Sun, 02 Feb 2020 14:30:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=d8axBWh0QJYGfwaPhyACM4mtObUw2JQF4mOsUMLnR20=; b=mJo7XMHl2rudZJvu34fqq3HMVqOKxf1zp6XD+BnLfVW2NWXEvl11CKpVxi9mJR2FDI LMeMEI6Kba/6p2fsuxI5gQ47z18PhpSk7DBdtqn7FbODDBDX2YkG4wf5rv6qyji4IZ+T c0nM+HEFCLSkAzZmwdX/rFaXhMzKx3OOgLf0+kbdRWsEVv0mZCLC8wY4gHAHnLfFVdKv chCVBkIkJQw2j+PAXIHeLOT/aPOFefIuaG/i7W1+JxWNjhbR0Ci+j+pOKr6UgBz1F6yV ouUA3DR45mfuOYSVbPVgoJlWZ2x/Kpkm28Oy1QW+4S+wKuX9t6W7WrZfAAA//JVReaOi ECUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=d8axBWh0QJYGfwaPhyACM4mtObUw2JQF4mOsUMLnR20=; b=nGKfUpOcpOwwNS+iwRwVvDjQ6ewvggUCUpVmlSEo6me6tfplvxRlblao7U19CbmsCa p3QZ4nAIZH1PhZH0k8KVdtZpgR14Hi2LoNm0lrOo9YPr1FmwU7Lqqy4iT4uMYcndUrcO FwYalcrwMGfZ5Ht1fFEf5Lb9sIJz/ZVWc6QPet/4VcQ+zAd8578+Sp3a7IweSVGxCFJ8 1pLhJBqhVinRF70C0qVircbkDMop10RtB51fr7sTmDDUo3BCyQR8cEUAZSY4eXwYloVI 05UIQjLdYpa6IfrQVQKGH38F4xuHfcnkN34KW0+mTKBs64S/5ubRrbfz4hBsg/MeA2b/ 7VYw== X-Gm-Message-State: APjAAAX1BFLTijFFa6WgxgGnqPiVi2gQ4P5wwIepwSqDdDjnizpeoaFy kl8fnc2ThzgMEBK3US58wzte4Z1y X-Google-Smtp-Source: APXvYqxnaHFQS6Cw7gGkhSyAzjOpLyRlEfQbQ19ZEWOskMQEuavOGKkcAgI3KZX5fGTGK2cTkTr4fA== X-Received: by 2002:ac2:47ec:: with SMTP id b12mr10513270lfp.162.1580682601837; Sun, 02 Feb 2020 14:30:01 -0800 (PST) Received: from localhost.localdomain (79-139-233-37.dynamic.spd-mgts.ru. [79.139.233.37]) by smtp.gmail.com with ESMTPSA id b190sm8050307lfd.39.2020.02.02.14.30.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Feb 2020 14:30:01 -0800 (PST) From: Dmitry Osipenko To: Laxman Dewangan , Vinod Koul , Dan Williams , Thierry Reding , Jonathan Hunter , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Cc: dmaengine@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 14/19] dmaengine: tegra-apb: Keep clock enabled only during of DMA transfer Date: Mon, 3 Feb 2020 01:28:49 +0300 Message-Id: <20200202222854.18409-15-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200202222854.18409-1-digetx@gmail.com> References: <20200202222854.18409-1-digetx@gmail.com> MIME-Version: 1.0 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org It's a bit impractical to enable hardware's clock at the time of DMA channel's allocation because most of DMA client drivers allocate DMA channel at the time of the driver's probing, and thus, DMA clock is kept always-enabled in practice, defeating the whole purpose of runtime PM. Signed-off-by: Dmitry Osipenko --- drivers/dma/tegra20-apb-dma.c | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c index 50abce608318..92535b962e64 100644 --- a/drivers/dma/tegra20-apb-dma.c +++ b/drivers/dma/tegra20-apb-dma.c @@ -605,9 +605,14 @@ static void handle_once_dma_done(struct tegra_dma_channel *tdc, list_add_tail(&sgreq->node, &tdc->free_sg_req); /* Do not start DMA if it is going to be terminate */ - if (to_terminate || list_empty(&tdc->pending_sg_req)) + if (to_terminate) return; + if (list_empty(&tdc->pending_sg_req)) { + pm_runtime_put(tdc->tdma->dev); + return; + } + tdc_start_head_req(tdc); } @@ -713,6 +718,7 @@ static void tegra_dma_issue_pending(struct dma_chan *dc) { struct tegra_dma_channel *tdc = to_tegra_dma_chan(dc); unsigned long flags; + int err; spin_lock_irqsave(&tdc->lock, flags); if (list_empty(&tdc->pending_sg_req)) { @@ -720,6 +726,12 @@ static void tegra_dma_issue_pending(struct dma_chan *dc) goto end; } if (!tdc->busy) { + err = pm_runtime_get_sync(tdc->tdma->dev); + if (err < 0) { + dev_err(tdc2dev(tdc), "Failed to enable DMA\n"); + goto end; + } + tdc_start_head_req(tdc); /* Continuous single mode: Configure next req */ @@ -778,6 +790,8 @@ static int tegra_dma_terminate_all(struct dma_chan *dc) } tegra_dma_resume(tdc); + pm_runtime_put(tdc->tdma->dev); + skip_dma_stop: tegra_dma_abort_all(tdc); @@ -1272,22 +1286,15 @@ tegra_dma_prep_dma_cyclic(struct dma_chan *dc, dma_addr_t buf_addr, static int tegra_dma_alloc_chan_resources(struct dma_chan *dc) { struct tegra_dma_channel *tdc = to_tegra_dma_chan(dc); - struct tegra_dma *tdma = tdc->tdma; - int ret; dma_cookie_init(&tdc->dma_chan); - ret = pm_runtime_get_sync(tdma->dev); - if (ret < 0) - return ret; - return 0; } static void tegra_dma_free_chan_resources(struct dma_chan *dc) { struct tegra_dma_channel *tdc = to_tegra_dma_chan(dc); - struct tegra_dma *tdma = tdc->tdma; struct tegra_dma_desc *dma_desc; struct tegra_dma_sg_req *sg_req; struct list_head dma_desc_list; @@ -1320,7 +1327,6 @@ static void tegra_dma_free_chan_resources(struct dma_chan *dc) list_del(&sg_req->node); kfree(sg_req); } - pm_runtime_put(tdma->dev); tdc->slave_id = TEGRA_APBDMA_SLAVE_ID_INVALID; } @@ -1420,6 +1426,11 @@ static int tegra_dma_probe(struct platform_device *pdev) spin_lock_init(&tdma->global_lock); + ret = clk_prepare(tdma->dma_clk); + if (ret) + return ret; + + pm_runtime_irq_safe(&pdev->dev); pm_runtime_enable(&pdev->dev); ret = pm_runtime_get_sync(&pdev->dev); @@ -1535,6 +1546,7 @@ static int tegra_dma_probe(struct platform_device *pdev) err_pm_disable: pm_runtime_disable(&pdev->dev); + clk_unprepare(tdma->dma_clk); return ret; } @@ -1545,6 +1557,7 @@ static int tegra_dma_remove(struct platform_device *pdev) dma_async_device_unregister(&tdma->dma_dev); pm_runtime_disable(&pdev->dev); + clk_unprepare(tdma->dma_clk); return 0; } @@ -1573,7 +1586,7 @@ static int tegra_dma_runtime_suspend(struct device *dev) TEGRA_APBDMA_CHAN_WCOUNT); } - clk_disable_unprepare(tdma->dma_clk); + clk_disable(tdma->dma_clk); return 0; } @@ -1584,7 +1597,7 @@ static int tegra_dma_runtime_resume(struct device *dev) unsigned int i; int ret; - ret = clk_prepare_enable(tdma->dma_clk); + ret = clk_enable(tdma->dma_clk); if (ret < 0) { dev_err(dev, "clk_enable failed: %d\n", ret); return ret; From patchwork Sun Feb 2 22:28:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11361853 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D60A114B4 for ; Sun, 2 Feb 2020 22:30:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A8EE520658 for ; Sun, 2 Feb 2020 22:30:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="V8u+C3G7" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727339AbgBBWaZ (ORCPT ); Sun, 2 Feb 2020 17:30:25 -0500 Received: from mail-lf1-f65.google.com ([209.85.167.65]:34083 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727249AbgBBWaF (ORCPT ); Sun, 2 Feb 2020 17:30:05 -0500 Received: by mail-lf1-f65.google.com with SMTP id l18so8393191lfc.1; Sun, 02 Feb 2020 14:30:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2j5TnyT9E2pH02me679r+cBH2fO12rifIiKw/FrWAIE=; b=V8u+C3G7q8darhXwMIRPufo6v+Tj0VNbio4D7IK9SF/JYya3dxlpIxfKvEKOoz8gMy E55uweydS/IisDJW93zATrVOVxCsV5xRgywCJZ8mLE0qyrXV8LciF6k85M6sxcrxtcv+ Yz2mPXzR24UfAFLIry1WZNTtPk7wz/BlPhIJHfOrHjxwWUY5UDyf9U1BE+tDhiEv2l8d ryTcA1G95LRUNKscyp+Gw0BfZ5tRc1fKvclXKG75H7Kr1+sX1KNTngyMEBi4PJemEVy8 8tzR84xs0JIzLTefaJo83lJvmy2qSHSdWf1OJWbRPxJT64Ckhm2XnLO5AVcKTImJ2Hsp 3iCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2j5TnyT9E2pH02me679r+cBH2fO12rifIiKw/FrWAIE=; b=gEPubZocX/zQ1CEY6NTLjkXJf8YbZ/VrdLKm5ElQAKCUaMixORRjg7xQfw7pbiLx7S BG4f86tu3FxaZDCPXmyAQnMFPx7heVHO3ys5QBxrvpYwdLJ8CTktMFNBULtmwFCBPgk3 IUt3fPZIvwNwCkmLochXPLYlMnpg/LTw/luWvvh/hJm2OMzD3r0iHM9b4P6mfxBuWJtT BK5McUJA7ADysn2ojGQF9AXiggLZv+s56IoNUi3m2tQTemzPvYQlLWo1r1feH3KMpxgA o5NGsPILQibakMWTKOgjAM5zdeIrCdypGwadFC4kMxdL2Aj2V9JTBnicOQ/ds8Q+EX2i fQ7Q== X-Gm-Message-State: APjAAAUQSXikMFQrIfZKsIIMkq04NKucNMHvMX/VmOtA/tzixpKJpDyW b1ryLyTkJrdM1OCfIza2q10= X-Google-Smtp-Source: APXvYqwqpxUNS2YFG5IKr+6dcq70/wQ4n9hWJcxzkKqBKvQG4veHeFgQfiBCqxn6sei1HBIFCGKfDA== X-Received: by 2002:ac2:555c:: with SMTP id l28mr10401780lfk.52.1580682602769; Sun, 02 Feb 2020 14:30:02 -0800 (PST) Received: from localhost.localdomain (79-139-233-37.dynamic.spd-mgts.ru. [79.139.233.37]) by smtp.gmail.com with ESMTPSA id b190sm8050307lfd.39.2020.02.02.14.30.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Feb 2020 14:30:02 -0800 (PST) From: Dmitry Osipenko To: Laxman Dewangan , Vinod Koul , Dan Williams , Thierry Reding , Jonathan Hunter , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Cc: dmaengine@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 15/19] dmaengine: tegra-apb: Clean up suspend-resume Date: Mon, 3 Feb 2020 01:28:50 +0300 Message-Id: <20200202222854.18409-16-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200202222854.18409-1-digetx@gmail.com> References: <20200202222854.18409-1-digetx@gmail.com> MIME-Version: 1.0 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org It is enough to check whether hardware is busy on suspend and to reset it across of suspend-resume because: 1. Channel's configuration is fully re-programmed on each DMA transfer anyways. 2. Context save-restore of an active channel won't end up well without pausing transfer prior to the context's saving, but note that every channel shall be idling at the time of suspend, so save-restore is not needed at all. 3. The only case where context save-restore may be useful is when channel is in a paused state during suspend. But channel's pausing could be supported only on Tegra114+ and this functionality wasn't implemented by the driver for years now because there is no need for it in upstream kernel. Acked-by: Jon Hunter Signed-off-by: Dmitry Osipenko --- drivers/dma/tegra20-apb-dma.c | 136 +++++++++++++++++----------------- 1 file changed, 69 insertions(+), 67 deletions(-) diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c index 92535b962e64..db726e635048 100644 --- a/drivers/dma/tegra20-apb-dma.c +++ b/drivers/dma/tegra20-apb-dma.c @@ -221,9 +221,6 @@ struct tegra_dma { */ u32 global_pause_count; - /* Some register need to be cache before suspend */ - u32 reg_gen; - /* Last member of the structure */ struct tegra_dma_channel channels[0]; }; @@ -1389,6 +1386,36 @@ static const struct tegra_dma_chip_data tegra148_dma_chip_data = { .support_separate_wcount_reg = true, }; +static int tegra_dma_init_hw(struct tegra_dma *tdma) +{ + int err; + + err = reset_control_assert(tdma->rst); + if (err) { + dev_err(tdma->dev, "failed to assert reset: %d\n", err); + return err; + } + + err = clk_enable(tdma->dma_clk); + if (err) { + dev_err(tdma->dev, "failed to enable clk: %d\n", err); + return err; + } + + /* reset DMA controller */ + udelay(2); + reset_control_deassert(tdma->rst); + + /* enable global DMA registers */ + tdma_write(tdma, TEGRA_APBDMA_GENERAL, TEGRA_APBDMA_GENERAL_ENABLE); + tdma_write(tdma, TEGRA_APBDMA_CONTROL, 0); + tdma_write(tdma, TEGRA_APBDMA_IRQ_MASK_SET, 0xFFFFFFFF); + + clk_disable(tdma->dma_clk); + + return 0; +} + static int tegra_dma_probe(struct platform_device *pdev) { const struct tegra_dma_chip_data *cdata; @@ -1430,25 +1457,13 @@ static int tegra_dma_probe(struct platform_device *pdev) if (ret) return ret; + ret = tegra_dma_init_hw(tdma); + if (ret) + goto err_clk_unprepare; + pm_runtime_irq_safe(&pdev->dev); pm_runtime_enable(&pdev->dev); - ret = pm_runtime_get_sync(&pdev->dev); - if (ret < 0) - goto err_pm_disable; - - /* Reset DMA controller */ - reset_control_assert(tdma->rst); - udelay(2); - reset_control_deassert(tdma->rst); - - /* Enable global DMA registers */ - tdma_write(tdma, TEGRA_APBDMA_GENERAL, TEGRA_APBDMA_GENERAL_ENABLE); - tdma_write(tdma, TEGRA_APBDMA_CONTROL, 0); - tdma_write(tdma, TEGRA_APBDMA_IRQ_MASK_SET, 0xFFFFFFFFul); - - pm_runtime_put(&pdev->dev); - INIT_LIST_HEAD(&tdma->dma_dev.channels); for (i = 0; i < cdata->nr_channels; i++) { struct tegra_dma_channel *tdc = &tdma->channels[i]; @@ -1546,6 +1561,8 @@ static int tegra_dma_probe(struct platform_device *pdev) err_pm_disable: pm_runtime_disable(&pdev->dev); + +err_clk_unprepare: clk_unprepare(tdma->dma_clk); return ret; @@ -1565,26 +1582,6 @@ static int tegra_dma_remove(struct platform_device *pdev) static int tegra_dma_runtime_suspend(struct device *dev) { struct tegra_dma *tdma = dev_get_drvdata(dev); - unsigned int i; - - tdma->reg_gen = tdma_read(tdma, TEGRA_APBDMA_GENERAL); - for (i = 0; i < tdma->chip_data->nr_channels; i++) { - struct tegra_dma_channel *tdc = &tdma->channels[i]; - struct tegra_dma_channel_regs *ch_reg = &tdc->channel_reg; - - /* Only save the state of DMA channels that are in use */ - if (!tdc->config_init) - continue; - - ch_reg->csr = tdc_read(tdc, TEGRA_APBDMA_CHAN_CSR); - ch_reg->ahb_ptr = tdc_read(tdc, TEGRA_APBDMA_CHAN_AHBPTR); - ch_reg->apb_ptr = tdc_read(tdc, TEGRA_APBDMA_CHAN_APBPTR); - ch_reg->ahb_seq = tdc_read(tdc, TEGRA_APBDMA_CHAN_AHBSEQ); - ch_reg->apb_seq = tdc_read(tdc, TEGRA_APBDMA_CHAN_APBSEQ); - if (tdma->chip_data->support_separate_wcount_reg) - ch_reg->wcount = tdc_read(tdc, - TEGRA_APBDMA_CHAN_WCOUNT); - } clk_disable(tdma->dma_clk); @@ -1594,46 +1591,51 @@ static int tegra_dma_runtime_suspend(struct device *dev) static int tegra_dma_runtime_resume(struct device *dev) { struct tegra_dma *tdma = dev_get_drvdata(dev); - unsigned int i; - int ret; - ret = clk_enable(tdma->dma_clk); - if (ret < 0) { - dev_err(dev, "clk_enable failed: %d\n", ret); - return ret; - } + return clk_enable(tdma->dma_clk); +} - tdma_write(tdma, TEGRA_APBDMA_GENERAL, tdma->reg_gen); - tdma_write(tdma, TEGRA_APBDMA_CONTROL, 0); - tdma_write(tdma, TEGRA_APBDMA_IRQ_MASK_SET, 0xFFFFFFFFul); +static int __maybe_unused tegra_dma_dev_suspend(struct device *dev) +{ + struct tegra_dma *tdma = dev_get_drvdata(dev); + unsigned long flags; + unsigned int i; + bool busy; for (i = 0; i < tdma->chip_data->nr_channels; i++) { struct tegra_dma_channel *tdc = &tdma->channels[i]; - struct tegra_dma_channel_regs *ch_reg = &tdc->channel_reg; - - /* Only restore the state of DMA channels that are in use */ - if (!tdc->config_init) - continue; - - if (tdma->chip_data->support_separate_wcount_reg) - tdc_write(tdc, TEGRA_APBDMA_CHAN_WCOUNT, - ch_reg->wcount); - tdc_write(tdc, TEGRA_APBDMA_CHAN_APBSEQ, ch_reg->apb_seq); - tdc_write(tdc, TEGRA_APBDMA_CHAN_APBPTR, ch_reg->apb_ptr); - tdc_write(tdc, TEGRA_APBDMA_CHAN_AHBSEQ, ch_reg->ahb_seq); - tdc_write(tdc, TEGRA_APBDMA_CHAN_AHBPTR, ch_reg->ahb_ptr); - tdc_write(tdc, TEGRA_APBDMA_CHAN_CSR, - ch_reg->csr & ~TEGRA_APBDMA_CSR_ENB); + + tasklet_kill(&tdc->tasklet); + + spin_lock_irqsave(&tdc->lock, flags); + busy = tdc->busy; + spin_unlock_irqrestore(&tdc->lock, flags); + + if (busy) { + dev_err(tdma->dev, "channel %u busy\n", i); + return -EBUSY; + } } - return 0; + return pm_runtime_force_suspend(dev); +} + +static int __maybe_unused tegra_dma_dev_resume(struct device *dev) +{ + struct tegra_dma *tdma = dev_get_drvdata(dev); + int err; + + err = tegra_dma_init_hw(tdma); + if (err) + return err; + + return pm_runtime_force_resume(dev); } static const struct dev_pm_ops tegra_dma_dev_pm_ops = { SET_RUNTIME_PM_OPS(tegra_dma_runtime_suspend, tegra_dma_runtime_resume, NULL) - SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, - pm_runtime_force_resume) + SET_SYSTEM_SLEEP_PM_OPS(tegra_dma_dev_suspend, tegra_dma_dev_resume) }; static const struct of_device_id tegra_dma_of_match[] = { From patchwork Sun Feb 2 22:28:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11361857 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 758611398 for ; Sun, 2 Feb 2020 22:30:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 534A32082E for ; Sun, 2 Feb 2020 22:30:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bs/V1bh/" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727053AbgBBWaY (ORCPT ); Sun, 2 Feb 2020 17:30:24 -0500 Received: from mail-lf1-f66.google.com ([209.85.167.66]:42789 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727253AbgBBWaG (ORCPT ); Sun, 2 Feb 2020 17:30:06 -0500 Received: by mail-lf1-f66.google.com with SMTP id y19so8347822lfl.9; Sun, 02 Feb 2020 14:30:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nSFyw0+Q9kQMhBeT0mTZWHihPYKhlfkGWd5c5D4FidI=; b=bs/V1bh/r7waOP6HPAIy+zkn07Bc5o4lS8lSrMXAGu3HAPDMpKF446aeTPwjuBcJZr YvbpXiHPJyJ2wgeyK9HunlA1pJBqSy4orYouLXOZ1dOX5EXpvRnsX5MXLlitTMhqG/pA ppHwB+X0bw6c2iiOohA15VM0jAJyEWIWwaVFaJCo6Jbw+heRILMrBIprVHf3sjN6EDKI R22CDY7p1QpuCtSVS5As8I8cfUSZ3aF2+0VTs0/VB9iew/VTJd//4Qe/y84X1ETPF1YU gTID9RnO4by8zRyhzf+UukPYOwqy2z+OOfmt/Gxj3TUMnwH5I/ruxY4nRylg2RaKO/KY 7TAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nSFyw0+Q9kQMhBeT0mTZWHihPYKhlfkGWd5c5D4FidI=; b=VGNzCSWnQpQeiGNLgsFcEcFIlqR1BrNRRfNTLod+dfYD0m+WK4iaaSDKLvsvr4wAeA PEwpFsXKzhmAcj8w9QCzfGEuUC458l2OUWszEpIit9m+vkPz810TCq/1LLXM3tlsfApk 0M0mzR08n3q+yKwP6s+Mp685TwuvAWtXa3vBbJh4Juk3xrLDRQ2/CADjKIOQcBfHZl1j bQheetwFp0+TrJXp8uQcxsvppoI/1ApYvK6cke1smmVoKF5e3JnHW/YSLzwuDgqhADN7 QqVgNe3rQDLvVbxpYKbI1FRb65noAHBPErxL5B+Tnvc83KcEvEPsjQyxFDTClFurm2z2 rQGQ== X-Gm-Message-State: APjAAAXfkf5rCoW9LwyNK5ttczz9teulNKAa4lw9OUZeMg4hR226klwf YtnwaCG33WiIS854G56k3Z8= X-Google-Smtp-Source: APXvYqzAXBfBsH4fqqGMuQI+N3eaCGo+Q0Z3F/jZKku4J44A1uia85AEW4atm4H39pS06B+zBTPlaQ== X-Received: by 2002:ac2:5444:: with SMTP id d4mr10121642lfn.49.1580682603720; Sun, 02 Feb 2020 14:30:03 -0800 (PST) Received: from localhost.localdomain (79-139-233-37.dynamic.spd-mgts.ru. [79.139.233.37]) by smtp.gmail.com with ESMTPSA id b190sm8050307lfd.39.2020.02.02.14.30.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Feb 2020 14:30:03 -0800 (PST) From: Dmitry Osipenko To: Laxman Dewangan , Vinod Koul , Dan Williams , Thierry Reding , Jonathan Hunter , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Cc: dmaengine@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 16/19] dmaengine: tegra-apb: Add missing of_dma_controller_free Date: Mon, 3 Feb 2020 01:28:51 +0300 Message-Id: <20200202222854.18409-17-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200202222854.18409-1-digetx@gmail.com> References: <20200202222854.18409-1-digetx@gmail.com> MIME-Version: 1.0 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org The DMA controller shall be released on driver's removal. Acked-by: Jon Hunter Signed-off-by: Dmitry Osipenko --- drivers/dma/tegra20-apb-dma.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c index db726e635048..7e9ec945d6bd 100644 --- a/drivers/dma/tegra20-apb-dma.c +++ b/drivers/dma/tegra20-apb-dma.c @@ -1572,6 +1572,7 @@ static int tegra_dma_remove(struct platform_device *pdev) { struct tegra_dma *tdma = platform_get_drvdata(pdev); + of_dma_controller_free(pdev->dev.of_node); dma_async_device_unregister(&tdma->dma_dev); pm_runtime_disable(&pdev->dev); clk_unprepare(tdma->dma_clk); From patchwork Sun Feb 2 22:28:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11361849 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CF73314E3 for ; Sun, 2 Feb 2020 22:30:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AE58D2067C for ; Sun, 2 Feb 2020 22:30:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="K0zzG3aa" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727281AbgBBWaJ (ORCPT ); Sun, 2 Feb 2020 17:30:09 -0500 Received: from mail-lf1-f68.google.com ([209.85.167.68]:34087 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727260AbgBBWaH (ORCPT ); Sun, 2 Feb 2020 17:30:07 -0500 Received: by mail-lf1-f68.google.com with SMTP id l18so8393221lfc.1; Sun, 02 Feb 2020 14:30:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VT2b3DIhkLrsXocDLVqwdbb9fFwHJxhRiEwuiWhammQ=; b=K0zzG3aa421/UtbmrOpJpNK+eddVN3a0ZR/9nRkZdTimhbXdf0vaUu3Ex+SustzPOh isVYug7s5uqHG6P8MIkQ401vMbAhoVSTJFX29nXNOM2TsuWLiB/xRe7PuvtebYf981jK 6kDB2AEpszmYmr3VTxmYVSm7xPsxHwNpHfM6wKmy2Ib9yoRAGsK216qYvFgMgJHX+mTU nY4m60FHOlIXvz32aQswO4O56/eqxN/n39edH3lF5uutXkEOFVjKRolxCIiI8EKAk6NM iJJkXmQel7qMNX/vcxSvcm2wQbhhkErc7abwXpZPwSiLcTm8rYgY0VCcklW6zG8R4ntu qSfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VT2b3DIhkLrsXocDLVqwdbb9fFwHJxhRiEwuiWhammQ=; b=DVNy2balxpHIRHe0hEyLAC0T27EcwNL64mX43xr9a8OYcYsIiMm6+JDB9/hG4MGJqj s6ONS8wsmzGn3iz6OPj9tePntFX7WnjE86u340oDv0dei0XWvfM/j6Lc8TFMAbFWATnS ExtcunTeHa7mKjCCcRN9xgqKYmSq4TDYW+sPkZLSazKAIYcpbMdGK+Ko2M4sfzEgnqjO vIM/+x5lQYhAJREeoug/uEqcIDMnkyEP5iASaWwwhqtBFfRYA8bFiicjxtucnfSG40Tp 4dwtg9dCz9krw7ywQznHSlyXYZebaGmfk4kbNCJx5t3oNNywVSaXkUHboYW3hS1MtzHJ fL3g== X-Gm-Message-State: APjAAAX5frKqLpL+HJvzSgPPGRfxCWWL/zC5kMuMlzLETkxYPMH69c/d G3qOArZRUzOXT0/D0ts/P2Q= X-Google-Smtp-Source: APXvYqxAfIHx2B1haLicEwi0YNfXLAV9LnEc/kK1ZzjxoNANQ1EkaR5rqgONny/GLxpvUVpk7NSUDg== X-Received: by 2002:a19:5f05:: with SMTP id t5mr10655378lfb.149.1580682604787; Sun, 02 Feb 2020 14:30:04 -0800 (PST) Received: from localhost.localdomain (79-139-233-37.dynamic.spd-mgts.ru. [79.139.233.37]) by smtp.gmail.com with ESMTPSA id b190sm8050307lfd.39.2020.02.02.14.30.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Feb 2020 14:30:04 -0800 (PST) From: Dmitry Osipenko To: Laxman Dewangan , Vinod Koul , Dan Williams , Thierry Reding , Jonathan Hunter , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Cc: dmaengine@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 17/19] dmaengine: tegra-apb: Allow to compile as a loadable kernel module Date: Mon, 3 Feb 2020 01:28:52 +0300 Message-Id: <20200202222854.18409-18-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200202222854.18409-1-digetx@gmail.com> References: <20200202222854.18409-1-digetx@gmail.com> MIME-Version: 1.0 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org The driver's removal was fixed by a recent commit and module load/unload is working well now, tested on Tegra30. Acked-by: Jon Hunter Signed-off-by: Dmitry Osipenko --- drivers/dma/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig index 5142da401db3..98daf3aafdcc 100644 --- a/drivers/dma/Kconfig +++ b/drivers/dma/Kconfig @@ -616,7 +616,7 @@ config TXX9_DMAC integrated in chips such as the Toshiba TX4927/38/39. config TEGRA20_APB_DMA - bool "NVIDIA Tegra20 APB DMA support" + tristate "NVIDIA Tegra20 APB DMA support" depends on ARCH_TEGRA select DMA_ENGINE help From patchwork Sun Feb 2 22:28:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11361845 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 958D41398 for ; Sun, 2 Feb 2020 22:30:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7327120679 for ; Sun, 2 Feb 2020 22:30:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="A14PE8CZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727223AbgBBWaI (ORCPT ); Sun, 2 Feb 2020 17:30:08 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:34391 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727262AbgBBWaH (ORCPT ); Sun, 2 Feb 2020 17:30:07 -0500 Received: by mail-lj1-f194.google.com with SMTP id x7so12652689ljc.1; Sun, 02 Feb 2020 14:30:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fGq+XEJOzs9YbjxSchy3T1osXwV6uIluvBu6lsOH6XI=; b=A14PE8CZFI9+v8L/CKRfc7l2yQzvFnqMH8SPk4w/cli0yUcEQSso3qokwECaQXlHJV OepFgvPT2xkUoUb7S/h1rmACEGhZDxbTQ7Trzuhk8fKtb+F/rpW35V6j4fMzYsgLEtm1 YslJ2Lg4SR4JrNIU28cPcO8fzEQ7mJ4WpKtjJhfjBL6U9RxKd5YkhPojY1VmBJBbZpPb D/yO3d+ITN7TlO2ZzTqd9WU+S2mURn/YHDRnEi31ah5Xx2rMbE5GeXT912BqOi3boW+6 32zHe3kyQbT5HGXVv+HFQEkDvtCESp7bMl4c1UPE3nQjigUpham3GydNXA9lcG5DV+nW FQRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fGq+XEJOzs9YbjxSchy3T1osXwV6uIluvBu6lsOH6XI=; b=rGLXFwd/EXAFVRLTfdk4dRcahyG15uVFnMkRTgX0YNsJCQVRq4ewLgQ4Gjvx8NhA3b 8gf//0jxEBhZOdbWDXmAGL5LGEcjsbeaTdCp9Tw3HH930PdISRSXV2sCARXCAGIopoeH WBMVmZpcty4ZKASrAZZtuQ5EMJbO/+sSl4Z8yDxHB2KCBk9JJSpXU6O4C0PAP5QBgYqx TZCG6Gps0RhFSFFrl09vCwaRpPZt25CsJ7vBJV29XiR+p7/xYu0aSLu2gUp+BE2PMmj7 5fGfym2hgwn188sBCBBAaQ2VmZ554ZlDfu9sJ4473zofXMl82lnCk2PU4UKH9KUqAelg uMVw== X-Gm-Message-State: APjAAAVjZAN23xd/zwERvk1Vo2SjCGtXrEQSwdpqu7l+m+UTaVUbu38v +YdM5CdolFDPgTZ/52xnKJaNgCEx X-Google-Smtp-Source: APXvYqw5dlwhIO2GVGTpC7E84M5RyYxkbSo8Ok2ECinJVQ2BYB9aoh7+DjILkvuoPEEHlPWOwrUnCA== X-Received: by 2002:a05:651c:299:: with SMTP id b25mr12497917ljo.1.1580682605655; Sun, 02 Feb 2020 14:30:05 -0800 (PST) Received: from localhost.localdomain (79-139-233-37.dynamic.spd-mgts.ru. [79.139.233.37]) by smtp.gmail.com with ESMTPSA id b190sm8050307lfd.39.2020.02.02.14.30.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Feb 2020 14:30:05 -0800 (PST) From: Dmitry Osipenko To: Laxman Dewangan , Vinod Koul , Dan Williams , Thierry Reding , Jonathan Hunter , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Cc: dmaengine@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 18/19] dmaengine: tegra-apb: Remove MODULE_ALIAS Date: Mon, 3 Feb 2020 01:28:53 +0300 Message-Id: <20200202222854.18409-19-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200202222854.18409-1-digetx@gmail.com> References: <20200202222854.18409-1-digetx@gmail.com> MIME-Version: 1.0 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org Tegra APB DMA driver is an Open Firmware driver, so it uses OF alias naming scheme which overrides MODULE_ALIAS, meaning that MODULE_ALIAS does nothing and could be removed safely. Acked-by: Jon Hunter Signed-off-by: Dmitry Osipenko --- drivers/dma/tegra20-apb-dma.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c index 7e9ec945d6bd..05d0da8d2490 100644 --- a/drivers/dma/tegra20-apb-dma.c +++ b/drivers/dma/tegra20-apb-dma.c @@ -1669,7 +1669,6 @@ static struct platform_driver tegra_dmac_driver = { module_platform_driver(tegra_dmac_driver); -MODULE_ALIAS("platform:tegra20-apbdma"); MODULE_DESCRIPTION("NVIDIA Tegra APB DMA Controller driver"); MODULE_AUTHOR("Laxman Dewangan "); MODULE_LICENSE("GPL v2"); From patchwork Sun Feb 2 22:28:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11361851 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9D0861398 for ; Sun, 2 Feb 2020 22:30:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7BB8E2086A for ; Sun, 2 Feb 2020 22:30:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lISbZZnU" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727319AbgBBWaU (ORCPT ); Sun, 2 Feb 2020 17:30:20 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:40954 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727053AbgBBWaI (ORCPT ); Sun, 2 Feb 2020 17:30:08 -0500 Received: by mail-lj1-f195.google.com with SMTP id n18so12589190ljo.7; Sun, 02 Feb 2020 14:30:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3LEQBc7KTSu78YIgLtGrWKgS6uNh01RCVuGt61iLvic=; b=lISbZZnU00bjOcwK6lNgW9KFw92cIfNM3if8VKNZtXucp1xR1p+hyPn8C2qOPRm0ge 1wrXq8YVv56Lba+CUMLxV5WHKyMOn/xz9TN1Ld7LW3ONV9B9RXtZZOl5DtgVspqQ7HCQ IbEmlQDXxu60wz4O5nRctRtfAwxb40oOn0Wpce3pdoBpKwUfDXnAXeqR2yNjyvqaPYFj Cu8HOoCOLDccgr45I/EGGOhTjxcqL+KfG7TyxFzEHmYrhCfkxxWibGIIchZm0OLeK3ya 8e7RPPC9OQQnbJByhMP8FfqZzXEKqCI/46bqJpXBV3FV5NTZ4jF3jihJYtTESVoI0CNs B9HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3LEQBc7KTSu78YIgLtGrWKgS6uNh01RCVuGt61iLvic=; b=Osf+9CAA7//32TMc8aVBG3jXDIuAYbLAfVGuugc+Ro+D1Yd/PSYpPP+8SH9DXsD0Le aRKR8f6DkxEP4cnfQ/nwnkZn38RnfS715T6PJmt5ag9jX872PFG0wjw5nvLjOjvwUOlv 4YfHd4TJ6QFCVCxh97dbqT7dbxFr4f59c7IOrvuDfMWy8aKbjFyGIm8ButPqnqTtz2Xd QLySXbyYYQZ9g0k+GWDWhEGkH5F0IvEMQaZwC9U8gYA3T5r+rYW9Fe7FNdblw9wq/vKO E7jEYitmKOfZKncYYGKFwa6tJDicC9AfdZYrtdzrt/uKXfphJ25f18PZi2lHAtRP3m3G 3qYw== X-Gm-Message-State: APjAAAU1QPzRj19MRmqjQANlfXP2vk2arq6d3R0mJAMDJB46ppJHQifc rySYBm4r6AbmqXzh+MvAJJE= X-Google-Smtp-Source: APXvYqymT/4UFwSeWHKrSiy8uEFhmCxBIB0KVVlaYQ/aIjzvXG3nCjdIm9QuR7NkHZLCmR4mUy5neg== X-Received: by 2002:a2e:809a:: with SMTP id i26mr12363549ljg.108.1580682606502; Sun, 02 Feb 2020 14:30:06 -0800 (PST) Received: from localhost.localdomain (79-139-233-37.dynamic.spd-mgts.ru. [79.139.233.37]) by smtp.gmail.com with ESMTPSA id b190sm8050307lfd.39.2020.02.02.14.30.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Feb 2020 14:30:06 -0800 (PST) From: Dmitry Osipenko To: Laxman Dewangan , Vinod Koul , Dan Williams , Thierry Reding , Jonathan Hunter , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Cc: dmaengine@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 19/19] dmaengine: tegra-apb: Support COMPILE_TEST Date: Mon, 3 Feb 2020 01:28:54 +0300 Message-Id: <20200202222854.18409-20-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200202222854.18409-1-digetx@gmail.com> References: <20200202222854.18409-1-digetx@gmail.com> MIME-Version: 1.0 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org There is nothing arch-specific in the driver's code, so let's enable compile-testing for the driver. Acked-by: Jon Hunter Signed-off-by: Dmitry Osipenko --- drivers/dma/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig index 98daf3aafdcc..7fc725d928b2 100644 --- a/drivers/dma/Kconfig +++ b/drivers/dma/Kconfig @@ -617,7 +617,7 @@ config TXX9_DMAC config TEGRA20_APB_DMA tristate "NVIDIA Tegra20 APB DMA support" - depends on ARCH_TEGRA + depends on ARCH_TEGRA || COMPILE_TEST select DMA_ENGINE help Support for the NVIDIA Tegra20 APB DMA controller driver. The