Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp441002rwi; Thu, 27 Oct 2022 03:30:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4gbhrlJ+Eqle3JQC+GxmzRwTi2+UrvQ3XvfUP/XTM1hGvyD0or9cJip9a988AfCxtl7MnQ X-Received: by 2002:a17:902:b708:b0:184:3921:df30 with SMTP id d8-20020a170902b70800b001843921df30mr49482645pls.43.1666866626563; Thu, 27 Oct 2022 03:30:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666866626; cv=none; d=google.com; s=arc-20160816; b=hsayAuvdlgYG+JLPi2hIrK/kAc2vI37sEnKxiUN/sqQJnyZBX7eho/nmoMTJ0ysMKc ZiZ4u3iLxlRiESO/YufXejmGJUH05sX1wF0Dw0XT5jL15uZkNXD3X3GrQKwEq9Ky9Hve Z2Q77Zs2o3qrUzDmSUr+fO5yAgeG2HaZVAXFdJgxsUOZh2R3E5o5JHJ9Dp71pw6AHcrw 72sS0lxsatj7fo8b5gygKpzr3ATKnfImghoCqaDMRBfYQR/5IzgI1PScLTTCqZV6DWUu nSDSxAEKKJyPYuHVUJK07e0BugO2fT3V7zbFtBuW93D5q0/KAJW/k1fdTjvl0O6rLct1 jaKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=UKQTPRFu++JOzaQvPKM6EY88nyYcpwHVj06ax0yzQAI=; b=EbNh2GvEAJ6Hmv94zuR11JTmjG1Kr2stgrzJpDa6Ab0RwBp9IyfxxhDshP8D4HxMeV ncWcwXmqAntOVIt7vZXCDFmz5jT4ySC/ZMJavd0/L8zgfgjZ1Rb2EA9pedWIBsp5Fj+U PYVNGR7IiWjGrcjTEcA1x7MvTk0225kdHQu+ZcLDOY46MygwlOEBe2q7cboMAKxFzdXf hpX7SLiEruRGh6XonLByvWbv5lVmvfWX/ljZvDGblFVbxQSNMYpJfIepzIaMutswSmNx zOtfD9DTm+69CF/lE5DsU4GUAnDX+le6HpTob2bINChXxlw4ncWoVYKx/8XRW2DqJTcN LATQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=r1XOWKOp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x6-20020a170902ec8600b0016efde92292si1417818plg.255.2022.10.27.03.30.13; Thu, 27 Oct 2022 03:30:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=r1XOWKOp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235345AbiJ0K17 (ORCPT + 99 others); Thu, 27 Oct 2022 06:27:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234509AbiJ0K1n (ORCPT ); Thu, 27 Oct 2022 06:27:43 -0400 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C7472F65C for ; Thu, 27 Oct 2022 03:27:42 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id t4so625684wmj.5 for ; Thu, 27 Oct 2022 03:27:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UKQTPRFu++JOzaQvPKM6EY88nyYcpwHVj06ax0yzQAI=; b=r1XOWKOprkHaO8FuW0u5IWId2lIgt3Vo1/lrOuUOcyBn9+EuFrRE8LSNux6ADaZRum VLi9zUsaL6CHZHxysp6vPtsxPRP6VXtjyYGXSDunjjjbcsML0DBQaqMykQumfXasesdI anr5cPryy9/WlbFYZU1ZHLyD8qh27kqGcXwcQ9016DQoyuPmOMfdjk9gfq7SIfNoPYzr oHhac+jl4qBAM1IoTS55RdoX5YW4BAyLN9qPpmq7uk546+slO19MKEsN1diDNBwUzLsE sP7oNAsBk/jdqqGXb1SLPu+xG1Yc2c914mgbtuAE12jSxS5U7pJ/rNV/mHttyaPS36Sm EJyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UKQTPRFu++JOzaQvPKM6EY88nyYcpwHVj06ax0yzQAI=; b=KHCR/99T1cGZQcy86ad6Up0KvOWWrEC+ztpJvSurJKdtIsJeCocTG5OZ2Gr4TQt8Cd WavSvnoawvCjVsStZKzDWa8zSylB1GCh24x1bWcqEltkhWt/Gv0eLjfAlSGtYhXuFF45 Sl9iF9Ooa1mWjTKCTwULuXCnXBd1RZ6JIbcQ5bfrMSACzVxCyAfELpsO3K0gEwh2AiOk cPtXER9+bA6OOGBNgo0F8NkpF+3w098Iw80toTl9cGDwMDFItc3DVJEyiLclyMnpFtXU c4KYu9svxhXvuwsooHCn1StocXFe5qCJqSZ8zTboqdeQGw8Q4zuxkUkc1KfGi8NHqw/S /fqQ== X-Gm-Message-State: ACrzQf1reIxB4VItS3+BAupDzWL2kVbaarFjXqRS0a3vCbe9piNgRAxN 7m6Hj2v8tTK2gmxW7ZUQHqH2/A== X-Received: by 2002:a05:600c:5563:b0:3cf:503c:c759 with SMTP id ja3-20020a05600c556300b003cf503cc759mr2107969wmb.30.1666866460613; Thu, 27 Oct 2022 03:27:40 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id fc7-20020a05600c524700b003b505d26776sm5088674wmb.5.2022.10.27.03.27.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Oct 2022 03:27:40 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org Cc: lgirdwood@gmail.com, bgoswami@quicinc.com, perex@perex.cz, tiwai@suse.com, linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Srinivas Kandagatla Subject: [PATCH v3 1/9] ASoC: qdsp6: audioreach: topology use idr_alloc_u32 Date: Thu, 27 Oct 2022 11:27:02 +0100 Message-Id: <20221027102710.21407-2-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20221027102710.21407-1-srinivas.kandagatla@linaro.org> References: <20221027102710.21407-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org SubGraph and Module Instance ids take 32 bits, so use idr_alloc_u32 instead of idr_alloc to able to accommodate valid ranges. Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/qdsp6/topology.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sound/soc/qcom/qdsp6/topology.c b/sound/soc/qcom/qdsp6/topology.c index bd649c232a06..9a3d9e0eae53 100644 --- a/sound/soc/qcom/qdsp6/topology.c +++ b/sound/soc/qcom/qdsp6/topology.c @@ -44,7 +44,7 @@ static struct audioreach_graph_info *audioreach_tplg_alloc_graph_info(struct q6a INIT_LIST_HEAD(&info->sg_list); mutex_lock(&apm->lock); - ret = idr_alloc(&apm->graph_info_idr, info, graph_id, graph_id + 1, GFP_KERNEL); + ret = idr_alloc_u32(&apm->graph_info_idr, info, &graph_id, graph_id, GFP_KERNEL); mutex_unlock(&apm->lock); if (ret < 0) { @@ -53,7 +53,7 @@ static struct audioreach_graph_info *audioreach_tplg_alloc_graph_info(struct q6a return ERR_PTR(ret); } - info->id = ret; + info->id = graph_id; return info; } @@ -94,7 +94,7 @@ static struct audioreach_sub_graph *audioreach_tplg_alloc_sub_graph(struct q6apm INIT_LIST_HEAD(&sg->container_list); mutex_lock(&apm->lock); - ret = idr_alloc(&apm->sub_graphs_idr, sg, sub_graph_id, sub_graph_id + 1, GFP_KERNEL); + ret = idr_alloc_u32(&apm->sub_graphs_idr, sg, &sub_graph_id, sub_graph_id, GFP_KERNEL); mutex_unlock(&apm->lock); if (ret < 0) { @@ -103,7 +103,7 @@ static struct audioreach_sub_graph *audioreach_tplg_alloc_sub_graph(struct q6apm return ERR_PTR(ret); } - sg->sub_graph_id = ret; + sg->sub_graph_id = sub_graph_id; return sg; } @@ -136,7 +136,7 @@ static struct audioreach_container *audioreach_tplg_alloc_container(struct q6apm INIT_LIST_HEAD(&cont->modules_list); mutex_lock(&apm->lock); - ret = idr_alloc(&apm->containers_idr, cont, container_id, container_id + 1, GFP_KERNEL); + ret = idr_alloc_u32(&apm->containers_idr, cont, &container_id, container_id, GFP_KERNEL); mutex_unlock(&apm->lock); if (ret < 0) { @@ -145,7 +145,7 @@ static struct audioreach_container *audioreach_tplg_alloc_container(struct q6apm return ERR_PTR(ret); } - cont->container_id = ret; + cont->container_id = container_id; cont->sub_graph = sg; /* add to container list */ list_add_tail(&cont->node, &sg->container_list); @@ -181,7 +181,7 @@ static struct audioreach_module *audioreach_tplg_alloc_module(struct q6apm *apm, AR_MODULE_DYNAMIC_INSTANCE_ID_START, AR_MODULE_DYNAMIC_INSTANCE_ID_END, GFP_KERNEL); } else { - ret = idr_alloc(&apm->modules_idr, mod, module_id, module_id + 1, GFP_KERNEL); + ret = idr_alloc_u32(&apm->modules_idr, mod, &module_id, module_id, GFP_KERNEL); } mutex_unlock(&apm->lock); @@ -191,7 +191,7 @@ static struct audioreach_module *audioreach_tplg_alloc_module(struct q6apm *apm, return ERR_PTR(ret); } - mod->instance_id = ret; + mod->instance_id = module_id; /* add to module list */ list_add_tail(&mod->node, &cont->modules_list); mod->container = cont; -- 2.21.0