{"id":2232128,"url":"http://patchwork.ozlabs.org/api/patches/2232128/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-tegra/patch/20260503003037.11942-1-rosenp@gmail.com/","project":{"id":21,"url":"http://patchwork.ozlabs.org/api/projects/21/?format=json","name":"Linux Tegra Development","link_name":"linux-tegra","list_id":"linux-tegra.vger.kernel.org","list_email":"linux-tegra@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260503003037.11942-1-rosenp@gmail.com>","list_archive_url":null,"date":"2026-05-03T00:30:37","name":"[PATCHv2] ASoC: tegra: ADMAIF: allocate with a single kzalloc","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"9bb2a80841e40ac7ad47a05fa4551de3100ff3e8","submitter":{"id":70304,"url":"http://patchwork.ozlabs.org/api/people/70304/?format=json","name":"Rosen Penev","email":"rosenp@gmail.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-tegra/patch/20260503003037.11942-1-rosenp@gmail.com/mbox/","series":[{"id":502555,"url":"http://patchwork.ozlabs.org/api/series/502555/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-tegra/list/?series=502555","date":"2026-05-03T00:30:37","name":"[PATCHv2] ASoC: tegra: ADMAIF: allocate with a single kzalloc","version":1,"mbox":"http://patchwork.ozlabs.org/series/502555/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2232128/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2232128/checks/","tags":{},"related":[],"headers":{"Return-Path":"\n <linux-tegra+bounces-14144-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-tegra@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=hPjCbDfq;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c15:e001:75::12fc:5321; helo=sin.lore.kernel.org;\n envelope-from=linux-tegra+bounces-14144-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=\"hPjCbDfq\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=209.85.210.170","smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=gmail.com"],"Received":["from sin.lore.kernel.org (sin.lore.kernel.org\n [IPv6:2600:3c15:e001:75::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g7Qg75nmYz1y04\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 03 May 2026 10:30:59 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sin.lore.kernel.org (Postfix) with ESMTP id A7EFC300185D\n\tfor <incoming@patchwork.ozlabs.org>; Sun,  3 May 2026 00:30:55 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 185BA1519B4;\n\tSun,  3 May 2026 00:30:54 +0000 (UTC)","from mail-pf1-f170.google.com (mail-pf1-f170.google.com\n [209.85.210.170])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 97ACB495E5\n\tfor <linux-tegra@vger.kernel.org>; Sun,  3 May 2026 00:30:52 +0000 (UTC)","by mail-pf1-f170.google.com with SMTP id\n d2e1a72fcca58-8353fd1cb5fso104506b3a.0\n        for <linux-tegra@vger.kernel.org>;\n Sat, 02 May 2026 17:30:52 -0700 (PDT)","from ryzen ([2601:644:8000:5b5d:7285:c2ff:fe45:8a32])\n        by smtp.gmail.com with ESMTPSA id\n d2e1a72fcca58-835293f022asm4086305b3a.45.2026.05.02.17.30.50\n        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n        Sat, 02 May 2026 17:30:51 -0700 (PDT)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777768253; cv=none;\n b=og0qpciabvP8YdNe0MSDg5RoasCl++HPrv5qEeSnZAiH0ps5/r7iujgqFBm6TEOpI7mFqZWUpoNfh1tvN4PGnadxiGHCqkeKRURERhGChI4YTPHsKyF/gBDqX/UUxis1vKRllcGxdth/WZjfGfo7/xscc8cRyOCPCQXZl7fSFog=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777768253; c=relaxed/simple;\n\tbh=N4Oewy83+Tf/MQeuvG7fpzvA1Aszha9anFzqTZugG0A=;\n\th=From:To:Cc:Subject:Date:Message-ID:MIME-Version;\n b=TQE39V7gDOtoEq2atsA0EoHFJB9feHhmgOGOFYyDp9YABkonh4kdK1sXlrfdIf8lyPGnwUl3aaiUfz1H60G7TS4/fLk5z8AtKfNSGn5OBhoE/AO7L4rIhl+RxAJoAzOkgL0l5Sw5UtAJl5gp4RS4e2EH6VSnNGyu73YUYY0rTHw=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com;\n spf=pass smtp.mailfrom=gmail.com;\n dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=hPjCbDfq; arc=none smtp.client-ip=209.85.210.170","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=gmail.com; s=20251104; t=1777768252; x=1778373052;\n darn=vger.kernel.org;\n        h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n         :to:from:from:to:cc:subject:date:message-id:reply-to;\n        bh=2cqtN6UxMZDT/bmefPZMzQI/MaSXcFcM6J1zz/t6mH8=;\n        b=hPjCbDfqOIYxyAYnFs5HLlGwKMxVf5NDKQTQt29hcQc9/JY9AKo86YOSG3SD2eTuiS\n         oqMgwiLlookbhcBR1UEja0SUwEkE4BYlbco2Pf02rF1zpsPMlp0vC4rEh69dRvzsZwH5\n         KsS1VEXKYPOBEdH++9ukyselT3Lkfav5ktXq398EIxlELnjv61JK67wA4iFQhYgT84AQ\n         LFyQdoqpJUq9G5TGXY3u3pgpm/y6YURmLdkXPKNt89w9KLa4W5x2D0Lr5B5b3H3duv6t\n         u3Y4trT/kta3Iiu4BDzYxXTWmqFsdoQnqiILx6AzsGBoWQBe1Kjjj2TgouBtNZh82syw\n         GM/w==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20251104; t=1777768252; x=1778373052;\n        h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n         :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n         :message-id:reply-to;\n        bh=2cqtN6UxMZDT/bmefPZMzQI/MaSXcFcM6J1zz/t6mH8=;\n        b=PGhqN4PdOCqyv1AEkc0yABFqdkaoU8aiJPAsCe8ltx7zhG0IKIJezFkGP0adwdttc6\n         0vn+CZv+bUSSv0MGadV3Al6/CVQztDeiosQTnhnjLn7wJpRDiSu5x/xOkTL8q5J2gcTo\n         qP9x1Fs6GLVNeXE/XeceywE3yavSL4VaMmKnMW6+8KniRbeFZbYTETOERN+dyrrGPUgK\n         5IuWtVIfbY71VqVQ8NWj15L5JB94H0CzE0r2SALFiNP+cDTFeBtEOdnrlZ28UUnCMOl0\n         WtFE8fNXrKNhiB1SbSwACc/J5cobdzlxQWmhNX5ayYW76MrhuJxIywUb38g5tfsLdb9B\n         Cm/A==","X-Forwarded-Encrypted":"i=1;\n AFNElJ9l3qobutbNggnYTHu7HVU9L+cTkFYtc7paqbQIBIpO1dEf56Jpq5HW2OpF09ENFeIIVzjFquglxqZDbQ==@vger.kernel.org","X-Gm-Message-State":"AOJu0Yx/ZVuT5cU0wTvX/mkhinuvMI07FsiO+8q68dInkTqo+h9wtDID\n\tyTPKUpsKEdw//Ac56T8iA7duGnJmUm6F9WKFXMXtywcl57VQZNBISdRwXQV6xA==","X-Gm-Gg":"AeBDietmjDFu9Q29VPj8jvU0j/xPYcDxYeLJxpYFP4VAJ1XjQU9ZDKkY137++EkAtKm\n\ttUXih0CVAiT83LMAVRXpGeSgrBl+a1BM4Fu4hDDIVQ7kO+3b53tWr9TqHYiHHdGy4a/78Tlq9GX\n\tdjPNSwysYY+59o962J6RLgC0J4D4ptwl1B4wfRGmGRqcKpFJ3S+zIcj/6aHj8l13mxC93/ahzGv\n\teh8zxQgUhr0SXu2VkuiDj0AAuiyqsdjD5ojy89FZYgEGzJg3qi1wDYsYnlALEU2OudW94CugHCb\n\tsS+GgIsAScWS5KYloYeIgJI27PvVwOWvmwg9jm5ZLklU5XzqrCROqyqRunbmsT934f/7uaqfH3S\n\tt6LqVYyyjpoJJyRaadEcp5w6MBmeaFqXDncyaFdHoikQsmG+bGuok3X1/LBJRrtxh0M2phZGPoN\n\td9l+SPrSA0YGDTKaG+WOOdmSsPxmuyvoIwov18yPBMHojU2LwKDMhbOnagf11en0S3fdut3lEEN\n\tJOWTzLNXb15cK9HTR/91OjuKCEgrQz38WTRzDmKpWJ5IA==","X-Received":"by 2002:a05:6a00:299a:b0:822:69b2:7ed0 with SMTP id\n d2e1a72fcca58-8352c3b0cc7mr3848193b3a.6.1777768251973;\n        Sat, 02 May 2026 17:30:51 -0700 (PDT)","From":"Rosen Penev <rosenp@gmail.com>","To":"linux-sound@vger.kernel.org","Cc":"Liam Girdwood <lgirdwood@gmail.com>,\n\tMark Brown <broonie@kernel.org>,\n\tJaroslav Kysela <perex@perex.cz>,\n\tTakashi Iwai <tiwai@suse.com>,\n\tThierry Reding <thierry.reding@kernel.org>,\n\tJonathan Hunter <jonathanh@nvidia.com>,\n\tlinux-tegra@vger.kernel.org (open list:TEGRA ARCHITECTURE SUPPORT),\n\tlinux-kernel@vger.kernel.org (open list)","Subject":"[PATCHv2] ASoC: tegra: ADMAIF: allocate with a single kzalloc","Date":"Sat,  2 May 2026 17:30:37 -0700","Message-ID":"<20260503003037.11942-1-rosenp@gmail.com>","X-Mailer":"git-send-email 2.54.0","Precedence":"bulk","X-Mailing-List":"linux-tegra@vger.kernel.org","List-Id":"<linux-tegra.vger.kernel.org>","List-Subscribe":"<mailto:linux-tegra+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-tegra+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit"},"content":"Consolidate the allocations for capture_dma_data and playback_dma_data\ninto a single kzalloc by using a flexible array member at the end of\nthe tegra_admaif struct. This reduces the number of allocations from\nthree to one, simplifies error handling, and improves memory locality.\n\nSigned-off-by: Rosen Penev <rosenp@gmail.com>\n---\n v2: place description in the proper place.\n sound/soc/tegra/tegra210_admaif.c | 28 ++++++++++------------------\n sound/soc/tegra/tegra210_admaif.h |  2 +-\n sound/soc/tegra/tegra_isomgr_bw.c |  1 +\n 3 files changed, 12 insertions(+), 19 deletions(-)","diff":"diff --git a/sound/soc/tegra/tegra210_admaif.c b/sound/soc/tegra/tegra210_admaif.c\nindex a1c2757a3932..7299c6bfcf15 100644\n--- a/sound/soc/tegra/tegra210_admaif.c\n+++ b/sound/soc/tegra/tegra210_admaif.c\n@@ -11,6 +11,7 @@\n #include <linux/platform_device.h>\n #include <linux/pm_runtime.h>\n #include <linux/regmap.h>\n+#include <sound/dmaengine_pcm.h>\n #include <sound/pcm_params.h>\n #include <sound/soc.h>\n #include \"tegra_isomgr_bw.h\"\n@@ -912,35 +913,26 @@ MODULE_DEVICE_TABLE(of, tegra_admaif_of_match);\n \n static int tegra_admaif_probe(struct platform_device *pdev)\n {\n+\tconst struct tegra_admaif_soc_data *soc_data;\n \tstruct tegra_admaif *admaif;\n \tvoid __iomem *regs;\n \tstruct resource *res;\n+\tsize_t alloc_size;\n \tint err, i;\n \n-\tadmaif = devm_kzalloc(&pdev->dev, sizeof(*admaif), GFP_KERNEL);\n+\tsoc_data = of_device_get_match_data(&pdev->dev);\n+\n+\talloc_size = struct_size(admaif, capture_dma_data, soc_data->num_ch);\n+\talloc_size += sizeof(*admaif->playback_dma_data) * soc_data->num_ch;\n+\tadmaif = devm_kzalloc(&pdev->dev, alloc_size, GFP_KERNEL);\n \tif (!admaif)\n \t\treturn -ENOMEM;\n \n-\tadmaif->soc_data = of_device_get_match_data(&pdev->dev);\n+\tadmaif->playback_dma_data = admaif->capture_dma_data + soc_data->num_ch;\n+\tadmaif->soc_data = soc_data;\n \n \tdev_set_drvdata(&pdev->dev, admaif);\n \n-\tadmaif->capture_dma_data =\n-\t\tdevm_kcalloc(&pdev->dev,\n-\t\t\t     admaif->soc_data->num_ch,\n-\t\t\t     sizeof(struct snd_dmaengine_dai_dma_data),\n-\t\t\t     GFP_KERNEL);\n-\tif (!admaif->capture_dma_data)\n-\t\treturn -ENOMEM;\n-\n-\tadmaif->playback_dma_data =\n-\t\tdevm_kcalloc(&pdev->dev,\n-\t\t\t     admaif->soc_data->num_ch,\n-\t\t\t     sizeof(struct snd_dmaengine_dai_dma_data),\n-\t\t\t     GFP_KERNEL);\n-\tif (!admaif->playback_dma_data)\n-\t\treturn -ENOMEM;\n-\n \tfor (i = 0; i < ADMAIF_PATHS; i++) {\n \t\tadmaif->mono_to_stereo[i] =\n \t\t\tdevm_kcalloc(&pdev->dev, admaif->soc_data->num_ch,\ndiff --git a/sound/soc/tegra/tegra210_admaif.h b/sound/soc/tegra/tegra210_admaif.h\nindex 304d45c76a9a..fd9877aa95d3 100644\n--- a/sound/soc/tegra/tegra210_admaif.h\n+++ b/sound/soc/tegra/tegra210_admaif.h\n@@ -229,13 +229,13 @@ struct tegra_admaif_soc_data {\n };\n \n struct tegra_admaif {\n-\tstruct snd_dmaengine_dai_dma_data *capture_dma_data;\n \tstruct snd_dmaengine_dai_dma_data *playback_dma_data;\n \tconst struct tegra_admaif_soc_data *soc_data;\n \tunsigned int *mono_to_stereo[ADMAIF_PATHS];\n \tunsigned int *stereo_to_mono[ADMAIF_PATHS];\n \tstruct regmap *regmap;\n \tstruct tegra_adma_isomgr *adma_isomgr;\n+\tstruct snd_dmaengine_dai_dma_data capture_dma_data[];\n };\n \n #endif\ndiff --git a/sound/soc/tegra/tegra_isomgr_bw.c b/sound/soc/tegra/tegra_isomgr_bw.c\nindex fa979960bc09..c0f300fb3d38 100644\n--- a/sound/soc/tegra/tegra_isomgr_bw.c\n+++ b/sound/soc/tegra/tegra_isomgr_bw.c\n@@ -6,6 +6,7 @@\n \n #include <linux/interconnect.h>\n #include <linux/module.h>\n+#include <sound/dmaengine_pcm.h>\n #include <sound/pcm_params.h>\n #include <sound/soc.h>\n #include \"tegra_isomgr_bw.h\"\n","prefixes":["PATCHv2"]}