From patchwork Sun Dec 29 14:55:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11312211 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 3F826930 for ; Sun, 29 Dec 2019 14:56:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1E30A20722 for ; Sun, 29 Dec 2019 14:56:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="W5IgD7Nw" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726189AbfL2O4r (ORCPT ); Sun, 29 Dec 2019 09:56:47 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:44634 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726230AbfL2O4r (ORCPT ); Sun, 29 Dec 2019 09:56:47 -0500 Received: by mail-lj1-f193.google.com with SMTP id u71so31089333lje.11; Sun, 29 Dec 2019 06:56:46 -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=CDAf62ZTY71vcxUcl3aWo7Qq3pJ8TaeUpJZpeGFMx9A=; b=W5IgD7NwYdoKrQneXW/fUNS3XMQyU6MGOhFKevROqWqFcxnlYsbuwfROI80gTHT0yz YOlWkyZXSRh+mf9h8Q+Q8uoB7FJo1xR6NSUwRx1Vt5TG6BdeGbDHbK50/gg5WUhCFGyb JNjThdzqwBiz3mROWZAdWCBoFTb9AKE29rh+8TmCXnAGiCIzPzKEh+wzBAhZlXVbvyHk h/xL2vrc1h9FhpnuBZh0JGUXnrrHKyQ6+2Vyhxgv9RJlBPuVo5c0Mx/7aMWJNLfisQOi EcAN3nnwDj3cZ2rDQryvza0pwzNLqMEDefyiHod+fkpl7N2akNHMKBZx6Vzk39Dkk1tp odiw== 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=CDAf62ZTY71vcxUcl3aWo7Qq3pJ8TaeUpJZpeGFMx9A=; b=P4l26aEgR/Wkl9wSP2wC5gtJ4BNE2YAmdlQ3vjHksZMBXdp55QNH6Gi+pTY2xxLHue r/mcZ0Kd5tbBCW1A6s2es6rFXaa+u8xTrBfsqqOHuSp5ofhZozq4cyeij+4H2SRIC0q1 Z/7asDQbsADdzm4uizSpyNpnbRslZL9E/6sgx0w0TliOfwBgiKFsackmtLS+qNgoIqcL ZC36iBYigZkuaigNpyNlJmXVCQIhXfrx0+dCntqzKVyvOU3h4Siycub+wVn2kW9x9zn6 OxyJ9ItC+l5nSPt8K6JvrE1+MH2JLTjzk1vhs4Ik+oudXVyJ+4E9VKtXU4vQ2cc7bqOj osEA== X-Gm-Message-State: APjAAAW5zUgzLW6AsntpgXM69vyC9JclyTNRSVmjmCd3s607Uk0ZsxG2 epxG0yUknnWTxq5oNcvQg/o= X-Google-Smtp-Source: APXvYqxK+TlO3YHpbABanIx8RnP1mfhM4IbQrEcsqYgGjItTyBjsck4vw/ME3y2oS22IimtkPrCe9A== X-Received: by 2002:a05:651c:1b0:: with SMTP id c16mr33954198ljn.236.1577631405327; Sun, 29 Dec 2019 06:56:45 -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 g15sm11563944ljl.10.2019.12.29.06.56.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Dec 2019 06:56:44 -0800 (PST) From: Dmitry Osipenko To: Laxman Dewangan , Vinod Koul , Dan Williams , Thierry Reding , Jonathan Hunter Cc: dmaengine@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 01/12] dmaengine: tegra-apb: Fix use-after-free Date: Sun, 29 Dec 2019 17:55:14 +0300 Message-Id: <20191229145525.533-2-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191229145525.533-1-digetx@gmail.com> References: <20191229145525.533-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, thus it doesn't stop hardware and 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: Signed-off-by: Dmitry Osipenko --- drivers/dma/tegra20-apb-dma.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c index 3a45079d11ec..319f31d27014 100644 --- a/drivers/dma/tegra20-apb-dma.c +++ b/drivers/dma/tegra20-apb-dma.c @@ -756,10 +756,6 @@ static int tegra_dma_terminate_all(struct dma_chan *dc) bool was_busy; spin_lock_irqsave(&tdc->lock, flags); - if (list_empty(&tdc->pending_sg_req)) { - spin_unlock_irqrestore(&tdc->lock, flags); - return 0; - } if (!tdc->busy) goto skip_dma_stop; From patchwork Sun Dec 29 14:55:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11312233 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 0CEA614E3 for ; Sun, 29 Dec 2019 14:57:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DFDEB207FD for ; Sun, 29 Dec 2019 14:57:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MwKNQosH" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726901AbfL2O5c (ORCPT ); Sun, 29 Dec 2019 09:57:32 -0500 Received: from mail-lf1-f68.google.com ([209.85.167.68]:35406 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726410AbfL2O4t (ORCPT ); Sun, 29 Dec 2019 09:56:49 -0500 Received: by mail-lf1-f68.google.com with SMTP id 15so23756270lfr.2; Sun, 29 Dec 2019 06:56:46 -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=iSzNtTGK3mbZvFsWdibdEoWrg4nzIZ5PMxmWTFl+mGA=; b=MwKNQosH9a8b+Mk8QNMzF8LOvWNFAxJSTi2TjwDnWeUXRQjSYIuEFpt21T2Jl3A8Wo ayjDSJRJHwb45xzBLrk67GQZBMh0dAHmJejTD7q6x3YtUN4z1+qE8VvCpckWW0FnUzLM dWM8FVd0XQ5flXmeJzqU4ZNQqvAV2pYl7mE+lKl+QzHwMSsahC69lt2Y6+RsLp4VT5CG 2bd9jH7iO3lI7CByboWpVdYJlpg6/Gp1wDDW/1Iib+rZ5KUeMvPbWWxyVxxCjNy+JEVV eAzPkw2xRpDxrAn3rBv0dMOdQVledqx+9HLGEs0udGZIhQWVXEvetvu1CWHXet2JUpbN MsGA== 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=iSzNtTGK3mbZvFsWdibdEoWrg4nzIZ5PMxmWTFl+mGA=; b=ogNGhBKWViPf8n16Wsl5k28PU1pqnDNsXN6/cTIVSUPLHNl5IdZX+c/bPBUb5rRoIt Sj8csAA4DfryO7BJtmLRXJ98SwISWVhITFE0pcWfK6sDLTdTmTL9UCHB/8WvBnV+QMS0 /+F6Jy0JCPSHSWaYmUyRRv2FAI2PdsG4qH4aEqGS2NvP2W1joRM1zyCe0bNjnHb9OCfE Au2Q/kGIlbsbOH0cCfW7hjqMzl4ehPhd9ymSM1loLOA7pXLVhkKktCvIgKYTaOA9AQfx 1HQwvHwA7rA2/4X4d46c/r3f2NmWjSbJ57SKJvVWN7yH3Opm1msvECjbXby1u2NLGiSc PNKA== X-Gm-Message-State: APjAAAUp0rk0bM0ji9uITIbqwJnaMLqpApfzCFdsfHtHOc0xK4XP9Xm8 1zIt9t17BUAa2APALB7nE4o= X-Google-Smtp-Source: APXvYqz30BXETtkX0XrGReewQVqwNpDpi1baurkjEb5pjwHevSIKLqRrMEsSyNOnHaqreFESGJGhmw== X-Received: by 2002:a19:3f16:: with SMTP id m22mr33866388lfa.116.1577631406140; Sun, 29 Dec 2019 06:56:46 -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 g15sm11563944ljl.10.2019.12.29.06.56.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Dec 2019 06:56:45 -0800 (PST) From: Dmitry Osipenko To: Laxman Dewangan , Vinod Koul , Dan Williams , Thierry Reding , Jonathan Hunter Cc: dmaengine@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 02/12] dmaengine: tegra-apb: Implement synchronization callback Date: Sun, 29 Dec 2019 17:55:15 +0300 Message-Id: <20191229145525.533-3-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191229145525.533-1-digetx@gmail.com> References: <20191229145525.533-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 callback which blocks until tasklet is finished. 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 319f31d27014..664e9c5df3ba 100644 --- a/drivers/dma/tegra20-apb-dma.c +++ b/drivers/dma/tegra20-apb-dma.c @@ -798,6 +798,13 @@ static int tegra_dma_terminate_all(struct dma_chan *dc) return 0; } +static void tegra_dma_synchronize(struct dma_chan *dc) +{ + struct tegra_dma_channel *tdc = to_tegra_dma_chan(dc); + + tasklet_kill(&tdc->tasklet); +} + static unsigned int tegra_dma_sg_bytes_xferred(struct tegra_dma_channel *tdc, struct tegra_dma_sg_req *sg_req) { @@ -1506,6 +1513,7 @@ static int tegra_dma_probe(struct platform_device *pdev) tdma->dma_dev.residue_granularity = DMA_RESIDUE_GRANULARITY_BURST; tdma->dma_dev.device_config = tegra_dma_slave_config; tdma->dma_dev.device_terminate_all = tegra_dma_terminate_all; + tdma->dma_dev.device_synchronize = tegra_dma_synchronize; tdma->dma_dev.device_tx_status = tegra_dma_tx_status; tdma->dma_dev.device_issue_pending = tegra_dma_issue_pending; From patchwork Sun Dec 29 14:55:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11312231 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 0CF591871 for ; Sun, 29 Dec 2019 14:57:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DF7BA207FD for ; Sun, 29 Dec 2019 14:57:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="N468EFQY" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727005AbfL2O5Y (ORCPT ); Sun, 29 Dec 2019 09:57:24 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:42777 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726667AbfL2O4t (ORCPT ); Sun, 29 Dec 2019 09:56:49 -0500 Received: by mail-lj1-f196.google.com with SMTP id y4so16745956ljj.9; Sun, 29 Dec 2019 06:56:47 -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=fLPm8kYY1aMbkcJ/I/yZlSuw3yqow+z5kIYMGPZJf+g=; b=N468EFQYmzTBqfBQ/MQb5nqJRl41XCor99VIBGQNl/RGUocG1zG9x8SFHqEyQihfBz kgh09LplbUjWoPsq8BOAJIbq3gk1IyE+ckMiyRxgVm+KYy7cwQHWm+2kLbzvq6qFBh49 w3Phlw7QG0BYvZsWrutVH52xq1PEZ0XIkttcbIl4o6a0JiIk53MXMJm6RCgqzVPoUW0r tRbcVSgbJuMR08HzVXWGkROvFhkZhPdNSLokGR00azzYgsP7An1+FTtzaoRY3Osh8RRf BU/R4KSnWl0pFSIiEVCuTpE7mgTjQkhuZvJb62wGBNixh864xVdE/eqoku+QJ32fOxln X/EA== 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=fLPm8kYY1aMbkcJ/I/yZlSuw3yqow+z5kIYMGPZJf+g=; b=HfrDLTeq9xj23cFIWiN6/Pr6ljgDeVUSCLnk67l3mSIRE5KmOZN1xWwCbGczt9Drt8 ppFaltNOv8P70k7FputlsCMnoySgmkJ/7vl4L6guPHaoRwKHHu3gw6bXb+RUp57JvqIm jRRmXSlTa/Z9ImtrOu8YyH7gBHjlYcOD8A1CHBwgC993SsZi9THCchTGTdfkrPscaWf2 YAZr4mmcmN3gwGqVD7NQFDBmk5nCBtsuz/ptRJ235gwOcgfq52Fbmock5Eas20rc9vEJ E43tyZmVePC1oLnmhjaTHWQbNwsgcoP+qTrdi+Goqgns7xIt9FQVKHmEwtjh3pz4CL6b 1zzQ== X-Gm-Message-State: APjAAAWGj2//w0ofey5DYlFR12HL2XWLvYT+KQVro9V8y3fVuZ++/HsH K5glxwm+dDTlXN3bohxiKRo= X-Google-Smtp-Source: APXvYqxk59W/NMB4acxBqQ54lf+yLgcVlD9J+Ly905f8fzEEcpGMYSfrMRaJ8bOM3Mda8nVG24aQYw== X-Received: by 2002:a05:651c:1110:: with SMTP id d16mr35569724ljo.86.1577631407157; Sun, 29 Dec 2019 06:56:47 -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 g15sm11563944ljl.10.2019.12.29.06.56.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Dec 2019 06:56:46 -0800 (PST) From: Dmitry Osipenko To: Laxman Dewangan , Vinod Koul , Dan Williams , Thierry Reding , Jonathan Hunter Cc: dmaengine@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 03/12] dmaengine: tegra-apb: Prevent race conditions on channel's freeing Date: Sun, 29 Dec 2019 17:55:16 +0300 Message-Id: <20191229145525.533-4-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191229145525.533-1-digetx@gmail.com> References: <20191229145525.533-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 unsafe to check the channel's "busy" state without taking a lock, it is also unsafe to assume that tasklet isn't in-fly. Signed-off-by: Dmitry Osipenko --- drivers/dma/tegra20-apb-dma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c index 664e9c5df3ba..28aff0b9763e 100644 --- a/drivers/dma/tegra20-apb-dma.c +++ b/drivers/dma/tegra20-apb-dma.c @@ -1294,8 +1294,8 @@ 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); + tasklet_kill(&tdc->tasklet); spin_lock_irqsave(&tdc->lock, flags); list_splice_init(&tdc->pending_sg_req, &sg_req_list); @@ -1543,7 +1543,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); @@ -1563,7 +1562,6 @@ static int tegra_dma_remove(struct platform_device *pdev) for (i = 0; i < tdma->chip_data->nr_channels; ++i) { tdc = &tdma->channels[i]; free_irq(tdc->irq, tdc); - tasklet_kill(&tdc->tasklet); } pm_runtime_disable(&pdev->dev); From patchwork Sun Dec 29 14:55:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11312229 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 058A81871 for ; Sun, 29 Dec 2019 14:57:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D7C1320722 for ; Sun, 29 Dec 2019 14:57:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jtDU/f23" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727003AbfL2O5Y (ORCPT ); Sun, 29 Dec 2019 09:57:24 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:41025 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726675AbfL2O4u (ORCPT ); Sun, 29 Dec 2019 09:56:50 -0500 Received: by mail-lj1-f193.google.com with SMTP id h23so31093703ljc.8; Sun, 29 Dec 2019 06:56:48 -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=4rypt1/kYJGAf6C/Gog1EznwTiuR8sj2lcgKvtqgbT8=; b=jtDU/f23fjGAkrYDUGfztSbigaefpxmAZE1wgF6mNUXR7ud4IkLl34nOYjjQd4Ufz5 2GJdDFGqwpoDNzvawQdzGMLk39Xq+6ACTYbb+8qPX9gfpC0u+1WzCnrLYG9Vn2nFMJQ5 EDnSJ9M5w/ah8hYslp1kcWZEIZGnOlWAHhowA7s5qPLyWvzV7ziC7eownNVdF7KgB1dD d5vo2A6KPBCx0vW3ncBjGiDia/5kpnJhVaKH9rHjbR7YkOWB7kPN6NNexB2cZ24qK/0g R3GK7Cmko1cA89+4D1EguRytBvocYYBjm40K+Evd9nvuEF7Iqk8CtoJqiqHniv/E9iRy l8UQ== 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=4rypt1/kYJGAf6C/Gog1EznwTiuR8sj2lcgKvtqgbT8=; b=l9B+Yn6GpeJVpFZfO8paBpUVlSTVV/i7wMbKwkP5+qMFZoasXG77xETOb5760KAwTW bbQccw+Ypzd2+8zyFV6mClrB48B5t1nIgv0DaoEr3jquk+uiF+MQSw2RJXRtE2uy02I0 O29qnd0/SaUjq+3D3HRZMVm0ApLyrtTDHPbWt98NTAitnxiEQn3xHJ/e/x2TI1ljPJOT +T7SAT5SpOgIRd2D+avzEmrgT3SYWiDduHQPzFK7B4isje0Rkx1fChmKQx0o0GaWWpu3 22b3buKz5DI3YZszNVycZWcA9800tZbGjQHdKNpKAXvVsUUBO32u0ZQLfuHi+RXHTVDw SGXA== X-Gm-Message-State: APjAAAXdZYO3rpaTUvnUgv4wsfX0Z6+G6CPPVLVcuXgVE4oouBm2AI6Z O5mdUl74ZBfYp1rIlJgYbv8= X-Google-Smtp-Source: APXvYqxrPDaWDjTL2XwKhhtOIHEW3ERFEraLYPk2l+FsJV658+vWGCONjFA/eymMN/UCUeQbO8lbOA== X-Received: by 2002:a2e:8755:: with SMTP id q21mr35122419ljj.156.1577631408038; Sun, 29 Dec 2019 06:56:48 -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 g15sm11563944ljl.10.2019.12.29.06.56.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Dec 2019 06:56:47 -0800 (PST) From: Dmitry Osipenko To: Laxman Dewangan , Vinod Koul , Dan Williams , Thierry Reding , Jonathan Hunter Cc: dmaengine@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 04/12] dmaengine: tegra-apb: Prevent race conditions of tasklet vs free list Date: Sun, 29 Dec 2019 17:55:17 +0300 Message-Id: <20191229145525.533-5-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191229145525.533-1-digetx@gmail.com> References: <20191229145525.533-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. 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 28aff0b9763e..740b0ceec7ec 100644 --- a/drivers/dma/tegra20-apb-dma.c +++ b/drivers/dma/tegra20-apb-dma.c @@ -281,7 +281,7 @@ static struct tegra_dma_desc *tegra_dma_desc_get( /* Do not allocate if desc are waiting for ack */ list_for_each_entry(dma_desc, &tdc->free_dma_desc, node) { - if (async_tx_test_ack(&dma_desc->txd)) { + if (async_tx_test_ack(&dma_desc->txd) && !dma_desc->cb_count) { list_del(&dma_desc->node); spin_unlock_irqrestore(&tdc->lock, flags); dma_desc->txd.flags = 0; From patchwork Sun Dec 29 14:55:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11312213 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 A8D8C930 for ; Sun, 29 Dec 2019 14:56:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8976E22B48 for ; Sun, 29 Dec 2019 14:56:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="V9nzhDUE" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726728AbfL2O4v (ORCPT ); Sun, 29 Dec 2019 09:56:51 -0500 Received: from mail-lf1-f66.google.com ([209.85.167.66]:39210 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726697AbfL2O4v (ORCPT ); Sun, 29 Dec 2019 09:56:51 -0500 Received: by mail-lf1-f66.google.com with SMTP id y1so23724794lfb.6; Sun, 29 Dec 2019 06:56:49 -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=iZ3D39bl0eyByo7/hfV3v45VBZOWa7JfxNIxRNpu/N8=; b=V9nzhDUEHYRzIMZLQpcT/ET/k73thPfjad2SMWF88muli4C4cuLBL3sEcjLslMmqId YWM6FeyNFB14fOGeSD71i+FEO8YFGqQRpyJYdgBDp2x3F6Z7hy9iH/Fs6G7EFKYq6gcV yQYSqdFsBkYMLjMLo4vyfTv2WA88I3eOz9EgsaVe63BBnKL1nRo9fZsfW0yJaftzacjA s9TTfdKzqtnSXbdfbAF6CSlzIKHPuTTq94837kGsx7qlxIMH0S5Lo00K9M6UQxUSaDFp FSV8PM3c2Hun5sp6eyUlehz3MWTIxf1CXvmnEedknU6LF2W2PTy/SERRcD/uqVJnzy8x Oq7Q== 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=iZ3D39bl0eyByo7/hfV3v45VBZOWa7JfxNIxRNpu/N8=; b=VAoTECoqMyG1xu0e+JH/LbnRzY/s6F4baEFECCJAXqMQxEbRzN6YTaLIv5sSj545E/ NKQIBCzupkUl6QNNGiBwph18Q/irunUjZ3zGUz39nceMAGdGftfca5SRE2/vQNlkUJJr LoISkK17Q3OAanH04qm96PStVkq/8uajaQuf2LDpFBmkldOL0brNqOc3Isz1t/cB0j+2 cyyBGgzpcpPGoS1Be6H/8hDMjExCXpCJy3RZLpAqs01EJoyOz6lxBDDGeF3QOI29fKHB S8pT7NU0N0VvCdm0LUmq0uc5gao5aschfDZ2x9fyIWslE0RerNfXqtD1jcLLSdFTZrYF m+UA== X-Gm-Message-State: APjAAAW6WoySlj6bAX5qX96kYEMCmSkkMXwkY5vtTimHs2s6JRnqcrCF uJFTBuTZ1ygdBJhoO2sZqN0= X-Google-Smtp-Source: APXvYqx4G/2EtcPQ7a9zW4nyYeoMXyNyVZmXuXWR1cHoB3TnWtoFqgpg8U56hEycM5nIHhecRE0JHw== X-Received: by 2002:ac2:5c4b:: with SMTP id s11mr34678154lfp.133.1577631408873; Sun, 29 Dec 2019 06:56:48 -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 g15sm11563944ljl.10.2019.12.29.06.56.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Dec 2019 06:56:48 -0800 (PST) From: Dmitry Osipenko To: Laxman Dewangan , Vinod Koul , Dan Williams , Thierry Reding , Jonathan Hunter Cc: dmaengine@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 05/12] dmaengine: tegra-apb: Use devm_platform_ioremap_resource Date: Sun, 29 Dec 2019 17:55:18 +0300 Message-Id: <20191229145525.533-6-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191229145525.533-1-digetx@gmail.com> References: <20191229145525.533-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. 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 740b0ceec7ec..d2353f23b201 100644 --- a/drivers/dma/tegra20-apb-dma.c +++ b/drivers/dma/tegra20-apb-dma.c @@ -1405,8 +1405,7 @@ static int tegra_dma_probe(struct platform_device *pdev) tdma->chip_data = cdata; platform_set_drvdata(pdev, tdma); - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - tdma->base_addr = devm_ioremap_resource(&pdev->dev, res); + tdma->base_addr = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(tdma->base_addr)) return PTR_ERR(tdma->base_addr); From patchwork Sun Dec 29 14:55:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11312225 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 BC6DD14E3 for ; Sun, 29 Dec 2019 14:57:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9B7C620722 for ; Sun, 29 Dec 2019 14:57:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LKurbgT8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726796AbfL2O4y (ORCPT ); Sun, 29 Dec 2019 09:56:54 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:41028 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726709AbfL2O4w (ORCPT ); Sun, 29 Dec 2019 09:56:52 -0500 Received: by mail-lj1-f194.google.com with SMTP id h23so31093756ljc.8; Sun, 29 Dec 2019 06:56:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jIEJVFrrx4gky/ZOSTsCbKeEbeTJKbAx8QcAIMAQtco=; b=LKurbgT8Kf4tjVl7uE5zwgmNgS76qKMevfT+eHtUk/sx0AXmAzmr7UubZslnKDo91h Ld9LjMZL6LupqHeUUQu75OBxWJXf9NFjz0zBTHsaOq9oL0vSKuYLb3o9JoOGYa/7xvEM 5ywzqoD0QX6YvprT5c/rgBLGO53GP95riFFlm6YPKoFnFO/G3Id3czcfHNMdbyFkeyqH arZxBjdP6TADTvkR1ReqRzqtdhjlg20UFGvuIccuDEpbTDHxnWMYXCb22hoJfXLp8LGP 1OAQRXhxnV9YnCnqdbZcBvX4xeciyl1VutLOX5dZlRdII9NuwAaT4Xo2O/CsVZSZ0vKO s2gQ== 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=jIEJVFrrx4gky/ZOSTsCbKeEbeTJKbAx8QcAIMAQtco=; b=YdP5dX9E2OwFY955pliLC/4qIwSmwsQFER4BTpk7uQk1xVcRinbSse/RLIWDa05iHf 3SINmvn7O0hbAoQrZeyqRWiZ/vFGMEykGTz8b0r8ps6OneqcQa894yGdsHAtpl53Fvnu m+yIOtNK4pN8QVrLluk8J9vjE0a3T4nedH2233U/BIs0CNra9RNfQaCJVjeP+3HKo0iU xdTbvrHPVh/HVk9Kcj9LYVxAL82l/R5UwoNc1eLPjyP/82tMWTAmdMaVC4YBXq1IVwbz 0SFBRSjC+RywwHhUBD9STx7IOvrKNZhmoI/+/QQRG+0hhkSjATpe9yPlTMbl5tJfMDGB uepQ== X-Gm-Message-State: APjAAAXSwPYU30uKEPvnzcdanwz5Cikj9MnMEGy5089cIUatKoYChaXE AtmxmvcC9Tp9N83VXbwVo0qvsGcQ X-Google-Smtp-Source: APXvYqzRGam7ZutAdp0X55wXkeZ/u7IEGRDMpq+nzGFdcLsCQcaClOl10Kx6p9mQRymjgRVOJWQa6A== X-Received: by 2002:a2e:b60d:: with SMTP id r13mr34526694ljn.40.1577631409786; Sun, 29 Dec 2019 06:56:49 -0800 (PST) Received: from localhost.localdomain (79-139-233-37.dynamic.spd-mgts.ru. [79.139.233.37]) by smtp.gmail.com with ESMTPSA id g15sm11563944ljl.10.2019.12.29.06.56.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Dec 2019 06:56:49 -0800 (PST) From: Dmitry Osipenko To: Laxman Dewangan , Vinod Koul , Dan Williams , Thierry Reding , Jonathan Hunter Cc: dmaengine@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 06/12] dmaengine: tegra-apb: Use devm_request_irq Date: Sun, 29 Dec 2019 17:55:19 +0300 Message-Id: <20191229145525.533-7-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191229145525.533-1-digetx@gmail.com> References: <20191229145525.533-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. 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 d2353f23b201..194a7faf12ba 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; @@ -1383,7 +1382,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; @@ -1449,25 +1447,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; @@ -1520,7 +1520,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, @@ -1537,13 +1537,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); @@ -1553,16 +1547,9 @@ static int tegra_dma_probe(struct platform_device *pdev) static int tegra_dma_remove(struct platform_device *pdev) { struct tegra_dma *tdma = platform_get_drvdata(pdev); - int i; - struct tegra_dma_channel *tdc; dma_async_device_unregister(&tdma->dma_dev); - for (i = 0; i < tdma->chip_data->nr_channels; ++i) { - tdc = &tdma->channels[i]; - free_irq(tdc->irq, tdc); - } - pm_runtime_disable(&pdev->dev); if (!pm_runtime_status_suspended(&pdev->dev)) tegra_dma_runtime_suspend(&pdev->dev); From patchwork Sun Dec 29 14:55:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11312227 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 B0DBC14E3 for ; Sun, 29 Dec 2019 14:57:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 721B2207FD for ; Sun, 29 Dec 2019 14:57:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ERdHcw11" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726653AbfL2O5T (ORCPT ); Sun, 29 Dec 2019 09:57:19 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:37575 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726230AbfL2O4x (ORCPT ); Sun, 29 Dec 2019 09:56:53 -0500 Received: by mail-lj1-f196.google.com with SMTP id o13so19676104ljg.4; Sun, 29 Dec 2019 06:56:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gbRu0flQ5g7r1JFHx1YwjVyB4aJXo3FFrPWW0JE5Zbc=; b=ERdHcw11wUqyKI1lGejS+mMv/SJ89OTp752+e/v7TDl7YTbWzqheG5wGUcQWjgmiLb z9i7bWHPSyVzlWPvjpyq17lS0j7tUpy/zUo68W0IE/iQWHkmA2nDqz5h68aDQureB3Mv 2/MaHtneEb8TlFiUXKRfRIzWi6FYnE88JE65iNHtcqfzoT4HyiUyfKIr6FXesMJ9DhkI IJ6jWXuVL683puSvUO7WyPN0plaX/cNmk2p2y7Q7rWkcVURS2KyWQMEFVAQu1shRfto6 ZzBwo+q5OE7YBlMsesb9dVcNxU9O7Cn5xSqYX5xwG7ogfFhwHbhmf6Fre3ve5NNv4Hb3 +TjQ== 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=gbRu0flQ5g7r1JFHx1YwjVyB4aJXo3FFrPWW0JE5Zbc=; b=dDuZq2Z5sUqr2wiRXDoHuMwz1MFY0pgMsTqKjNJrJM0FOqwu7Ofzr3hXP26UzovvhZ PWDFGju/Seym0o6ajFZ8EEGIlZnS9+qGk+V1eW73UMl2k3hAV0SPdxfLQ1MTDAn5ZAxd cx1gdVKJz/Q/w7AZtMNdPpuA3693vhP4xGuDCucG6w/clWWp4L6qZvZQh31UekKKm4Va YHRy6g2tbN1P4opNJ9OXQ7NDahGVIcS5NztY/bqIiBJkEiaxQlXBpZXAHrRQIvqxpe2z wKxlb9VO7nQK8guDmJ/tlQRCOYKQr6JlqolVX/o5SFHupRdewDJ9TY9k1Nb3Uw+vVzBI uj7A== X-Gm-Message-State: APjAAAU4tymI6nRVnFJ9/bW0z6lBgDpRSRB1Wh8VrUVRrUc3PkMeRplL DJOzLKX52M1W1IF97QkxShg= X-Google-Smtp-Source: APXvYqxahkJOGWosv2/jiX5KkT4Y/YqOHfb21IyKwqMRDOCyMllkffAezI8319MV7bvElRC7MjL0PQ== X-Received: by 2002:a05:651c:106f:: with SMTP id y15mr8756516ljm.63.1577631410707; Sun, 29 Dec 2019 06:56:50 -0800 (PST) Received: from localhost.localdomain (79-139-233-37.dynamic.spd-mgts.ru. [79.139.233.37]) by smtp.gmail.com with ESMTPSA id g15sm11563944ljl.10.2019.12.29.06.56.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Dec 2019 06:56:50 -0800 (PST) From: Dmitry Osipenko To: Laxman Dewangan , Vinod Koul , Dan Williams , Thierry Reding , Jonathan Hunter Cc: dmaengine@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 07/12] dmaengine: tegra-apb: Fix coding style problems Date: Sun, 29 Dec 2019 17:55:20 +0300 Message-Id: <20191229145525.533-8-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191229145525.533-1-digetx@gmail.com> References: <20191229145525.533-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 --- drivers/dma/tegra20-apb-dma.c | 276 ++++++++++++++++++---------------- 1 file changed, 144 insertions(+), 132 deletions(-) diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c index 194a7faf12ba..48fc48d32064 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; @@ -1269,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) @@ -1306,8 +1320,8 @@ static void tegra_dma_free_chan_resources(struct dma_chan *dc) spin_unlock_irqrestore(&tdc->lock, flags); 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); } @@ -1326,8 +1340,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]); @@ -1382,20 +1396,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; @@ -1427,10 +1437,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); @@ -1473,13 +1481,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); @@ -1531,16 +1539,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 %d 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; } @@ -1560,7 +1571,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++) { @@ -1589,7 +1600,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) { @@ -1617,7 +1629,7 @@ static int tegra_dma_runtime_resume(struct device *dev) tdc_write(tdc, TEGRA_APBDMA_CHAN_AHBSEQ, ch_reg->ahb_seq); tdc_write(tdc, TEGRA_APBDMA_CHAN_AHBPTR, ch_reg->ahb_ptr); tdc_write(tdc, TEGRA_APBDMA_CHAN_CSR, - (ch_reg->csr & ~TEGRA_APBDMA_CSR_ENB)); + ch_reg->csr & ~TEGRA_APBDMA_CSR_ENB); } return 0; From patchwork Sun Dec 29 14:55:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11312223 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 9261F14B7 for ; Sun, 29 Dec 2019 14:57:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 66826222D9 for ; Sun, 29 Dec 2019 14:57:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YCzlAa0j" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726953AbfL2O5O (ORCPT ); Sun, 29 Dec 2019 09:57:14 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:33316 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726748AbfL2O4y (ORCPT ); Sun, 29 Dec 2019 09:56:54 -0500 Received: by mail-lj1-f193.google.com with SMTP id y6so23082734lji.0; Sun, 29 Dec 2019 06:56:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qda0WNYpRV+5EirA6AoP9JWL8S1KmaXxHr54oi+EycE=; b=YCzlAa0juZDUea22GSVQONvEXkJqZcte5A8F6fZdpVFhOVijl5uZU+N0ES/BV5mSw5 BfDwzlitmvZlzKOOJw7JHRmxaS50KkIrZjork8ixBBaJuO/gwGD3P71Mo7nsakwYnTJp NjEBc1ufLjMWITjUnoH0YKUjvCJwEQOaYKNyMEGOFNkLLIZ2CnyRTbdxPj0F6VHA8ToT 5ws/ZO7GbeAgVx8Ig2fW65EQ9av3d3A7e07ZVa7rcd+qw56lVMNnYxLaeHt3Lz4RbwkK mGIXJzzzVcxpjC2mDyLeU17mxa5ZnEz33JcgBJU8x/KUuuBiSVg2fOyfCQn8YyvjnDfA Qzag== 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=qda0WNYpRV+5EirA6AoP9JWL8S1KmaXxHr54oi+EycE=; b=gbiTE1e7H0x176lNSd398mJ1hJqpHd/Jb77JutnjMfD9qvOeRD4MY5r4dDvWna4SJ4 n/QfP78HSwXVVRFES383DqKSVKBtL/Ps5lM/nrOJdmiG0sI01qMmoYoAB4aaj6U4iH3H p2m2FdioJsK+vELVB7Q3VOkc+3SmxqY5YLl6YGr7Y8kEp73eMNVevaNa9O2WzfZyYQoZ Rhqrt4GqWT3UFI35CJdwBj8Nf+LTw7AWIjmecoKxO1xVuDqitfng3ILTo+1pBmZJ6drT 3u9C24rQWfGLX5z2B04zRkEa4CB1mqDrYx+/UXQMasneLqpb2npQ9fSlA51Wtdlctm/h XUGg== X-Gm-Message-State: APjAAAWmPTjJOPTPuJozKtaJEBf/HG/uN3jwtIAGyTRsoNkMS6moMt7x w6Q73Wt1/nTg2O04yx9Y1+o= X-Google-Smtp-Source: APXvYqx9fiVJVx+scfsNqUnzM1dJX/Zx/rnBfiFZOjt38HHAmjiYEMdD2X2W+0uYLNqyLOd+gOSX6w== X-Received: by 2002:a2e:978d:: with SMTP id y13mr35271939lji.103.1577631411621; Sun, 29 Dec 2019 06:56:51 -0800 (PST) Received: from localhost.localdomain (79-139-233-37.dynamic.spd-mgts.ru. [79.139.233.37]) by smtp.gmail.com with ESMTPSA id g15sm11563944ljl.10.2019.12.29.06.56.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Dec 2019 06:56:51 -0800 (PST) From: Dmitry Osipenko To: Laxman Dewangan , Vinod Koul , Dan Williams , Thierry Reding , Jonathan Hunter Cc: dmaengine@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 08/12] dmaengine: tegra-apb: Remove runtime PM usage Date: Sun, 29 Dec 2019 17:55:21 +0300 Message-Id: <20191229145525.533-9-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191229145525.533-1-digetx@gmail.com> References: <20191229145525.533-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 benefit from runtime PM usage for the APB DMA driver because it enables clock at the time of channel's allocation and thus clock stays enabled all the time in practice, secondly there is benefit from manually disabled clock because hardware auto-gates it during idle by itself. Signed-off-by: Dmitry Osipenko --- drivers/dma/tegra20-apb-dma.c | 76 +++++++++++------------------------ 1 file changed, 24 insertions(+), 52 deletions(-) diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c index 48fc48d32064..f52feca05f09 100644 --- a/drivers/dma/tegra20-apb-dma.c +++ b/drivers/dma/tegra20-apb-dma.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include @@ -266,8 +265,6 @@ static inline struct device *tdc2dev(struct tegra_dma_channel *tdc) } static dma_cookie_t tegra_dma_tx_submit(struct dma_async_tx_descriptor *tx); -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) @@ -1280,22 +1277,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; @@ -1331,7 +1321,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; } @@ -1431,27 +1420,6 @@ 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); - - 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]; @@ -1463,9 +1431,8 @@ static int tegra_dma_probe(struct platform_device *pdev) 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_pm_disable; + return irq; } snprintf(tdc->name, sizeof(tdc->name), "apbdma.%d", i); @@ -1475,7 +1442,7 @@ static int tegra_dma_probe(struct platform_device *pdev) dev_err(&pdev->dev, "request_irq failed with err %d channel %d\n", ret, i); - goto err_pm_disable; + return ret; } tdc->dma_chan.device = &tdma->dma_dev; @@ -1496,6 +1463,20 @@ static int tegra_dma_probe(struct platform_device *pdev) INIT_LIST_HEAD(&tdc->cb_desc); } + ret = clk_prepare_enable(tdma->dma_clk); + if (ret < 0) { + dev_err(&pdev->dev, "clk_enable failed: %d\n", ret); + return ret; + } + + /* Reset DMA controller */ + reset_control_reset(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); + dma_cap_set(DMA_SLAVE, tdma->dma_dev.cap_mask); dma_cap_set(DMA_PRIVATE, tdma->dma_dev.cap_mask); dma_cap_set(DMA_CYCLIC, tdma->dma_dev.cap_mask); @@ -1528,7 +1509,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_pm_disable; + goto err_clk_disable; } ret = of_dma_controller_register(pdev->dev.of_node, @@ -1547,10 +1528,8 @@ static int tegra_dma_probe(struct platform_device *pdev) 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); +err_clk_disable: + clk_disable_unprepare(tdma->dma_clk); return ret; } @@ -1560,15 +1539,12 @@ 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); + clk_disable_unprepare(tdma->dma_clk); return 0; } -static int tegra_dma_runtime_suspend(struct device *dev) +static int __maybe_unused tegra_dma_dev_suspend(struct device *dev) { struct tegra_dma *tdma = dev_get_drvdata(dev); unsigned int i; @@ -1597,7 +1573,7 @@ static int tegra_dma_runtime_suspend(struct device *dev) return 0; } -static int tegra_dma_runtime_resume(struct device *dev) +static int __maybe_unused tegra_dma_dev_resume(struct device *dev) { struct tegra_dma *tdma = dev_get_drvdata(dev); unsigned int i; @@ -1635,12 +1611,8 @@ static int tegra_dma_runtime_resume(struct device *dev) return 0; } -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) -}; +static SIMPLE_DEV_PM_OPS(tegra_dma_dev_pm_ops, tegra_dma_dev_suspend, + tegra_dma_dev_resume); static const struct of_device_id tegra_dma_of_match[] = { { From patchwork Sun Dec 29 14:55:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11312219 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 0066714B7 for ; Sun, 29 Dec 2019 14:57:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C7210222C2 for ; Sun, 29 Dec 2019 14:57:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gZ8ytL+m" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726903AbfL2O5G (ORCPT ); Sun, 29 Dec 2019 09:57:06 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:46661 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726761AbfL2O4z (ORCPT ); Sun, 29 Dec 2019 09:56:55 -0500 Received: by mail-lj1-f193.google.com with SMTP id m26so28649474ljc.13; Sun, 29 Dec 2019 06:56:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zJ3tlxXbP7QQrpYAm8owyCW2cUGn+abpGH2dAN9Fzyw=; b=gZ8ytL+mcaooqdmrm1bj3UsjEMUuUVDvQz9DLLpFYZkpL90JfK9uzZ0iEEob3i9mDB ZQcZqAD7tlN308LPeOeu0/ZrowhHasmlyLziSMLVfyiFTteanIuTpjKnxnZ4DadL+Tg5 b0yv53lSJEiOASG86LNCpcB8lTpwMvbCEUkJMMvjQP166ekpfnj4w1ZRdjMBx+8wUjLH 5sSJD+cDm5cfPMhF8bvxHQBirj9M/5AyEqIk/wv6GVqorotsf+/3yjBHr5g0H8oLWgo0 g6ROPpF7KqzgFjXjR2Rull67cMxy7hv7Pt33yY6qrGM0f8tczxZtVEH6lYkuhHTA7di/ Zhow== 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=zJ3tlxXbP7QQrpYAm8owyCW2cUGn+abpGH2dAN9Fzyw=; b=fh5f9bLYBykM6dTArhbqWDQeLVU1v+c9/ib5BaLrwyRquKzGLQ40XRoMNquckmZkSK vJAv6sDv1R0+2Jobb8NFX7Cg8Ot4u0taSjUTK1Iy7b+VLOGJLbBxGyENLjAmp5Svgcy8 k47rmp5bKTu2U9o9UBWXJ5hu7brO1RXo0Xtx30lBfV2vMrANnbKQH7xTDRQhchSzwEah bdc7fvQy+Ts/MSqb1lJEu/SENuOe9T0Yjop8NEtCg+RTTZrjz1tOSRLkogtZ1C0cA1fY jCuoA+6JMHwIMdvy8nRAxiNNyjcBibU9aCTOUk7emCdYKmHibnUd6fOimXNbwTFovwAk a1Mw== X-Gm-Message-State: APjAAAWTKME1wh5XlwLixr5RLV+y83sC5wKO76+SzNLidiNUeoY5wIuq ghNYLarnMmOI+X8Hi8UYCeQ= X-Google-Smtp-Source: APXvYqwJwNjTQqKM+OwLDqUp9P0VvQ6Ys3gDT+6yqZc7Em4DuJDUrrgU0OhhzazYvCCbl/x+e3tFUA== X-Received: by 2002:a2e:9248:: with SMTP id v8mr28855098ljg.189.1577631412560; Sun, 29 Dec 2019 06:56:52 -0800 (PST) Received: from localhost.localdomain (79-139-233-37.dynamic.spd-mgts.ru. [79.139.233.37]) by smtp.gmail.com with ESMTPSA id g15sm11563944ljl.10.2019.12.29.06.56.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Dec 2019 06:56:52 -0800 (PST) From: Dmitry Osipenko To: Laxman Dewangan , Vinod Koul , Dan Williams , Thierry Reding , Jonathan Hunter Cc: dmaengine@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 09/12] dmaengine: tegra-apb: Clean up suspend-resume Date: Sun, 29 Dec 2019 17:55:22 +0300 Message-Id: <20191229145525.533-10-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191229145525.533-1-digetx@gmail.com> References: <20191229145525.533-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 --- drivers/dma/tegra20-apb-dma.c | 122 +++++++++++++++------------------- 1 file changed, 55 insertions(+), 67 deletions(-) diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c index f52feca05f09..ad54a55e2f24 100644 --- a/drivers/dma/tegra20-apb-dma.c +++ b/drivers/dma/tegra20-apb-dma.c @@ -220,9 +220,6 @@ struct tegra_dma { */ u32 global_pause_count; - /* Some register need to be cache before suspend */ - u32 reg_gen; - /* Last member of the structure */ struct tegra_dma_channel channels[0]; }; @@ -1383,6 +1380,40 @@ 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_prepare_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); + + return 0; +} + +static void tegra_dma_deinit_hw(struct tegra_dma *tdma) +{ + reset_control_reset(tdma->rst); + clk_disable_unprepare(tdma->dma_clk); +} + static int tegra_dma_probe(struct platform_device *pdev) { const struct tegra_dma_chip_data *cdata; @@ -1463,19 +1494,9 @@ static int tegra_dma_probe(struct platform_device *pdev) INIT_LIST_HEAD(&tdc->cb_desc); } - ret = clk_prepare_enable(tdma->dma_clk); - if (ret < 0) { - dev_err(&pdev->dev, "clk_enable failed: %d\n", ret); + ret = tegra_dma_init_hw(tdma); + if (ret) return ret; - } - - /* Reset DMA controller */ - reset_control_reset(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); dma_cap_set(DMA_SLAVE, tdma->dma_dev.cap_mask); dma_cap_set(DMA_PRIVATE, tdma->dma_dev.cap_mask); @@ -1509,7 +1530,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_clk_disable; + goto err_deinit_hw; } ret = of_dma_controller_register(pdev->dev.of_node, @@ -1528,8 +1549,8 @@ static int tegra_dma_probe(struct platform_device *pdev) err_unregister_dma_dev: dma_async_device_unregister(&tdma->dma_dev); -err_clk_disable: - clk_disable_unprepare(tdma->dma_clk); +err_deinit_hw: + tegra_dma_deinit_hw(tdma); return ret; } @@ -1539,7 +1560,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); - clk_disable_unprepare(tdma->dma_clk); + tegra_dma_deinit_hw(tdma); return 0; } @@ -1547,28 +1568,26 @@ static int tegra_dma_remove(struct platform_device *pdev) 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; - 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); + + 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; + } + + tasklet_kill(&tdc->tasklet); } - clk_disable_unprepare(tdma->dma_clk); + tegra_dma_deinit_hw(tdma); return 0; } @@ -1576,39 +1595,8 @@ static int __maybe_unused tegra_dma_dev_suspend(struct device *dev) static int __maybe_unused tegra_dma_dev_resume(struct device *dev) { struct tegra_dma *tdma = dev_get_drvdata(dev); - unsigned int i; - int ret; - ret = clk_prepare_enable(tdma->dma_clk); - if (ret < 0) { - dev_err(dev, "clk_enable failed: %d\n", ret); - return ret; - } - - 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); - - 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); - } - - return 0; + return tegra_dma_init_hw(tdma); } static SIMPLE_DEV_PM_OPS(tegra_dma_dev_pm_ops, tegra_dma_dev_suspend, From patchwork Sun Dec 29 14:55:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11312217 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 C35131871 for ; Sun, 29 Dec 2019 14:57:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A2259222C4 for ; Sun, 29 Dec 2019 14:57:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KPSZblQ4" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726853AbfL2O45 (ORCPT ); Sun, 29 Dec 2019 09:56:57 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:45088 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726810AbfL2O4z (ORCPT ); Sun, 29 Dec 2019 09:56:55 -0500 Received: by mail-lj1-f195.google.com with SMTP id j26so31074315ljc.12; Sun, 29 Dec 2019 06:56:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1J1J5BlDcbKt3phhdzz1XyASZlV2076cdy7BI1+jtrk=; b=KPSZblQ42+QWm0d0aYXkE8Tgtl+9RH5F4q3rFGkx/65UzwXT8IDPpVr9/xTZMdozRr AD9Ww59AJclaQplycQPoDEtK8/Oamcifgb6MnJCrMPMInnU0y+d7UyUhuJheJr20+hSs 6+QFAtwg9tViNullL4Sl3yDZUtXdlPpjSlPk1/IKE24nrfkd6ma1WyNt+1OPH94HEftL CiF8+iCWwYIlS0QZ03FiXXbUgz0TEFnR4bUOD4gaWcbuazl8gAT6cBvuRQodee4i9C8Q 43M43W86ADWeboyyZo4qFtPw+TKZlmMSvelP6o4gNwmV5dFpWrrA11qKGkHmNQPN6Ru4 Z6aQ== 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=1J1J5BlDcbKt3phhdzz1XyASZlV2076cdy7BI1+jtrk=; b=mSy3I0aatS+/1L/OUE4NK24KmVEiXV2Ejg7e4HR5cBvURSog/3eJjSXc3/AG5CFObA ihPo6dH5NpkuiZc8Y00UwhvQOUqj+RioJzfeGswduh8VGME+6aTcaGBpNLYdizRR43MX B2Ufx0He250NyFg8sqr5/UIiG/vVUxKNtibEAYVS4/38w+CS+upI22ygBPkGhK8jtNHm 3Lh4tR3vOSFNQPqRPEypc4NDRGjGzUjO9Gb7+zyI7/H0Om8U25jSUV4v66rCxvuRggu8 YSU4hzrfAgkkLuteh77ittoMtiTHDR/FMgSOgoEKk/n92cZ5DJOE2wTZU3RKojQF7vwe tttQ== X-Gm-Message-State: APjAAAUn4uAz+pCiLJH9IvQxXUYA2AXgJL77iqHIv42Y7NBn4puOeCX6 QESYdMuHeoRZIe8/44KKY3rYhC8K X-Google-Smtp-Source: APXvYqzVuZfFQq5oKKos6aCevZ4Oufp5wWuyW2XPB/bhYT1oU7fZuHEyR6qSbC0SJMqzyCZdLTvJRw== X-Received: by 2002:a2e:810d:: with SMTP id d13mr35134869ljg.113.1577631413448; Sun, 29 Dec 2019 06:56:53 -0800 (PST) Received: from localhost.localdomain (79-139-233-37.dynamic.spd-mgts.ru. [79.139.233.37]) by smtp.gmail.com with ESMTPSA id g15sm11563944ljl.10.2019.12.29.06.56.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Dec 2019 06:56:53 -0800 (PST) From: Dmitry Osipenko To: Laxman Dewangan , Vinod Koul , Dan Williams , Thierry Reding , Jonathan Hunter Cc: dmaengine@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 10/12] dmaengine: tegra-apb: Add missing of_dma_controller_free Date: Sun, 29 Dec 2019 17:55:23 +0300 Message-Id: <20191229145525.533-11-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191229145525.533-1-digetx@gmail.com> References: <20191229145525.533-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. 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 ad54a55e2f24..d96de35c8253 100644 --- a/drivers/dma/tegra20-apb-dma.c +++ b/drivers/dma/tegra20-apb-dma.c @@ -1559,6 +1559,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); tegra_dma_deinit_hw(tdma); From patchwork Sun Dec 29 14:55:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11312221 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 7DC3214B7 for ; Sun, 29 Dec 2019 14:57:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5BCA0222C2 for ; Sun, 29 Dec 2019 14:57:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Eh1dRrvx" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726898AbfL2O5F (ORCPT ); Sun, 29 Dec 2019 09:57:05 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:46664 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726831AbfL2O44 (ORCPT ); Sun, 29 Dec 2019 09:56:56 -0500 Received: by mail-lj1-f193.google.com with SMTP id m26so28649533ljc.13; Sun, 29 Dec 2019 06:56:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0hLaeTkiGQpndBzsnntj+Kt92MOlWlIIs3RhP31I+1g=; b=Eh1dRrvxz8kK/TglzuPUhe0Y74P+h1G/MBTgM4Y9ELYCdHjeP9o9M52N07MeZhT3ed LxwVthtF+jFIBKReehE1dwYVvei3L7oZWr9nVgdkVWvh/w6jExokYiYBqycnTMOeI14b VA1QMnzHGON895VsOakCjJZUsbAS3URbnUFzimVBlQrewCaYD9fAm1lOwV4LzSwdqymm 0tyth4+0SpOYah3G29IH8vqH2xi2w5MV1yIjn+TTKI6mYkFMe3iShnYg6YgBjFZeyYuK E7sRPc5bAyUbIRGnBjfZ9bCi1EjZIBO7b/6Kgc6nVR4cYAy9h/MidW5CLFzde01xKINY 9cfQ== 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=0hLaeTkiGQpndBzsnntj+Kt92MOlWlIIs3RhP31I+1g=; b=Fs2Q7Mb7EDoN9LJdjsdQBVRvd6wgzRPBkd/MUyWj6h/psi7ETiiHSOsSFhy4exEcyY yDLcWqs+ZqGv6Xdy2jZmOOInxjg5ZJto+qaaNH5bb9ZeyoB8aof+xoz5w5juFy6sPe0X nuU9kZugHBT22Jwi5y6K3ex7w1OLl7doZ6fcJ/xIKzt/HIJ7VZi1uA9Ve3Eu/4T3lph+ UqpkkpafbCyJBzjvHYPD/Ex3nVN/WZ58cH2XK/1V58HIXquLUrTz6tZ8RNVYaR5YMiXk qkJA/aYc+FNVfxfHshqaBuubm8kU6lxs9dNV/uBVR1N4N14aVn3hPVST54p/8rA/woii kuSA== X-Gm-Message-State: APjAAAWzP2Q5u6PpCrjZACxLtQmqjadI1cuBmkvGWB+oft5DepThSdiQ KCDxBeKwDbajbCS14TRncoY= X-Google-Smtp-Source: APXvYqwV1kO6kX2KfXMDwGhOFM0j75VPLE/+4fgGg4Xx/thE3781NtkX836LcPQrpXEj6CQH9lzGXQ== X-Received: by 2002:a2e:7005:: with SMTP id l5mr35617973ljc.230.1577631414283; Sun, 29 Dec 2019 06:56:54 -0800 (PST) Received: from localhost.localdomain (79-139-233-37.dynamic.spd-mgts.ru. [79.139.233.37]) by smtp.gmail.com with ESMTPSA id g15sm11563944ljl.10.2019.12.29.06.56.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Dec 2019 06:56:53 -0800 (PST) From: Dmitry Osipenko To: Laxman Dewangan , Vinod Koul , Dan Williams , Thierry Reding , Jonathan Hunter Cc: dmaengine@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 11/12] dmaengine: tegra-apb: Allow to compile as a loadable kernel module Date: Sun, 29 Dec 2019 17:55:24 +0300 Message-Id: <20191229145525.533-12-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191229145525.533-1-digetx@gmail.com> References: <20191229145525.533-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. 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 6fa1eba9d477..9f43e2cae8b4 100644 --- a/drivers/dma/Kconfig +++ b/drivers/dma/Kconfig @@ -586,7 +586,7 @@ config TXX9_DMAC integrated in chips such as the Toshiba TX4927/38/39. config TEGRA20_APB_DMA - bool "NVIDIA Tegra20 APB DMA support" + tristate "NVIDIA Tegra20 APB DMA support" depends on ARCH_TEGRA select DMA_ENGINE help From patchwork Sun Dec 29 14:55:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11312215 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 98E0314E3 for ; Sun, 29 Dec 2019 14:57:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 77540222C4 for ; Sun, 29 Dec 2019 14:57:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="etWVTJZa" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726810AbfL2O5A (ORCPT ); Sun, 29 Dec 2019 09:57:00 -0500 Received: from mail-lf1-f68.google.com ([209.85.167.68]:44976 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726845AbfL2O45 (ORCPT ); Sun, 29 Dec 2019 09:56:57 -0500 Received: by mail-lf1-f68.google.com with SMTP id v201so23708258lfa.11; Sun, 29 Dec 2019 06:56:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=d61xLjjxWbxI5eV1Fujn9jWtoC4pEzqs0yuJAlEPGQA=; b=etWVTJZaT3p8VPlVN8QeSiQ46gN7rtZ/ANKmqtVpbKPlKyXl/+ZAvJm2HSxQMBs2zu 3Ufe5/SgD0LCr2UrtEmHCJmngmiNwek2rJtOXOB2WQzzllZ/9kMkbMB5SQ/R9ea6xqOX OV3pHGxrAuRDPsF/zfTJVMWi4rEOhOIuYhVIqcgI/s3LuZMO3F61IID8O935GxBK3ex1 xVESRfgJNtuoVNyVzLqJxxRgSqD8kSQy9a9BWxOB+hNiyzVL5fi7yPSTtgez1p/2KnzE lTgTsmJOsceoub4xCrlD5/tvCaeRhr7b138p/IUYrUx1P2UyVLccGmy/ZlbU10TttJQ7 ljMA== 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=d61xLjjxWbxI5eV1Fujn9jWtoC4pEzqs0yuJAlEPGQA=; b=Wt1jgXbRDv74hioZyoX2MK64mxdzSzSIfrKiNvX6BJGU5DN/j9Cl1KRlakLXMD3WWm A1kOs27WjFt8eV8g1mY3u037jhcreR19iXfBRHYqgJzbwGui5L8Pha7sBsYto3PuVsJu bSpTm0OuOKOUu/bFKJotlvcwcny0dMFir2eRJALeckryA5bBcfE//i4DlmPoryBdmPmt N1xPy0yIj8N7mRpngKbaKRaE+Efe8bd+vr6RqNNAC75E1uEfnJPePhjwhFU/bYtLsXIF lEFbeE3MbAUHhk84UxmgULOoj1ORH0RLIt7Y2aDYttyiJEHkpG+gS71xwFJt4cpUiZ2e 0Pcw== X-Gm-Message-State: APjAAAW/WNp9FRnXgVU1Drvm5aOi5Or9NtXcppORTRmdAWouzZZhheiO g2S2XlBa/k3ZJtPoDblQZb8= X-Google-Smtp-Source: APXvYqz6IXklzOjO/CUbhhhRC452FVyyPClstVpWvjv0naGRCdnjLM2OpgK3B6pFVOGuCBbvWCBoLA== X-Received: by 2002:ac2:4add:: with SMTP id m29mr34356272lfp.190.1577631415131; Sun, 29 Dec 2019 06:56:55 -0800 (PST) Received: from localhost.localdomain (79-139-233-37.dynamic.spd-mgts.ru. [79.139.233.37]) by smtp.gmail.com with ESMTPSA id g15sm11563944ljl.10.2019.12.29.06.56.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Dec 2019 06:56:54 -0800 (PST) From: Dmitry Osipenko To: Laxman Dewangan , Vinod Koul , Dan Williams , Thierry Reding , Jonathan Hunter Cc: dmaengine@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 12/12] dmaengine: tegra-apb: Remove MODULE_ALIAS Date: Sun, 29 Dec 2019 17:55:25 +0300 Message-Id: <20191229145525.533-13-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191229145525.533-1-digetx@gmail.com> References: <20191229145525.533-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 and thus it uses OF alias naming scheme which overrides MODULE_ALIAS, meaning that MODULE_ALIAS does nothing and could be removed safely. 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 d96de35c8253..2eae3b3cdc58 100644 --- a/drivers/dma/tegra20-apb-dma.c +++ b/drivers/dma/tegra20-apb-dma.c @@ -1633,7 +1633,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");