From patchwork Fri May 31 21:01:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13682171 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2073.outbound.protection.outlook.com [40.107.21.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6CA54187567 for ; Fri, 31 May 2024 21:02:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.73 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717189338; cv=fail; b=llUSl0VWBInX+2YVwsdAF7L85LlpkGgpUBSV92EC0DMJrN1Oiay5KTPOv3+5+OMJUvniTma9mfltRGX0P/C0D7c+GKDU0Fdth1EQKUrjob6AE9ZASPMO6sl7uPNykl7NsVKwndBBv68oWS8Vu4To+dL6wg5dC/Ac1S30u8d9xyE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717189338; c=relaxed/simple; bh=SVplU8gdU6eS+b/C5V78rxQvF/x/SB4HVxXB/vkoFDM=; h=From:To:Subject:Date:Message-Id:Content-Type:MIME-Version; b=gOfqoUe8UNtCQYh/Lj1LrmPngCkcD1h59CzlEp+mfgiTcj314BuIHLuR8cS3O2ViYOO7LitHb/PlnXk5PD+dnSabLfbJOlNd0Txsfo5pQOPG9dsfXFNr96jBSWOrHq15N/ITULAmVkWYha8kDe780SpzHkyU47OJ7j9iFPKZ60A= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=Ge271NDJ; arc=fail smtp.client-ip=40.107.21.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="Ge271NDJ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KHTPK6nuj5iQPvQDLd+kl4fqtR7UGVov29c6K4vndwgUh1Kz12Gb4p9jSqUBTg28N+2Cw0WZ/q44r7s92tB1CMAJC5kq4AjT+Kmw56nOJZ3Fw7858EKweQKkFgqFIE8gzSSRUa5WFfjs4To4Z7xJ6kycbWcrxtYVCR4nZ4FNhwTsolrA1gACvOgEB7G1I2knkoJbXelBw07vMj0MYK6YRIJXHO62I1Wtug34wbQVumd8ShV4TnmlTLoFwC8rm86gogwsTmsYW/M1mNTUAwdJBhNOYisA5qadihc5vsTKz/Mt8ClyAZ+UfUCVtZ9WCYbsew6PpCE25XQGT2un1s95WQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Wj5WjfKcEutVFKF9pzkKr3uydJYHPwp9zlz+NiNIUe4=; b=ZFcU7Gi53tfnxIp1SSxCVDYa8sz47T4Lfkxi1q37W0vkRIRsKgykAwOU4AgDe5GdLzA7A77ckTzj2skt+nOGrhhFLiGviJyy1GoY84lIO7szcr9jE/o+hZ8S5A9oKmWVBRoN1KZIRChV4X+zutPb9vrvG5dxa6HZHfjeRHn3LspUEe0aNhy7FTKWrYoMuKRZX7EegeC+7nAwkeNfClb8TAv5ZN5firAva4sFiJYIAnSXMhQGvCZrrlMJLhtWEolOznVHHzSa2Lj41JLtFXhS/2FR+XW2XQcuaHUNo9848uvUNOGn7mgBnOdg22klsPBPfwVwU/saGYfP8wuhjojbqg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Wj5WjfKcEutVFKF9pzkKr3uydJYHPwp9zlz+NiNIUe4=; b=Ge271NDJ53brhIcyOSKWSxbtG0p6ADEJjOeoMSfnLtNHD/RMGAqzJM4oOn6PL4kFNFTLAo+7mMPqgyu5MegDL7yq/mUeKOCM201QZuc/PdY7fiE8pkgQIQar05KMtNPCmdfOEPgwj6b6V9zPHSVyaD3LXPsBs8y9U5wi0TgNvH4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by PAXPR04MB9232.eurprd04.prod.outlook.com (2603:10a6:102:2ba::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.23; Fri, 31 May 2024 21:02:12 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%2]) with mapi id 15.20.7633.018; Fri, 31 May 2024 21:02:12 +0000 From: Frank Li To: Vinod Koul , imx@lists.linux.dev (open list:FREESCALE eDMA DRIVER), dmaengine@vger.kernel.org (open list:FREESCALE eDMA DRIVER), linux-kernel@vger.kernel.org (open list) Subject: [PATCH 1/2] dmaengine: fsl-edma: request per-channel IRQ only when channel is allocated Date: Fri, 31 May 2024 17:01:51 -0400 Message-Id: <20240531210152.1878443-1-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SJ0PR13CA0215.namprd13.prod.outlook.com (2603:10b6:a03:2c1::10) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|PAXPR04MB9232:EE_ X-MS-Office365-Filtering-Correlation-Id: 06a78650-0b14-4fa8-e067-08dc81b4f151 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|366007|1800799015|52116005|376005|38350700005; X-Microsoft-Antispam-Message-Info: Jy/N33CG6BJMXq5LkUYWyYpW5b7jq+OxSnClF/NsitGzeXZ6NtRCa4xAy7aLQH6TBNn/Wfv2pS3Q0T7C5Db6YAQjMUV+BPxep1qIgCdqg5U3gYjcYKozam6NevjXlz1nR5cYu5QJU2ge8M/gPMvGRg4PVIt7QtME97nNBxJZN6QqwdROTgGMXM4qaVirzoGAz/JCqUhI8nlYnJJPKplIEulpFh4zX9PgBjT3B3NMBmpHFGhKOuUh1f9AwTqoWzns+KYCbukH85gsM8tomxQJA2bzlsTcdnOpwoIfGIPdZIMlVLFYNhQaDPpx+twx7f0emYdTfcBc2Ue51G2m/lF0pWOYlj5faqVSNIgBVW5eJdeOJKM5Kie/crSQyeZMmGrq5UUrTtRUNMHIH3a2NwqkC10VNxtmX7HLBVo6CK6pzV94Amd1EQ1aYsaifzKeSDsvTGa5GMTPd2gtr/axGqN3SfsMEavakTCaItOx+LkyWXgSwqesE/PKEG0S+YKeb2LVxY02S0iwMINkuEj2BM5lZTg21Ky3oRP3yhiE3+pW1sDHWAp18UDFy+LkKL89CPUa2gp4cOs8JPlVJdVMRrc9+QJiS6adWHl2NKVG72YV14Fu9UNYoF+x4utNasPnIuNtv0GEfLMDkOyr7rUDPVPmHLfO3fljUMqJELRnrAWlKvZ6AD7pIGUjCR8HDMgdFM5y3+62ZbbwWNYAz+AR0maC+3OpAajK86IymbtHBheW56hPGAg6d4g6nA3L/IC0XwYIiPVvMOdYGer54FAXkZ1VptqVgKcCO292PdH0FYyosoO8v3Zu9bC+ARjgyvw43zLoEc1c32SvGFXEhB4glgmwwmu7/XADtPWBEr/djN18HxxEX5ThySRiouVB9i4PXKIqJSSYg3MN8bp4Y+sVRWpSGQtBTYQJko13dmYc2Jmw9A8ylrpZvTv/96X5X4/Po/9Kln5e6imYLk79n2cFZ/DiJSExzXy3jMgX2gbuTNirA8cNCtIQRD1MyHYtnt3k/E16a9zzjrixh3k371rQCjZlEgufSTLd/yxmC8DivjJwOixmVQlF96BltwxYQ787qs8sNgcuCJEbLtISQ5l9GN2wUSe8UOingAjx1aFOn67i/Vsa0dnM0lvDWYSHHyTwkI0BY9r24V1JoM+bm3MuI3PW9TfEONcSnr3xxgbZPr4DuZW0+F595jx8XVQIluz13FENgPskBfCBxlmknQ2eUN7li1tX7wZdo1Crl3an35JqzP4rRKXGpQ/VIM00gqhw5yMf7hfW1caamYV28OBszNL/272Pc0TmJ9lMhYcjjKpN9MG8jtqUs8xKyLVpnAasSRcc/Pb1QESf+N2jHgh3g/fLKg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366007)(1800799015)(52116005)(376005)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MgMIVQW9YVqGTKV/pgovk5GLO4qM6O6Xk17oGsGyaMiVV3Ga+q+qNikFsahQ4BDIHyA7+DUEidTNAEV9LUDpIBNl0EnahhqqM2jCZbsHak3RPIuU7egyapTwVLcrdWtXFkXOvpV/+wj5v+YeHkqfdSAicSXgFwHqGsuPsEFgOoZPo1dNWUxaR4M+dn328HqOLmSDfYGMgcN4YvI+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bLDdKwBhHXecVyz2VTs7uDEe32wzZP0GZEj64+xOWY0kScx8qGblM9eCh4LOxd5N8CpQ3oZia34fQQTuG1vYi0ejZJ0jwmCgAI4aIQWhiHQ57cqUvHjjfRcp8+boxBUWm86AvYhvY/hyWdtsTcTg8O/2o+/Roi50bn5xQMx7sQzA4nLey8Lp4n9fjmxEKY+E5rc7ozG7rtLdolf0YQTIaJynm75um8tw9QWHshphFZHjkw1mnVBXXM64gDdK4UOG0k4jALl/5n09AzvaMjZvcBHk= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 06a78650-0b14-4fa8-e067-08dc81b4f151 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 May 2024 21:02:12.4323 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: FpMIAzl6f2VJYkOJNcCXtClT7qq9EZonY0MToTXIWLjf6lx348x7Sxi0Ibq7v70oKPh84hz6eSCh8wFuRDz0Jg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB9232 The edma feature individual IRQs for each DMA channel at some devices. Given the presence of numerous eDMA instances, each with multiple channels, IRQ request during probe results in an extensive list at /proc/interrupts. However, a significant portion of these channels remains unused by the system. Request irq only when a DMA client driver requests a DMA channel. Signed-off-by: Frank Li --- drivers/dma/fsl-edma-common.c | 15 +++++++++++++++ drivers/dma/fsl-edma-common.h | 1 + drivers/dma/fsl-edma-main.c | 29 +++++++++++++++-------------- 3 files changed, 31 insertions(+), 14 deletions(-) diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c index ac04a2ce4fa1f..91a4c11b7cbfd 100644 --- a/drivers/dma/fsl-edma-common.c +++ b/drivers/dma/fsl-edma-common.c @@ -805,6 +805,7 @@ void fsl_edma_issue_pending(struct dma_chan *chan) int fsl_edma_alloc_chan_resources(struct dma_chan *chan) { struct fsl_edma_chan *fsl_chan = to_fsl_edma_chan(chan); + int ret; if (fsl_edma_drvflags(fsl_chan) & FSL_EDMA_DRV_HAS_CHCLK) clk_prepare_enable(fsl_chan->clk); @@ -813,6 +814,17 @@ int fsl_edma_alloc_chan_resources(struct dma_chan *chan) fsl_edma_drvflags(fsl_chan) & FSL_EDMA_DRV_TCD64 ? sizeof(struct fsl_edma_hw_tcd64) : sizeof(struct fsl_edma_hw_tcd), 32, 0); + + if (fsl_chan->txirq) { + ret = request_irq(fsl_chan->txirq, fsl_chan->irq_handler, IRQF_SHARED, + fsl_chan->chan_name, fsl_chan); + + if (ret) { + dma_pool_destroy(fsl_chan->tcd_pool); + return ret; + } + } + return 0; } @@ -832,6 +844,9 @@ void fsl_edma_free_chan_resources(struct dma_chan *chan) fsl_edma_unprep_slave_dma(fsl_chan); spin_unlock_irqrestore(&fsl_chan->vchan.lock, flags); + if (fsl_chan->txirq) + free_irq(fsl_chan->txirq, fsl_chan); + vchan_dma_desc_free_list(&fsl_chan->vchan, &head); dma_pool_destroy(fsl_chan->tcd_pool); fsl_chan->tcd_pool = NULL; diff --git a/drivers/dma/fsl-edma-common.h b/drivers/dma/fsl-edma-common.h index dfbdcc922ceea..c5a766da02b88 100644 --- a/drivers/dma/fsl-edma-common.h +++ b/drivers/dma/fsl-edma-common.h @@ -172,6 +172,7 @@ struct fsl_edma_chan { int priority; int hw_chanid; int txirq; + irqreturn_t (*irq_handler)(int irq, void *dev_id); bool is_rxchan; bool is_remote; bool is_multi_fifo; diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c index a1c3c4ed869c5..82ac56be2d832 100644 --- a/drivers/dma/fsl-edma-main.c +++ b/drivers/dma/fsl-edma-main.c @@ -65,6 +65,13 @@ static irqreturn_t fsl_edma3_tx_handler(int irq, void *dev_id) return IRQ_HANDLED; } +static irqreturn_t fsl_edma2_tx_handler(int irq, void *devi_id) +{ + struct fsl_edma_chan *fsl_chan = devi_id; + + return fsl_edma_tx_handler(irq, fsl_chan->edma); +} + static irqreturn_t fsl_edma_err_handler(int irq, void *dev_id) { struct fsl_edma_engine *fsl_edma = dev_id; @@ -228,7 +235,6 @@ fsl_edma_irq_init(struct platform_device *pdev, struct fsl_edma_engine *fsl_edma static int fsl_edma3_irq_init(struct platform_device *pdev, struct fsl_edma_engine *fsl_edma) { - int ret; int i; for (i = 0; i < fsl_edma->n_chans; i++) { @@ -243,13 +249,7 @@ static int fsl_edma3_irq_init(struct platform_device *pdev, struct fsl_edma_engi if (fsl_chan->txirq < 0) return -EINVAL; - ret = devm_request_irq(&pdev->dev, fsl_chan->txirq, - fsl_edma3_tx_handler, IRQF_SHARED, - fsl_chan->chan_name, fsl_chan); - if (ret) { - dev_err(&pdev->dev, "Can't register chan%d's IRQ.\n", i); - return -EINVAL; - } + fsl_chan->irq_handler = fsl_edma3_tx_handler; } return 0; @@ -278,19 +278,20 @@ fsl_edma2_irq_init(struct platform_device *pdev, */ for (i = 0; i < count; i++) { irq = platform_get_irq(pdev, i); + ret = 0; if (irq < 0) return -ENXIO; /* The last IRQ is for eDMA err */ - if (i == count - 1) + if (i == count - 1) { ret = devm_request_irq(&pdev->dev, irq, fsl_edma_err_handler, 0, "eDMA2-ERR", fsl_edma); - else - ret = devm_request_irq(&pdev->dev, irq, - fsl_edma_tx_handler, 0, - fsl_edma->chans[i].chan_name, - fsl_edma); + } else { + fsl_edma->chans[i].txirq = irq; + fsl_edma->chans[i].irq_handler = fsl_edma2_tx_handler; + } + if (ret) return ret; } From patchwork Fri May 31 21:01:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13682172 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2073.outbound.protection.outlook.com [40.107.21.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E65A8187567 for ; Fri, 31 May 2024 21:02:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.73 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717189340; cv=fail; b=LydoQdQkiUdL/MJtFjsBJ7PAtUHi1OypgcGpvQXqS+YIr5183nWQULzLnSwaD5vCkK2Q8und9JLe6FJzEl8jHAhTafOpS62cBrSIedUnmuCFxNbPuJtZVr+H2nk6/Iaxx39YiAySA25RLZ8mbi5FqUsVymbLgEZle061kXPR4ag= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717189340; c=relaxed/simple; bh=B9usMufM/cKSi2dR2e9N7oRRS95a2+JAS73/tt6r+YE=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=HSG9BVGLr3n5BhJVKgU751gnydXqPnWgS2BRzsPNBMvXvj23Zvo+jG2G6N37GY3wvFc8G7x+C4VtG6yAAYqYyNfEgCwR1hRCdSEvtDhmhkNE/ZhRdA7H0DJ0iq/5LgaowB8MtsYgtuF04m37FegHcb0pIujngmK5RlUeuXqzX/s= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=EiMiGml5; arc=fail smtp.client-ip=40.107.21.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="EiMiGml5" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cjQI3cJRLJvNbbC1CxkZEWZ83J+/dEB/8wt5Suq85R2zjb4dABEnL6Xma/pbw4iK8eQ9S+yc2nUZ3ExjmttFbj0hG985m/UgfCSQbIBMfKGCa7L3n57RlhPyW46wiaqCq7iHLHViw6YBVAyMVA17S5ISxH+GHUywrkethF+9yah6K7o3SjNRnc38XOTv3ZiuyUNhHn+gSXmD2Newcsbj98P9E2ysZbUQ70ZdhI2LSdqXOWUuqxuFLzxFeWC8gD7ptuTAjQi5rN/0mB0SKS881J3dbq2DItaEHisB97V7hhX7i/IGh4vL6EqE3n/j8xNmmtTNijGx3qBo/7SoRZp2SQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=g1e9ST5ojHmoOpizX5pWEyTGphsVCAuYfEYUYZGChEU=; b=MmwzgmXwuq0c+dFF4sxL7s6DjL61J+iSv1seILi3D0/TfBzLkvKjzdT598Io7aZAtxcvOKWUa9RbZoIpsRXat1A4BrME2Lnh9WzamntU1rGHFBaXsTUlv75mAQWB7vpELkATjcLeWmLwjjfv9aPo+ABYZ6OnB4cNrTUilN9AA2SaQByiRQwkhUcZC49DjJ8koR7zH8SEOl0cSDFM/eCkbrR+M1Yfbv1sgxPwzfbvSRpyI9y2EyFRLN/erkt2gJgHLaMP9H1wFbUf6g4ENwzKj3DkO2l3mX7brLiMXk9UDy+OzzzAvmvSBmoAbkDVdtaUbZH7De4vopMnkWVmfVhCsw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=g1e9ST5ojHmoOpizX5pWEyTGphsVCAuYfEYUYZGChEU=; b=EiMiGml5jOH6BlxPME+x0XhzKcHZJdxqVeKg79VCjf8iYGc37a8WvxGajkMs63EzUzG/9PvOyYLagqNCRgD016DR3D67aStSv00valfB5c/0ZGnaGNQIOEV2E0XStixWgY5hZAP6d4S0wTTakMBz5fq3q/2Bg3Eu8gMQR1cewJU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by PAXPR04MB9232.eurprd04.prod.outlook.com (2603:10a6:102:2ba::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.23; Fri, 31 May 2024 21:02:14 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%2]) with mapi id 15.20.7633.018; Fri, 31 May 2024 21:02:14 +0000 From: Frank Li To: Vinod Koul , imx@lists.linux.dev (open list:FREESCALE eDMA DRIVER), dmaengine@vger.kernel.org (open list:FREESCALE eDMA DRIVER), linux-kernel@vger.kernel.org (open list) Subject: [PATCH 2/2] dmaengine: fsl-edma: remove redundant "idle" field from fsl_chan Date: Fri, 31 May 2024 17:01:52 -0400 Message-Id: <20240531210152.1878443-2-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240531210152.1878443-1-Frank.Li@nxp.com> References: <20240531210152.1878443-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR13CA0215.namprd13.prod.outlook.com (2603:10b6:a03:2c1::10) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|PAXPR04MB9232:EE_ X-MS-Office365-Filtering-Correlation-Id: 7c44edb7-94cc-4000-e6d4-08dc81b4f280 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|366007|1800799015|52116005|376005|38350700005; X-Microsoft-Antispam-Message-Info: rCsJzYEucNmdrdf0MpbnM2LupAqVH9yDIofgJFkCanOUF96IQnryvX/3rKzS/tX8fOi8ZdyiToMQdg3d6wRnz12b9HWPI84jzDt4oSU+NyadsNJ6N6DIwsicx1wZGCQpg6bV5cT8PmvIIq3nia+8Jitv46K2o7fPiVOPylm/34n7NNphAoN5r891TOgIl1ScbP/CeL1XnWQbKiHzi5I9PsCEJM1rdzIHK7Fgk5UtFG+Opz+5CdMk13XvL6u9Kw3OG/XdHaUVE9aAV6XtT+g6tBRNP/V2FwqkiurgnbvrYwRaz+I2zj1mk51gpWP0InuTJ2BvzNWPTIymryEiAk1/tbnZSZ3y4HNo6M/gzpMwJ7Wksb3Ed4jU89QnVMyeDgPcDho5Xyrdhweg+wuV0j2YJsa9GsGTTSjST6cxjThjL6R88ZdsVo4aofpzfO4xH6kXr0R0aFTFREvx+P5JlciYL3P20VBbqMrAI3LT5WMHmC3lJ83if5uLVWe8zda7tznrNlfwRm52JA8JSIbImc09nei3L5Lgrv6qki7X4kNTpNIpLfzfE4uklw2vQA6fkShwoDCGqn+Au4eZp4P1GLD29k+WePcv9wwqpbmD3cgWvY7A2qZpwe6hCpy0JKwoez/GHg6yVKbfpusVz0Lyixwd6LwH6JkrGDzsyZfan3v/dKHS79lTA0lR2rOL62UcuqRGrtDjOkxbZr86O7MatEQ/VYI2CPNQxsjOZqJJZIfWqn8D7+A2ugfs53HhtOYTZDpxIVNaSuBhI6V5tEY/VlJ13cVnZWo8esgwCBCyC6EU0EzM4Jrb+DLZabKhurR8K10z1dFs0gOZOLQxva5EZ+WEOzJgWlz1gxRCmLlZFINbQDg8XZZH50BWZIWP9IfYrmpfGoCVqrXhsnxvTceV7jfYIHe08NCG1FrHxaCRDJRD07LCiLGrAzuWUM/mZJ0gDzw2wpuR0NIjLQdQA9XC0cNXGq7IgCPDaM5WCQ7SbnTbPN+tkvU/nxG7FvtKTGLF0okYLnqDi7ULycDSodDWedQF9mdOH53a2YSJpsmN2G8XwMRoh5nvpwOdKDKGos4DRBhxoTNbqscwV1LdXbDYIWkieI4RIhqttxBgNQ2aNug6h/zFbcpaR73fDHdPJlQLxzGzTQ+cPyKP8p73XsHtL7wDi37NgW7Er9ncbpYGR3U/sgXnzNrxMIQiww77BRzO8Cx4HlG5jhFv38KYH43nUP98YKGfXWvSc6roUDa5tuPpKUNV1L89h2eCxKMPiaO7bs2eYADcsO7rGEhttVA+UG02vOc48Yo5u/FCbB9cnbQHIOWkFSQpaznwN6EJd1D44c0USHdaX+WNZ7XfEBPROot4cw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366007)(1800799015)(52116005)(376005)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: EXIFYLGA93Ix4dd4N/g3iQ/1cqQWSoF8h3rIucJn80Svd+DD+mUnTyKgNU8BYUIu16Cx0G57SuO4G3cM7GoXVMDdr8v2YwzYrmYFUlyC1bJ7KkRiIy7190Fu2cuxsCWAvGXEFwVQQs7E5fi+Tymr0zjKq+s1PyVBZc9ofbRPiqeUDi5VCPr8SGEcGl9LgW4NUK3y2lKFD3G2M/bi7vCrSHMEoKAvnGiYZSEcSCl7972lNMN+ZxEMBVnyvNxmuHmvhty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eUKZFUShwTG5LC6piAa9LO0RysOeaXHCD/suyHX74iQrkaosqZrVv3TSBzitHNeYkhgzrNpjcKxudJRe6AARM/glN0bEN+9Yfm0s9fwjaVIkf7vL23sGSlhFvH9ftL6SghqlLNds859wUni2A3y33wVc1UmRq/kX2JCP9Z1HL3N7IKBT3yv31uAc86A3HIIoCo3Bejxa71jMKPhi0wMcl6mjNuBXMKe4380ae0bFjLffvmMNXemVONuWzI3B6qsDGVn X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7c44edb7-94cc-4000-e6d4-08dc81b4f280 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 May 2024 21:02:14.4004 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: K7FTN15LBo7Y5x7t61ZKpmaLSRsfrELfacmp5t8rme7l2aREtbe+BsZ/UvVP55yfix/c54x+PUtuMFHWCg8ltA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB9232 The 'idle' in fsl_chan is redundant as it's equivalent to 'status != DMA_IN_PROGRESS'. So remote it to simple code logic. Signed-off-by: Frank Li --- drivers/dma/fsl-edma-common.c | 6 +----- drivers/dma/fsl-edma-common.h | 2 -- drivers/dma/fsl-edma-main.c | 3 +-- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c index 91a4c11b7cbfd..e31dcc127708d 100644 --- a/drivers/dma/fsl-edma-common.c +++ b/drivers/dma/fsl-edma-common.c @@ -59,7 +59,6 @@ void fsl_edma_tx_chan_handler(struct fsl_edma_chan *fsl_chan) vchan_cookie_complete(&fsl_chan->edesc->vdesc); fsl_chan->edesc = NULL; fsl_chan->status = DMA_COMPLETE; - fsl_chan->idle = true; } else { vchan_cyclic_callback(&fsl_chan->edesc->vdesc); } @@ -239,7 +238,7 @@ int fsl_edma_terminate_all(struct dma_chan *chan) spin_lock_irqsave(&fsl_chan->vchan.lock, flags); fsl_edma_disable_request(fsl_chan); fsl_chan->edesc = NULL; - fsl_chan->idle = true; + fsl_chan->status = DMA_COMPLETE; vchan_get_all_descriptors(&fsl_chan->vchan, &head); spin_unlock_irqrestore(&fsl_chan->vchan.lock, flags); vchan_dma_desc_free_list(&fsl_chan->vchan, &head); @@ -259,7 +258,6 @@ int fsl_edma_pause(struct dma_chan *chan) if (fsl_chan->edesc) { fsl_edma_disable_request(fsl_chan); fsl_chan->status = DMA_PAUSED; - fsl_chan->idle = true; } spin_unlock_irqrestore(&fsl_chan->vchan.lock, flags); return 0; @@ -274,7 +272,6 @@ int fsl_edma_resume(struct dma_chan *chan) if (fsl_chan->edesc) { fsl_edma_enable_request(fsl_chan); fsl_chan->status = DMA_IN_PROGRESS; - fsl_chan->idle = false; } spin_unlock_irqrestore(&fsl_chan->vchan.lock, flags); return 0; @@ -780,7 +777,6 @@ void fsl_edma_xfer_desc(struct fsl_edma_chan *fsl_chan) fsl_edma_set_tcd_regs(fsl_chan, fsl_chan->edesc->tcd[0].vtcd); fsl_edma_enable_request(fsl_chan); fsl_chan->status = DMA_IN_PROGRESS; - fsl_chan->idle = false; } void fsl_edma_issue_pending(struct dma_chan *chan) diff --git a/drivers/dma/fsl-edma-common.h b/drivers/dma/fsl-edma-common.h index c5a766da02b88..b846cfe0a7fc6 100644 --- a/drivers/dma/fsl-edma-common.h +++ b/drivers/dma/fsl-edma-common.h @@ -150,7 +150,6 @@ struct fsl_edma_chan { struct virt_dma_chan vchan; enum dma_status status; enum fsl_edma_pm_state pm_state; - bool idle; struct fsl_edma_engine *edma; struct fsl_edma_desc *edesc; struct dma_slave_config cfg; @@ -456,7 +455,6 @@ static inline struct fsl_edma_desc *to_fsl_edma_desc(struct virt_dma_desc *vd) static inline void fsl_edma_err_chan_handler(struct fsl_edma_chan *fsl_chan) { fsl_chan->status = DMA_ERROR; - fsl_chan->idle = true; } void fsl_edma_tx_chan_handler(struct fsl_edma_chan *fsl_chan); diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c index 82ac56be2d832..af05166ed251f 100644 --- a/drivers/dma/fsl-edma-main.c +++ b/drivers/dma/fsl-edma-main.c @@ -544,7 +544,6 @@ static int fsl_edma_probe(struct platform_device *pdev) fsl_chan->edma = fsl_edma; fsl_chan->pm_state = RUNNING; fsl_chan->srcid = 0; - fsl_chan->idle = true; fsl_chan->dma_dir = DMA_NONE; fsl_chan->vchan.desc_free = fsl_edma_free_desc; @@ -669,7 +668,7 @@ static int fsl_edma_suspend_late(struct device *dev) continue; spin_lock_irqsave(&fsl_chan->vchan.lock, flags); /* Make sure chan is idle or will force disable. */ - if (unlikely(!fsl_chan->idle)) { + if (unlikely(fsl_chan->status == DMA_IN_PROGRESS)) { dev_warn(dev, "WARN: There is non-idle channel."); fsl_edma_disable_request(fsl_chan); fsl_edma_chan_mux(fsl_chan, 0, false);