From patchwork Thu Jan 30 04:37: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: 11357369 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 8585C1398 for ; Thu, 30 Jan 2020 04:41:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4D904214AF for ; Thu, 30 Jan 2020 04:41:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ty7+zLjZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727188AbgA3ElP (ORCPT ); Wed, 29 Jan 2020 23:41:15 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:37331 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726774AbgA3ElP (ORCPT ); Wed, 29 Jan 2020 23:41:15 -0500 Received: by mail-wm1-f68.google.com with SMTP id f129so2583636wmf.2; Wed, 29 Jan 2020 20:41:12 -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=ty7+zLjZC+e1497JLhgRQXihu2uxZyA5DNEb5fECrwyaFw18uCb2S87UfykJY/kxY9 MU9wJiwYWojsj1p5aSsWT60CRn91Cly7JY9hR43Y7bkKvG0rmucoCdYCP3sE0cFdG4JQ K7aVRhOw6i9zKkfDUks6KB3y37D6Vu8pKtgmZt3gjvX1yR6c3NEwSAXjhdCDiBFQ0Ahj V0v60vdfICoWu9aS9Lwlw0IwJKV1TcsTVPc6hJ/Ho4J13AgFaym8b2g7pXCAWwljwWwF LnB8GeMYkNWD3RB7aqwq6S2RH5zw5UB1MXxdaMT+dAed61TuSufY/59T9vPDuNhAHDha 2XcA== 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=g/zadIJZ0HY35oYeXTN+Ez9NiF5Sbuh2dYxbEX/P2SGuLc/PV5MF/WUvxWSr0mivwv tMW/gL1pfLEHFdUgWIGQ5heOCNNEH2k3aWpFQjfjFULc5jWs2kuZoH8qa1SHc+G9LGhc 0PhDgHRj8pcP+v7u9HZ3zSNVD4BvjePZX3lCUOvduzPDQRV07GCzzKHXOYQzS8wZ5Dgq oIga0Uv7H96r9G3pZEW5yb02jiW2pSDnjon5aruiVnl/eAlsFm/VB1N6mkHLbznFJToE s/q0Pv34NLKm6w8UaC71qqFtzmnsgILRr0E0uSaoZ9B4CLMeKZgL0k8neteQl2fVVy1v l95w== X-Gm-Message-State: APjAAAVgXnPh+0LegHiN+nQ3BZTY1Fnt3sGzNFe8vs4hHgsGXXnRBJah yyqQ1mGTnsdgfczt3N10F8VAkR/c X-Google-Smtp-Source: APXvYqzhwcmCttCKOtiyc9y6CXeRMihy7gJ2BUtRJOR2cubI5yf3KFV3ZGNWTdRW8A3/bSIrq7g2tA== X-Received: by 2002:a1c:a515:: with SMTP id o21mr2916349wme.85.1580359272167; Wed, 29 Jan 2020 20:41:12 -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 g128sm4494672wme.47.2020.01.29.20.41.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jan 2020 20:41:11 -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 v6 01/16] dmaengine: tegra-apb: Fix use-after-free Date: Thu, 30 Jan 2020 07:37:49 +0300 Message-Id: <20200130043804.32243-2-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200130043804.32243-1-digetx@gmail.com> References: <20200130043804.32243-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 Thu Jan 30 04:37: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: 11357395 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 D9DE61398 for ; Thu, 30 Jan 2020 04:42:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B912E21734 for ; Thu, 30 Jan 2020 04:42:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="eXSAMmfF" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727206AbgA3ElS (ORCPT ); Wed, 29 Jan 2020 23:41:18 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:35862 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726771AbgA3ElP (ORCPT ); Wed, 29 Jan 2020 23:41:15 -0500 Received: by mail-wr1-f65.google.com with SMTP id z3so2351527wru.3; Wed, 29 Jan 2020 20:41:14 -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=eXSAMmfFk87BiKVYPukim1qMlYTyAfCxj3cafWWF7C798pYTvoIiW1dNpPLau/DzhT 4ovqtYYxDuT9vvYLKcU4+6fOF55inI6SsYo02XdTZIolsaQZXezrsp95L4IJenag7O5R ONmDth9pEY6UDRWPNO6ILHo83X5F4P1yv7rZwDwqEkuudnEuAUwedyMlM8CrmMR8RGbY UzLYp5pZhzMJ793y69arBwbkg3MFesYpEzk5IID/ndRt3yzLRngiFDCawqSD4JFhHjhH AcVpEjdrgxO2MjZq37owS93u9lf4VWGCUXPptAxU4UWLmSYa5vVVL0bbq76gMBNSgDFR jMVw== 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=OFkWAo4azDgmjkcW37hC3NwBf2q1e8uKDqwtcEWFreyr95UkKRbbKXBwp+intitVIV d5pKFEzueXzE3t2CvL6FH8Gq7W0JSSZmr2eti65rbJwZK2kEzReJlnuaa2QyhkeZawGL Fhs0mmKzG5HElrbQuRMAXIORVyX7x1D7W9gt726f+xvVj3jro663v5z/FicP+w3JyKAI Azj+STn1V/nnrgp17BJC65SUyghABkotNIHHy7eba+/YVpLE1P6qkqNnhSUmWHZyOypj xAAV9JHSJhAEURlCrfNxMoSXPHg87/cuc1lnCnV+wCRNUJG23xiQk+/3pKzqsYckp7HX bk3A== X-Gm-Message-State: APjAAAUSPWQGkwd8AjqU/szOgnOmPitG8x6uIQJT+6gPQp8idjH+Tbba ej8dNt9ErRoZOmDfpYehL3HAjS9k X-Google-Smtp-Source: APXvYqxqfwcb7F/BYCfuV9zHzoCbE3NcSh6SwQs9SSsEHxvQGQkP3V9evrgcLM4oG8H1RvGhvPmA5Q== X-Received: by 2002:adf:c446:: with SMTP id a6mr2743078wrg.218.1580359273365; Wed, 29 Jan 2020 20:41:13 -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 g128sm4494672wme.47.2020.01.29.20.41.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jan 2020 20:41:12 -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 v6 02/16] dmaengine: tegra-apb: Prevent race conditions of tasklet vs free list Date: Thu, 30 Jan 2020 07:37:50 +0300 Message-Id: <20200130043804.32243-3-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200130043804.32243-1-digetx@gmail.com> References: <20200130043804.32243-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 Thu Jan 30 04:37: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: 11357397 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 C547E139A for ; Thu, 30 Jan 2020 04:42:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A33B7214DB for ; Thu, 30 Jan 2020 04:42:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="B2c/Ugo+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727491AbgA3EmI (ORCPT ); Wed, 29 Jan 2020 23:42:08 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:46588 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727197AbgA3ElS (ORCPT ); Wed, 29 Jan 2020 23:41:18 -0500 Received: by mail-wr1-f65.google.com with SMTP id z7so2254827wrl.13; Wed, 29 Jan 2020 20:41:15 -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=B2c/Ugo+DRiMGk3cKoKTYMqrXcMrfVSh3UTDS/ez+tkY4e9VZlTlSuUTOV6NxSfCYq CBSOUyBmBQoqASPil3wV1MEwBEaRj0PLX96wtgiBjXPJa5hnGk/TTwjGZ6K93hw6oeog 6a135e8h77UNH5adHCyZXSxt7n9F3dryIV3X80VbW/Iy3KlgSpxwL8lEs5at8Jujy2PE QqhAff2CSTemIR4+UH2O1LA1JriWZKQmmvy+D3EEvULBUlA/6gEgWmQDwLcFVpAyVnuc TuzCZ+jToLRwGFzbNzzl13xvZelKpIdOTLaM3VpwCGWinqL9OJmr5IvGDEYMQCy3suBl Ybig== 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=pPo/2Xog9s9r3h9fJih+KW7JV3hfH2f4tN3Lp0/6Qd0zyYAAbf8sJvzPxcI1Sjmzdn Rz+UTFWnT/2x1ShjLurntKeQfick6oDXdwCmXA0R1yk85bTftISZXGfbnev3ZUBL1tGf JCJxIvKqVS2cJ+FeJN5JGMs2ov5ykbX36QQhfEn/Iy1CbBCME4Lcd8mn/cVCh0yPtgiM wBDkT75e72urRPxsb2aRpqc8uNGbVkGuMMvTT6EU5AaKwQ5UgxhI164mjEUkgOEtFUeU XPq2j0ATAumujEboJC/RIzFCIJunuRBI3atreKlX8CaDhJADjkfA6+FiGMb8TagjC6FJ lLOA== X-Gm-Message-State: APjAAAWzVryLY2XWFzLiFwhRoExOAwIHCj7mEFyIqzQ9+0JWmo7hBcxw kEYSAn4adTTOwYx1ZbueJdc= X-Google-Smtp-Source: APXvYqxJVtFj6BEtsaa/q40dObnw70RgJf5pBvSQ8KDFK3zdappqFCeL0A9zw04nEAZLY6fC8rh0iQ== X-Received: by 2002:adf:81c2:: with SMTP id 60mr2737199wra.8.1580359274628; Wed, 29 Jan 2020 20:41:14 -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 g128sm4494672wme.47.2020.01.29.20.41.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jan 2020 20:41:14 -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 v6 03/16] dmaengine: tegra-apb: Implement synchronization hook Date: Thu, 30 Jan 2020 07:37:51 +0300 Message-Id: <20200130043804.32243-4-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200130043804.32243-1-digetx@gmail.com> References: <20200130043804.32243-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 Thu Jan 30 04:37: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: 11357399 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 18E87139A for ; Thu, 30 Jan 2020 04:42:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EBF20217BA for ; Thu, 30 Jan 2020 04:42:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="tAXPvMTC" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727502AbgA3EmI (ORCPT ); Wed, 29 Jan 2020 23:42:08 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:37335 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726774AbgA3ElS (ORCPT ); Wed, 29 Jan 2020 23:41:18 -0500 Received: by mail-wm1-f65.google.com with SMTP id f129so2583760wmf.2; Wed, 29 Jan 2020 20:41:16 -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=tAXPvMTCrcqvRg6DMs4qAACn1NEWJid5v0kQH5SF5VgGTN/xj3GGOaQ8kvUKHayg2v De9yU6DvJ3iePTh39yziabf0/fHH+s9zKgE+wP6txQ5xH10buVKbLVcRLieCM408An83 4BdlXbJFzZpNpevaGS1y3bWO2eaiRbp+0WPp1iTxXEtM9+XrVoeyVYpwExb+MImP5XSQ 8qLBfn5CslXP7bMLUeoayjukOdgtgGvVKBETYa3AU7yACh8CdPuvcd1cZ7D8wZ5CkD4t glH2eXYayRge+OuW6culmBAJS+opwF70p1WA+6rwcg6OE5vFTGH8dB+rsDZf79lJ4a2q QNHw== 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=cBmLCQVQtaqlJUHqRbMgmmd6Zge9JSRYUNOjFUxCd4aqXZ6Sj0bnLxVvkNABoDTmsH IwRXpkBjwnBqG9NvA5ajab+shppaBR3jXLhItolpi6v8FZDY7GGpKeGDOmdkiC8gIYop Knd/xr/mASzsxviSDpLIWyMyUK+7XftTWMCGpxBpv1EvVIPXoRozmVJukUlHPyRj2gvR CJYQSvJS5jxsLt98ahWec7tu4Q4doCPHIHnk683iWS/sRUM5xWCSHN+pN0PPORcP40u7 HDewPrh8CVI+an9XO+5vX22nF93wIfFSbvF2GUz3N0l7yuRLc3ZMiARwpjZLamXs0AkO v2Dw== X-Gm-Message-State: APjAAAXJGkOjLbXUjRHbqwOoGRHBxnEtTuvyZgVYSPpAPXkB2jD8tlg/ L9uCpObjcna/3BGKP6liiLeikbJ/ X-Google-Smtp-Source: APXvYqxjG7C8ZCuesf3lZQJXPgxsRAJzh4HtA8uJJsu8/cX1SnVRf98iVX9ukNflN1geDJrkRKTGxQ== X-Received: by 2002:a1c:a381:: with SMTP id m123mr2876157wme.158.1580359275874; Wed, 29 Jan 2020 20:41:15 -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 g128sm4494672wme.47.2020.01.29.20.41.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jan 2020 20:41:15 -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 v6 04/16] dmaengine: tegra-apb: Prevent race conditions on channel's freeing Date: Thu, 30 Jan 2020 07:37:52 +0300 Message-Id: <20200130043804.32243-5-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200130043804.32243-1-digetx@gmail.com> References: <20200130043804.32243-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 Thu Jan 30 04:37: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: 11357371 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 B4E271398 for ; Thu, 30 Jan 2020 04:41:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9231E22522 for ; Thu, 30 Jan 2020 04:41:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ewBvbUsh" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726771AbgA3ElT (ORCPT ); Wed, 29 Jan 2020 23:41:19 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:45018 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727198AbgA3ElT (ORCPT ); Wed, 29 Jan 2020 23:41:19 -0500 Received: by mail-wr1-f65.google.com with SMTP id m16so2279757wrx.11; Wed, 29 Jan 2020 20:41:17 -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=ewBvbUsh6esZiVClIKP2egCsZsrz3+8h1EcFKmAPpx1WlYE0/IJtZ4OlQ9cehlwJg5 PkDnrq70f9N1TJS8sxAYScfrdlfPXw5LKprbRcUEwndLb48wZvCp8gRMZrELS2Su/Fy8 /0+QSbUPWl0aXtaD01BJN91zJwp7j8kzm2CxH0Az8kLDXyArNXKqP9tG+gEzy8ZSSOlM QCXZNIhS3WUcZeolhNoNpaIhc7kJnvWnqAwalpuIHpGsjGUxy6Sn+0kAnlVbbmcpvmLb lZqlAWzr3mbpU867haELoC2xBmH3f/27lvj3ZoxLOypL9iC4JjQCkfduBGBVDSI9yATe w1+A== 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=hggYi03XdwlzjZsUFQ4dwzj1NCkG6zVgXbccZNSvgFyXZKNRCMCbXwb1MmwuCqqH4h hTQvn7MMpm0r8COGezFgDdurlXBGr9WHVFGYAu4HuLa/eFfuFg9fLk3OQxOTQaDB/+MS VPns0+DdjLPeUOGMz+KW6brrAsnOf4jFQ8NFo0BkBPRclwdxokwWtcNStipP/wVTvTv2 C4VjXwayK4l4pZRm8xHzM5t3LYzdgaj33JQv3BrB1ddElLPF5zpkobFnwIXYEEUma1zb 0OQ/ueJxA8FuVrK9fJ/LzjwdBWDythEcgyPsM11jIOgVPh+Wx2e9IlZomv7HeAqp7VIQ Wkxg== X-Gm-Message-State: APjAAAWopFNJkuViDNvwXeS7szVUpGBA/YtnKHMwPApmV34JgN0dTRVx oJ0bEugswrOLJzgVI4HxpoU= X-Google-Smtp-Source: APXvYqz0K/W4fTigErh3b2DhGlMMyLWfPLfPpb+snnUboxZDO4MJMrVzZ0cF4MdGahfx8lC05hX0jQ== X-Received: by 2002:a5d:4b4e:: with SMTP id w14mr2824848wrs.187.1580359277055; Wed, 29 Jan 2020 20:41:17 -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 g128sm4494672wme.47.2020.01.29.20.41.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jan 2020 20:41:16 -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 v6 05/16] dmaengine: tegra-apb: Clean up tasklet releasing Date: Thu, 30 Jan 2020 07:37:53 +0300 Message-Id: <20200130043804.32243-6-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200130043804.32243-1-digetx@gmail.com> References: <20200130043804.32243-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 Thu Jan 30 04:37: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: 11357373 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 E0BF7139A for ; Thu, 30 Jan 2020 04:41:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BDF67206F0 for ; Thu, 30 Jan 2020 04:41:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="b/zhBBvE" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727198AbgA3ElV (ORCPT ); Wed, 29 Jan 2020 23:41:21 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:36560 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727224AbgA3ElU (ORCPT ); Wed, 29 Jan 2020 23:41:20 -0500 Received: by mail-wm1-f67.google.com with SMTP id p17so2590969wma.1; Wed, 29 Jan 2020 20:41:18 -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=b/zhBBvEkiqBLRnuBsQqkOSQ05OiHftspU0dRqgfqYQT0Y0urOdgkaCAiBBBNDv4Ms 910Uv3hw+ok892zm/E9KbW89ch5kb3DQt1FQsfjOxHiUB9LfbaG2LQLOzFLE46x6G67E qsJbqP8GEFrf7UE8A7f6642cWadsUUap+ICqBIApxipyg2nb2gSZPNVfVCFL7mTgEkOC pqtmO5UQiTBKlxdVbATQW6Z64HjgIgeY8Qc/tjexDmMJGszqwT2e4qxzqEQxNgTPh6hW 16qT7sQ6juAcZ55yLGTcv5/yMFJMqmk6m0zx32R2lU7k4UhB0x/hefRKUpCaJk1sgfXj +TCA== 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=VIH0dnNM1g0kQQC0TLYBZmVVDrnceu+kiAHP7hraCqMvbzG9Bxo8AC3Gwupn/5GGfx 802Cre/lA/gMcZAPNvfLPGAH3bkTBmau8t1HfxHfWUZ+9D4uK6MxbEVRwiXjWtpk/6bE VpSF0Drz9KStifUMvKuEBwEyu8uOodzF+aZJOocnrooNxQLs2EQ3VX+oGFuNeKxbTLt3 bPc5WoFDGV1PKq3L6G4NiM2pP/xFReYPOfOu2qIOWBedInwSEEURdTAIJamjSMIFH/hK 6UQeBOpXi4VMgE/nUFYWja7IR/nwVIyyRoa8cuxNQv/NSIJZmes5LIGFjoX1WdImkrSm tv6g== X-Gm-Message-State: APjAAAWNE8Ookpn/QdZwmSW5ZLr7B3B+/oOYzbLf0puzcEhjeSnXc4fE h1jcaDDnua7qmqrPg9fZ9wk= X-Google-Smtp-Source: APXvYqxi631LSRfQwLHKRoolj2ZGsh7ydqUCGdJ1YVi2DoxjifQS+CN4On6A6yszOV8H4mEM/fWOLQ== X-Received: by 2002:a05:600c:2406:: with SMTP id 6mr2948859wmp.30.1580359278245; Wed, 29 Jan 2020 20:41:18 -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 g128sm4494672wme.47.2020.01.29.20.41.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jan 2020 20:41:17 -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 v6 06/16] dmaengine: tegra-apb: Use devm_platform_ioremap_resource Date: Thu, 30 Jan 2020 07:37:54 +0300 Message-Id: <20200130043804.32243-7-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200130043804.32243-1-digetx@gmail.com> References: <20200130043804.32243-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 Thu Jan 30 04:37:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11357375 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 AF221139A for ; Thu, 30 Jan 2020 04:41:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8456F2082E for ; Thu, 30 Jan 2020 04:41:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RFpPF5Dz" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727224AbgA3ElY (ORCPT ); Wed, 29 Jan 2020 23:41:24 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:33141 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727266AbgA3ElW (ORCPT ); Wed, 29 Jan 2020 23:41:22 -0500 Received: by mail-wr1-f66.google.com with SMTP id b6so2387072wrq.0; Wed, 29 Jan 2020 20:41:20 -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=RFpPF5DznAHSJp0561klkZyHiO200bT45AZmhrdwzE1VLCdjlgH/EsQspqMOQoD+DU Splyj7r2JJUnkrsPkw/+NqXnUH/6fdLwE9W55OSE8qZdcdaVDwawRQwT9PST/z2+ky0A XO5oKCA4+UrgX1lw8upBP1wPe70QeGDmmGMrNs+9lP753Acz85Q2sCFc7NbURU2C+KHw o8t2vxWwV3Vt8BspbwMcLc+8SM4H2pVytD5z/wC1n8jlYbMuzc1GfNI+YlfKFXugWsjN rzU+fgOyVYJrHh7C+LxCrsqO46SvOSkiMQdFsanoqMSFYVIRWJbPFnqEK+wDAxLq+3bC 41SQ== 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=gdM/cKd94Nd0qQmrgBVi23YNM5e0bq2ENlgraOJTmcALc/5F3/SliWCCMaGNfe+x2K s1hnBb3HX8T1O52uzF8yoYX5FodmKRDndl0tRjEljZP1FBiFJUp7345qF4YtoO2ek/a9 phAYW/38Ng8H5JpGzsBUmC955Ehbjk+uaLuLpHVNye6evPt8GRXBm0kY8iauz92uRbmn zjUUjRe2eUVTfSSbduD3H46pZW+qWSYLIgJMBbKiDZKOEuqWuWtmG5etE+Y3Z/ePuZax 0gQ3brbwxkPZyLkd/C5H9+xzBhiPYXuQY0vmVYfrV/doPuLlM54+cLizyEugzaqstyQT R+lQ== X-Gm-Message-State: APjAAAXO1cTqkuSqhim6Ut2t2qZog2rqXi3UMxoDgHB7l5W9jEJ/zMyx wI5UgXYVF04ik4a4Hmbi0kk= X-Google-Smtp-Source: APXvYqwQAzv7EiQmNzDsJmkuKtaqk+hMKr6pXBYU2ceXZiFnq/UpTS5BIjVXKX9WSul6pMk4lvusKw== X-Received: by 2002:a5d:6144:: with SMTP id y4mr2666945wrt.367.1580359279429; Wed, 29 Jan 2020 20:41:19 -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 g128sm4494672wme.47.2020.01.29.20.41.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jan 2020 20:41:19 -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 v6 07/16] dmaengine: tegra-apb: Use devm_request_irq Date: Thu, 30 Jan 2020 07:37:55 +0300 Message-Id: <20200130043804.32243-8-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200130043804.32243-1-digetx@gmail.com> References: <20200130043804.32243-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 Thu Jan 30 04:37:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11357389 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 92F0B188B for ; Thu, 30 Jan 2020 04:41:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 53AE1214DB for ; Thu, 30 Jan 2020 04:41:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="T13knWb/" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727330AbgA3El0 (ORCPT ); Wed, 29 Jan 2020 23:41:26 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:34553 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727296AbgA3ElZ (ORCPT ); Wed, 29 Jan 2020 23:41:25 -0500 Received: by mail-wr1-f67.google.com with SMTP id t2so2365383wrr.1; Wed, 29 Jan 2020 20:41:21 -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=8R4cIFMul2hKo0m/PheHCqFc+9SmdmMQVyOuvMiW/ow=; b=T13knWb/cD6TyJCUO8LmyQrnAir7yN989sSDEMGUkgiS5k4NsX0+gl3n7Rvy4O5tsX TLBoAxwOwJGGhUrsvNmxeXfSjRnwYThVu6i2+AlZEojo9kEjgQNKeFo0emG2fxDg9CzM 4mOweFJ70IU3A5mGF3VlWI8nL+4AFTKLjumqZczu652g9ypA3ig6VEDk2nLEag/F57VC 11/9DGWiMJeO0AqYP0M1I7Srbwa8oRsoJFu6Cmz7VBVxYtUqGIzdWtJxIaQgJyPG4RUi DCK8mRSlwenqI1qU9h+Zel3qdqC+C9clfQbSvArn7XIaqwQ/zQRbP0X3twl0wbwZGvku zAlQ== 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=8R4cIFMul2hKo0m/PheHCqFc+9SmdmMQVyOuvMiW/ow=; b=cbU410Z7B33+9EZiKK8OUKylmTN+ewGYr/gLeOtRpoKH5N8gYkzwEqgfZWWlVwkUqA byw/0OUztXN4hNp/adqwG8PC2OMHJ6zOU27uqKC8Z8SU74iQAtLOXSobo6dS+Ub52y8n CQLIB/HrSseW2at71WW+ZgXpTrLSzV2SMFxIQPNkpSeUkM+/OEselJ3P2zLc52Icf//Y iPh/i7v2pDMqvc0d+xhjV3q4jFMJBDvOUfN2Bf2KH4uvTHcvfPc8cGcKC/cgujDibioG 3cnrxDc46pGOIARmFBuW/ALzTy4RJ/MrSrqX9O8eD/q4+/m90LPKYggIfGM84UtVeD7d VNDA== X-Gm-Message-State: APjAAAW5+Alwq2GWCWxO17KoW5SxNuQ/UbNJ7FoTCITrbJhuoobQ8Y1t fVDuUDrS+EjJUPivzt5vKgA= X-Google-Smtp-Source: APXvYqxG01YFPySret8sxqnGWFCE1siozrBZF8aSlc4V+NfDFX3M4Ie/2aT4DCndlDWkfl3PdJpzkA== X-Received: by 2002:adf:f64b:: with SMTP id x11mr2690624wrp.355.1580359280756; Wed, 29 Jan 2020 20:41:20 -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 g128sm4494672wme.47.2020.01.29.20.41.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jan 2020 20:41:20 -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 v6 08/16] dmaengine: tegra-apb: Fix coding style problems Date: Thu, 30 Jan 2020 07:37:56 +0300 Message-Id: <20200130043804.32243-9-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200130043804.32243-1-digetx@gmail.com> References: <20200130043804.32243-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. Signed-off-by: Dmitry Osipenko Acked-by: Jon Hunter --- 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 Thu Jan 30 04:37:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11357393 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 3225B1398 for ; Thu, 30 Jan 2020 04:42:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0E988214DB for ; Thu, 30 Jan 2020 04:42:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LRfcSnbx" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727158AbgA3El7 (ORCPT ); Wed, 29 Jan 2020 23:41:59 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:36565 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727303AbgA3ElX (ORCPT ); Wed, 29 Jan 2020 23:41:23 -0500 Received: by mail-wm1-f68.google.com with SMTP id p17so2591107wma.1; Wed, 29 Jan 2020 20:41:22 -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=cjyMiwvc8w9ROljcHQa4qpuZZMm1wlAr5aTxKnohorU=; b=LRfcSnbxZRU9OSZNiCMYYhUj+XKN6WAfZyPo/z/92GAYluOYZlr2KKh9yasuNjI8fK H40wEbYFe7v93RpGec4HKT2TLwN+FqikQnVZgtHvQ07vnTKFk1Kw3eiqXRg+zi9hC8ez 1PBijBciAMN8CCtPkMeLYrG95p7K/QH4TbuHOa28VDO65BGtTu7ehCqbzVADdX+vdk76 q/vxzK3O9k22AoRLBOmr64MswHoCWb6D8vJ6WOwt92blInnp11NhdMcmDoM46j3QRpC6 y+wLSXOuljAkUj/u4vKqXYFF/nRfFcWzowpNNPeF8HdVv0I51ibclYCsHh8K1lHXbedw rBgg== 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=cjyMiwvc8w9ROljcHQa4qpuZZMm1wlAr5aTxKnohorU=; b=IVfKtq9Nujp1xMc5Wt5STIV4BbmU3eVy8aYSGmqKZ1/88NLPjVUg64Zd4B5I1ahahi SgwFWw1xMguCipmoUxiJQ4UDCOXubueExHQmqxoCPkr0BUXSfBDk3tUWrMiBqtlYLyOm vs2Q/uzrM/Yv30g/pd2t5Hq8anwUQT1fQn7Np1U2MPhmdInCT1j0CYY/ke824EUgKULq 9BZo9EW+xy4iA5b5lrG/NWNTRFPZHvIxpvp3R7oX4eK5e99vGrB04g4rI2l/zcbkua4W gQhDrj75kEKUsfqhVY+quZJW5mhQBNEdaEvSyd1rvcbMku/mIW7hTlRlPNffQOe6f9H2 d3fw== X-Gm-Message-State: APjAAAVL24WZLSEWgmmErkTBXLetPJOokYPh+7+JtnWZ5J7t3bEtVOTj G4KbWgHwZbjSVHxO9Q0mEHY= X-Google-Smtp-Source: APXvYqzHgWOFn6gkOgLJssjd+KE9/PDpd/dXJm0yaFOwaOPu6g+7d30AHRWNQMCGk/rRxif1qxbvjw== X-Received: by 2002:a1c:545d:: with SMTP id p29mr3096030wmi.91.1580359281947; Wed, 29 Jan 2020 20:41:21 -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 g128sm4494672wme.47.2020.01.29.20.41.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jan 2020 20:41:21 -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 v6 09/16] dmaengine: tegra-apb: Remove unneeded initialization of tdc->config_init Date: Thu, 30 Jan 2020 07:37:57 +0300 Message-Id: <20200130043804.32243-10-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200130043804.32243-1-digetx@gmail.com> References: <20200130043804.32243-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. Signed-off-by: Dmitry Osipenko Acked-by: Jon Hunter --- 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 Thu Jan 30 04:37:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11357377 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 392E91398 for ; Thu, 30 Jan 2020 04:41:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1735024683 for ; Thu, 30 Jan 2020 04:41:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hYGAj2Mo" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727334AbgA3El0 (ORCPT ); Wed, 29 Jan 2020 23:41:26 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:36568 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726875AbgA3ElZ (ORCPT ); Wed, 29 Jan 2020 23:41:25 -0500 Received: by mail-wm1-f68.google.com with SMTP id p17so2591172wma.1; Wed, 29 Jan 2020 20:41:23 -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=hYGAj2Mov70sEbpDjxriRD5UGD6rvZRJztNpMbOgYVK9KTRqj8Xw7JUPAC7evbmIM8 I0kjWlwOGH/5AC2mQQEn7a5fJ9rGxbqyWhBZz0+jVB4qyxb2WVDnjD5pqKrgCxtBuruY +FUUMpWB9zfaQelaXP56ocFoVacouvg3hWvePUL46NTys+kDRDWAl97m6W/LZSdghUjE lWWQQ8PWMqOC0seb5rqzqnSTjbStX81KBaA0I47ZSC0K856QuaSu0Cdppn9Bkqtqv2Rm WoPrWieTB/H6VP0JYhYsU4++UCfpRbnK62tJ3np/SIgVzbMfWPeaHRHVzrQOWva9YuKe 9eZA== 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=pJLIDwBekAWl7zn0UY61mFdVD+9d3kAUOU/vjLrZi1VtVAobPi9FO6SFTE3Vsd/8IF DZI8S2lnjs7lXSRxXHbksFWtLgt3pNTmGRPjvYyJgt4Nl3ShAmfCgG6ogWVv+z3BgxqB mMZKMIY8mNU8t9kNVCOJEVPOjg0vMk/0gzzUehA4zXvV3I6xaTgnjA+dJrSQmfymHQPH ab2wHjELP1FfDqQqjosNZpbIL53ltaO1hdP9hAhwHg5xrvQdV13e8EMwcgK074LMqz+v e6rBK4XjZJo6jvlqJ9iCw9CpYMcUgVm8dkOfpXvjdj1s3EAqtUwGQVuc92ExlLpEWMT8 hVag== X-Gm-Message-State: APjAAAW4ePZVVYpXa32wHNuO1YHFOpEmyY4KsIMQ/Yx/EatbOlTb2jNQ /SWp+NFY0dFbe4V7mMbycTQ= X-Google-Smtp-Source: APXvYqxER3UHF47mSHAJF45z34xxx/xNR6vEhkeFDwOuofrD0Wf+cNtIBgH1q/OQr/+CJh5+LusNMw== X-Received: by 2002:a7b:c932:: with SMTP id h18mr2853155wml.171.1580359283162; Wed, 29 Jan 2020 20:41:23 -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 g128sm4494672wme.47.2020.01.29.20.41.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jan 2020 20:41:22 -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 v6 10/16] dmaengine: tegra-apb: Remove assumptions about unavailable runtime PM Date: Thu, 30 Jan 2020 07:37:58 +0300 Message-Id: <20200130043804.32243-11-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200130043804.32243-1-digetx@gmail.com> References: <20200130043804.32243-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 --- 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 Thu Jan 30 04:37:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11357391 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 C79211398 for ; Thu, 30 Jan 2020 04:41:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9C4922173E for ; Thu, 30 Jan 2020 04:41:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gkf2eEaC" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727472AbgA3Elx (ORCPT ); Wed, 29 Jan 2020 23:41:53 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:37414 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727313AbgA3El1 (ORCPT ); Wed, 29 Jan 2020 23:41:27 -0500 Received: by mail-wr1-f66.google.com with SMTP id w15so2342827wru.4; Wed, 29 Jan 2020 20:41:25 -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=yq76FFCFim3K8AS/11AGvEBu3mubDIdosfsDUsVHNUU=; b=gkf2eEaCL5bO5zFxkHVKiYlv2MmOEo4GD5wBm/h0rqxrG7amsWkflnYD3+u5jRIBxV rqjvpk8qzbHBcn1rx3hsY6FiPoir0FsorCGpXkXB9T1sbD3DuMdJZNPCoAaXROzpavKI QqiFD6sbt2weIZFrPskVEnqZyXlgn7fcZU8a8ndQi+VwdSPgbbeEv3pshMph+xGbEdgG 2oTsJZrGbvHxhiFmhAfBx/JffHIJbNaZX29lY4Qq4Ky7B1JfSWIrko5THdiRPWzUfQgw TgTa46Lj8BEfRr4jgU2lMKqObRZW7ajIjlK5XhYlRq9qM21Qw9NzRkEemud2bTtJoVQR ZMeg== 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=yq76FFCFim3K8AS/11AGvEBu3mubDIdosfsDUsVHNUU=; b=V+laC4C150cBfosZyAGCGBRX2w91G6KmRVQuk6SRFiYzrFRqw+n9dF2m8KUyXyzKGN 9e9VtMZnCq1b885iaZzf6EJ6/uyksuv/fXzMG6UWrYgk3pnUyYhwdjgKLjKZOs5ve1U/ XL2IhO6vcUi2yxzAYM3p4Ko1guHlDSuHKxWshEX3ak/11ZVYmvcJ/hx/w+WjvDQnIiRU Q8uI/p2jFDtrzgn0Yn3E8hBvD80+LNDAAJ74wPJwCJ9id0z0Msz/vMAS9a/XySWkIqTE BOnl+vcJI/dYWUkNPzfW9BXeu1OFsxRvhq55ZHjBJZIW6DVIPEAGpAA0QObhyD0Nr1Qu 7Pcw== X-Gm-Message-State: APjAAAXWXv/UDmuSVwkgUZb6y+c6tdN/VzrTSAF6IhojSrzyp+DuJDL6 1OSXiu75A/AUeVVeifAMB56K5uq0 X-Google-Smtp-Source: APXvYqxbXRxOkLoB7KX9nCo0eqSmtpJurfdPC+F40E41HfrNe6G5MPJ/brnw+2VZLmw4IG43EHONug== X-Received: by 2002:adf:dd52:: with SMTP id u18mr2697887wrm.131.1580359284346; Wed, 29 Jan 2020 20:41:24 -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 g128sm4494672wme.47.2020.01.29.20.41.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jan 2020 20:41:23 -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 v6 11/16] dmaengine: tegra-apb: Keep clock enabled only during of DMA transfer Date: Thu, 30 Jan 2020 07:37:59 +0300 Message-Id: <20200130043804.32243-12-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200130043804.32243-1-digetx@gmail.com> References: <20200130043804.32243-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 | 47 ++++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c index 22b88ccff05d..0ee28d8e3c96 100644 --- a/drivers/dma/tegra20-apb-dma.c +++ b/drivers/dma/tegra20-apb-dma.c @@ -436,6 +436,8 @@ static void tegra_dma_stop(struct tegra_dma_channel *tdc) tdc_write(tdc, TEGRA_APBDMA_CHAN_STATUS, status); } tdc->busy = false; + + pm_runtime_put(tdc->tdma->dev); } static void tegra_dma_start(struct tegra_dma_channel *tdc, @@ -500,18 +502,25 @@ static void tegra_dma_configure_for_next(struct tegra_dma_channel *tdc, tegra_dma_resume(tdc); } -static void tdc_start_head_req(struct tegra_dma_channel *tdc) +static bool tdc_start_head_req(struct tegra_dma_channel *tdc) { struct tegra_dma_sg_req *sg_req; + int err; if (list_empty(&tdc->pending_sg_req)) - return; + return false; + + err = pm_runtime_get_sync(tdc->tdma->dev); + if (WARN_ON_ONCE(err < 0)) + return false; 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; tdc->busy = true; + + return true; } static void tdc_configure_next_head_desc(struct tegra_dma_channel *tdc) @@ -615,6 +624,8 @@ static void handle_once_dma_done(struct tegra_dma_channel *tdc, } list_add_tail(&sgreq->node, &tdc->free_sg_req); + pm_runtime_put(tdc->tdma->dev); + /* Do not start DMA if it is going to be terminate */ if (to_terminate || list_empty(&tdc->pending_sg_req)) return; @@ -730,9 +741,7 @@ static void tegra_dma_issue_pending(struct dma_chan *dc) dev_err(tdc2dev(tdc), "No DMA request\n"); goto end; } - if (!tdc->busy) { - tdc_start_head_req(tdc); - + if (!tdc->busy && tdc_start_head_req(tdc)) { /* Continuous single mode: Configure next req */ if (tdc->cyclic) { /* @@ -775,6 +784,13 @@ static int tegra_dma_terminate_all(struct dma_chan *dc) else wcount = status; + /* + * tegra_dma_stop() will drop the RPM's usage refcount, but + * tegra_dma_resume() touches hardware and thus we should keep + * the DMA clock active while it's needed. + */ + pm_runtime_get(tdc->tdma->dev); + was_busy = tdc->busy; tegra_dma_stop(tdc); @@ -786,6 +802,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); @@ -1280,22 +1298,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; @@ -1328,7 +1339,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; } @@ -1428,6 +1438,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); @@ -1543,6 +1558,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; } @@ -1553,6 +1569,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; } @@ -1581,7 +1598,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; } @@ -1592,7 +1609,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 Thu Jan 30 04:38:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11357381 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 92DC3139A for ; Thu, 30 Jan 2020 04:41:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 682CE20CC7 for ; Thu, 30 Jan 2020 04:41:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Qw333kJF" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727374AbgA3Elb (ORCPT ); Wed, 29 Jan 2020 23:41:31 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:38229 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727333AbgA3El2 (ORCPT ); Wed, 29 Jan 2020 23:41:28 -0500 Received: by mail-wr1-f66.google.com with SMTP id y17so2336566wrh.5; Wed, 29 Jan 2020 20:41:26 -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=qyH+MurQ1K+JP11j8j9cz8CEs+bqnCzxDejqE3pavzg=; b=Qw333kJFTK1oxKsVczg/lLKzEkJrRVhq5Vr8Dnih+UsOimBvxjFlyOMlklhcUtZkuM BNXzyZfYZDqTCEnTLxE2GBKv+OvEMWvCZgKx2uoPG8bQ7C2tHVlb+02m/GqPNtZPXOQ6 DMnF5AZXG1bE0nrK+xnCwpfio8Cs3BlnIr6s1+Htq5WmHt1+qvNxP82zq4SX+uwvx/9a lmPKctsBpJKm0DP+gVfPat9gSthpkPGcib6o5FQPnYZSaPezjNTKrs5H1XGj1Ysm+8zw 6tSXkRb7eWs56/8CK3R55GHzG+Gv3J6/S6z1U98Z+srrZsNpk0AWCzAY21bPevqh60jy 2b1w== 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=qyH+MurQ1K+JP11j8j9cz8CEs+bqnCzxDejqE3pavzg=; b=MtpdNv9fN/FqA6RwafhrYi4lQlxklTBIF/mcui8+b6FsdXvHSi7Jp0yipPRk+5CPAr 63tHMPI8KInD1oPlFhnHTbhDUOKCtSkRZb0xUNYXalHAjzFfDvrcq96CbVGYUJow1U5t HxoHKKzU1LIWKEuwgoTKmcWvsBHV1QlOgdPsUE0ioKz5WUiEgwW+adD7PZDONSpnTVaP Yz0ZuzGWv/WBT4EcJL9UvXfiQTfztQ/Dh1Wy997e7CxB9Dn7n3H9wj6YaefKZ2u+tM/Z 8Dv4m8hLojSykHzimWZQu+LMJLjOw7wrSyocIc4eJdpWvjroPkrXgn5mT5hMszZYbbvH hESw== X-Gm-Message-State: APjAAAV1zq0JJPSXOLVLGt6SR06KdOAxSJGKk0ndPiyryCgi1bof9FVG fXBn93J3DGt/Q1nBNYPtSdo= X-Google-Smtp-Source: APXvYqwIyo92HOte7rKM/wRElv9qg2CZPcLHS9Y3nCkppB7tundhUJKistbvUEhgNwmWOdHy0vtmdg== X-Received: by 2002:a5d:6802:: with SMTP id w2mr2679521wru.353.1580359285563; Wed, 29 Jan 2020 20:41:25 -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 g128sm4494672wme.47.2020.01.29.20.41.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jan 2020 20:41:25 -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 v6 12/16] dmaengine: tegra-apb: Clean up suspend-resume Date: Thu, 30 Jan 2020 07:38:00 +0300 Message-Id: <20200130043804.32243-13-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200130043804.32243-1-digetx@gmail.com> References: <20200130043804.32243-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 channel's configuration is fully re-programmed on each DMA transaction anyways and because save-restore of an active channel won't end up well without pausing transfer prior to saving of the state (note that all channels shall be idling at the time of suspend, so save-restore is not needed at all). Signed-off-by: Dmitry Osipenko Acked-by: Jon Hunter --- drivers/dma/tegra20-apb-dma.c | 133 ++++++++++++++++++---------------- 1 file changed, 69 insertions(+), 64 deletions(-) diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c index 0ee28d8e3c96..4a371891b7c4 100644 --- a/drivers/dma/tegra20-apb-dma.c +++ b/drivers/dma/tegra20-apb-dma.c @@ -1401,6 +1401,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; @@ -1442,25 +1472,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]; @@ -1558,6 +1576,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; @@ -1577,26 +1597,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); @@ -1606,46 +1606,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 Thu Jan 30 04:38:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11357379 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 5F6AC1398 for ; Thu, 30 Jan 2020 04:41:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3D497206F0 for ; Thu, 30 Jan 2020 04:41:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FsNKPTzO" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727367AbgA3Ela (ORCPT ); Wed, 29 Jan 2020 23:41:30 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:45032 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727354AbgA3Ela (ORCPT ); Wed, 29 Jan 2020 23:41:30 -0500 Received: by mail-wr1-f65.google.com with SMTP id m16so2280083wrx.11; Wed, 29 Jan 2020 20:41:27 -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=gfFOKKBycfoTA+tP8C+2g2g1I1HSJbXw7d1KRYGNlF8=; b=FsNKPTzOSYhTcJdP167/pyLqgktDgRCg/AjEABBjfBXmNTfKrDj0z/0u3yo9AN+Z7s wwyxVsO1nfoQxBdjAkwXhOsaLR0DD4mkLZcaALmYwHwFCulf5Jfx1kWPjXK5YkPfPRMp siWTmO3r/kvWD3NAP0jzONQ946JqA5TCc6gJfO1kHAHIu4B6Ra+VGFhHP3BT1M0JfhQR uSDovfQgYmXPSumhhBnTcdd2kDzNi7bT/4mdTydFQyA6eAlerVwJS2DBu9Pv00lkpglJ 2FvF4tqmJfIBSWOZalg6HcXNqPIg8AjBno6Z4JiC61fxQc7czLDYtgt4HOblukE8eLLC sXNQ== 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=gfFOKKBycfoTA+tP8C+2g2g1I1HSJbXw7d1KRYGNlF8=; b=kc32pgF1SjABjBYTmlC4vdFs/sX5j2aU5/zkYD/qt92f8PTOX6L+vrygP9YtURdSoy i3wh6shxoLI3jZe1j32u+BgGRkbnlwi156BAskz8+iqcwX5LhyaClwdkfqxHh6hEhOwA rawTPuXsq2Hjmz+WEvGYJkmZJkB7a4x+InrKEKz+e55NHOIgx1xQnTeqETQVjCdUFqpU 0XgUv5APLWxo8LaAemdHzBsITdwZ7Wfx6WRInlwKOfN0fIyqgeV6wSMtaqZGJjzvVnn0 w9LtCTGrAwhhfSFidW69/X6JD3QD6FiCLkMSJKc4L9fFjU9bA2hFLgyHqYAce/VqiSr1 kiLw== X-Gm-Message-State: APjAAAXCWZ2ywu8/Z3r2mWNtAVR+izE/U2NfXmyCzBqJM56FD2LUU76d fvIp4RiP4jTOojWZEUlvATE= X-Google-Smtp-Source: APXvYqwUNseDyEBG4iaE2M+lLRu8bHphKJpv9wgXRxA8URzzmpif6FkJ23UjNnqXHjZRWRcjEI1ABw== X-Received: by 2002:a5d:46c7:: with SMTP id g7mr2702825wrs.11.1580359286731; Wed, 29 Jan 2020 20:41:26 -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 g128sm4494672wme.47.2020.01.29.20.41.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jan 2020 20:41:26 -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 v6 13/16] dmaengine: tegra-apb: Add missing of_dma_controller_free Date: Thu, 30 Jan 2020 07:38:01 +0300 Message-Id: <20200130043804.32243-14-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200130043804.32243-1-digetx@gmail.com> References: <20200130043804.32243-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 4a371891b7c4..8f4281ab6296 100644 --- a/drivers/dma/tegra20-apb-dma.c +++ b/drivers/dma/tegra20-apb-dma.c @@ -1587,6 +1587,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 Thu Jan 30 04:38:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11357387 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 EF3C41398 for ; Thu, 30 Jan 2020 04:41:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CDE4822522 for ; Thu, 30 Jan 2020 04:41:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dEujdBvS" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726916AbgA3Elu (ORCPT ); Wed, 29 Jan 2020 23:41:50 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:39278 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727355AbgA3Ela (ORCPT ); Wed, 29 Jan 2020 23:41:30 -0500 Received: by mail-wm1-f67.google.com with SMTP id c84so2568998wme.4; Wed, 29 Jan 2020 20:41:28 -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=dEujdBvSGXigXKTZeieECdLC03pvqTxvVxP5H0d13rtCVuaiaGP8ooRgEI/GrKbzmR DD0eEEjBt99Lbmn9+k/CKJ6L/0wzsn7S2iKh4JKkuc3rGfrCuJnWewsn11FekI9ErhU2 TS4HCpiBrpIuifE4CpKfuflpZ8Z5cRE20yN4AJPj8+6dhTKS3yjgm/MK5du7/MIYY6k/ R0TjBFnpWH06WK5LZM0ZIy2oI/zH5xeyr3WMv+MPvmEfJBYr2Yfg1IULm92xODt8/Mc5 YnG4812KuO5rEUvMWVYKLK4qryg/6n1TNMaxV4Q+f269eK4d/V+mTaK25FEpWRlB0xIV dvGQ== 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=Rf+v0oZ7pFsRYp+0W2oC+lR6via9bMw0lAsvGhpb/zaJ1VKXLCYmk2qsBf/VRgyvuh /xRarxDpLo5kH53tdMSnrw+awEdQsM9bLSve1SR7VAwAW4Mak5FUgo8PuRWuMFLyB200 0ClMliy41MwUpRvgVOxmI4NSmumFH81QlMO9oQmWQVVSuEPUsZA30gdNgDO+E0hh6DMG U8g1dga/VbAOqm3kvr0wQEWX6DuSW+LT2a40ajkz78b094gz305CPSQAIMpm11MEoNOQ lKx/UBCdufBSgDJtkuaztufMikKMNPKVQ2YacAZ0iONvMX6UdYkeuKr5eHF5xEAdP6BZ /s9g== X-Gm-Message-State: APjAAAUvOn705ghjfv0+sYQuQI47Gx4a6X3XCHEG2w4XWZDSm6rozuem Zlmr+7KylK7zNK7dO5D+OFc= X-Google-Smtp-Source: APXvYqxYXf86YcJWpgR48m5wBlMWSjpzOmnpuZw13JR3zMoDmYDHB4Oh7KgmSlXvBGAnlm3mY4exvg== X-Received: by 2002:a1c:4d07:: with SMTP id o7mr2971396wmh.174.1580359287911; Wed, 29 Jan 2020 20:41:27 -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 g128sm4494672wme.47.2020.01.29.20.41.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jan 2020 20:41:27 -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 v6 14/16] dmaengine: tegra-apb: Allow to compile as a loadable kernel module Date: Thu, 30 Jan 2020 07:38:02 +0300 Message-Id: <20200130043804.32243-15-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200130043804.32243-1-digetx@gmail.com> References: <20200130043804.32243-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 Thu Jan 30 04:38:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11357385 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 18D11139A for ; Thu, 30 Jan 2020 04:41:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EAFC82082E for ; Thu, 30 Jan 2020 04:41:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dUULSmds" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727296AbgA3Elc (ORCPT ); Wed, 29 Jan 2020 23:41:32 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:37420 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727363AbgA3Ela (ORCPT ); Wed, 29 Jan 2020 23:41:30 -0500 Received: by mail-wr1-f67.google.com with SMTP id w15so2342951wru.4; Wed, 29 Jan 2020 20:41:29 -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=FNAQ91XilBKtgAieSWbzITQUhnG+T3TSX8YX8IekYAY=; b=dUULSmdsC2EIx3rzK5K1RQQyYSZZOJc5xA/PS1f/t+VytmLHV45MYlGy1PXX98eDQp qze720x0DC3DqRSaiiRGqSrzjv/zO89sgpIDXD1Qk+wVmT87LiU5+Ghwgw/Ri9FTpz09 swl50XutcVJBPbl/fofipSGfXbM7t9L/wKIMt1FH4W79s7eOT+Uy/kdgy/1X66J0ygol BhoWe3GIBRz5FQTayinPV/wjLoLQOBQyFm+feHH714+7H6vsqQV6LKOVPV/+uf24lWW9 ogfE/w4tMT2JhlX287HMd8zX4zsIPnCXf36DsFDOkL3faMMqTMfQ5PpWM9whzSy2Cg1Q v5uQ== 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=FNAQ91XilBKtgAieSWbzITQUhnG+T3TSX8YX8IekYAY=; b=SHfpInUr7Y8RwHuol68Y0GtRIoInax7IIJDUS3sX+X1QDnzxJ705pb341GaQbJGxDo khb4okA19cdUFNVAik1ryC8UI+/sygLChuzFdnbQIT/M3zGHiGxBsPlqddW8Wst0POOu OshUTMrtyc61k49vti/NJGUrUXJdOSpjBtLTA8yngt6e7Sra0iwJLaKkL1eHTo9ZmUWb x9KEYVxcLvCCsyeVJGj/gZrG+vFhy0JPSdfm7KnolVFbsT+84GwUHM3E/UtoHjbxZr0I uFT8pEfzP/Cu225aJjsFlS+3H1Q2tJOyXX3Nw+UnIXosu4I/VhswrWmrQ86W5PD/x5iN 82iw== X-Gm-Message-State: APjAAAUYSyQ59NgDOFt+5Gyv7fePdkXavTaiHmFbx4zbtQzPX+83qceP 4Mc28kZusMa/ACRLpBqNJXw= X-Google-Smtp-Source: APXvYqxJuJrPVi+A6d0bJykaHhgmYett+01HWJrEWYang3scGfcH6Aei+J6a8PBnXu/bEouzyG8gjw== X-Received: by 2002:adf:a41c:: with SMTP id d28mr2917555wra.410.1580359289165; Wed, 29 Jan 2020 20:41:29 -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 g128sm4494672wme.47.2020.01.29.20.41.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jan 2020 20:41:28 -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 v6 15/16] dmaengine: tegra-apb: Remove MODULE_ALIAS Date: Thu, 30 Jan 2020 07:38:03 +0300 Message-Id: <20200130043804.32243-16-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200130043804.32243-1-digetx@gmail.com> References: <20200130043804.32243-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 8f4281ab6296..756a5dbef118 100644 --- a/drivers/dma/tegra20-apb-dma.c +++ b/drivers/dma/tegra20-apb-dma.c @@ -1684,7 +1684,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 Thu Jan 30 04:38:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11357383 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 65C5E139A for ; Thu, 30 Jan 2020 04:41:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 444B1206F0 for ; Thu, 30 Jan 2020 04:41:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="T7t3Sa0+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727394AbgA3Ele (ORCPT ); Wed, 29 Jan 2020 23:41:34 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:52902 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727370AbgA3Eld (ORCPT ); Wed, 29 Jan 2020 23:41:33 -0500 Received: by mail-wm1-f67.google.com with SMTP id p9so2242455wmc.2; Wed, 29 Jan 2020 20:41:31 -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=5EBoa/11BC9T7X5//l8eeEjFWiZ834E6/s6B9Dz4ejw=; b=T7t3Sa0+D/j2xCXwhefagh+pCBoeRqBP6Mallm4E/gnjg7Y5K4iscb1lQyGQYiFeOw RM4ncvQlFbhlZWuRtQs+bZzyapPBNOPEjTQsTWXoLBkFf28BhN/jNsivWXJ6HW0LhPUg fO0oWy9uLHplTLVc6SAU+ZUUSgG7UDcGi2QEYLU/kHnxRBc1k+3mhS9WndOOulqHNCoh CTCxmJRsSxCsku9JXCYDmJhJaB92dkDYlubgCow3l+iNJCVlCr0i4FQFzXY3WXA84s7v ySPjTkJ3Lr/AzyECsrTJ+Z7VbEsNKLEhr1Mh4u+NgIgoy4RiXcu2uZ+1vSOnK2MVc586 tg4g== 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=5EBoa/11BC9T7X5//l8eeEjFWiZ834E6/s6B9Dz4ejw=; b=aRIn1b1E2mtIEgV7dSFlTv+ytKuaGc63hQkMHN20st5p7zWiKWytsQ7N5wWQCN+qud BclPtmQIHAVVUl6RpjepI4HrtBaNsJpT4ICcYV+2DuJK0eiJnF7vP6ALzbjtTdUmtOQR zqbrNhfJUZcsnuZUPU9Kw5Jaol9GsKATSliGDgXiEmYJN0XhCPMRPhdAFnhbkW0KupXe IIB7m2TFOtwJKMvn8e1WqD22CGYuk78cQJz1GcXlI4rh8btGwFgB+a+1Wl1roOrHd6PS hpiFzbvoqpjKp4c+Ss4Zowv8Jx/+h4f+uCC9Lj7hgjWyPfOqGe/gAfXlMteKR23MOJha Dfqg== X-Gm-Message-State: APjAAAXgg8t59uFpCRrLeZGIUh+bRzqw3UYnmhxiPGvnmxTlA394+Mgi o+Q+9dW9gibacgb5d2CgJZc= X-Google-Smtp-Source: APXvYqzWGrOP/XZbWMYROui9UuHCoc7MMRJdWy1NKRHioIGJ/mYfvcIN2TPMSNlIYDk/K2aXfabiPw== X-Received: by 2002:a05:600c:24d2:: with SMTP id 18mr468223wmu.149.1580359290393; Wed, 29 Jan 2020 20:41:30 -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 g128sm4494672wme.47.2020.01.29.20.41.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jan 2020 20:41:30 -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 v6 16/16] dmaengine: tegra-apb: Support COMPILE_TEST Date: Thu, 30 Jan 2020 07:38:04 +0300 Message-Id: <20200130043804.32243-17-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200130043804.32243-1-digetx@gmail.com> References: <20200130043804.32243-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. Signed-off-by: Dmitry Osipenko Acked-by: Jon Hunter --- 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