From patchwork Fri Oct 21 16:51:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 6875 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp804308wrr; Fri, 21 Oct 2022 09:59:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6cqVYc+wKqRLb904gPUgzbBifKOUMujANdsAszLNzhEkYKQnl71m8iz5y11oF2H7Q0lWMB X-Received: by 2002:a62:5587:0:b0:56a:fd45:d15c with SMTP id j129-20020a625587000000b0056afd45d15cmr2784242pfb.33.1666371598425; Fri, 21 Oct 2022 09:59:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666371598; cv=none; d=google.com; s=arc-20160816; b=fvmqxyotzZC+wRh1rh7EZtUg+p/AA2ETJjMT+ao1wWL5etc83ipOqLxm9GfumrY9Ya G6zkUTkPw0PjACz+eyxauaxlNP+U4QaJRC4DsAnDFJ3e9Sat/qdgDpOSf2P3caiE7x2t m40iF0dJq9evDga2pwn/J7tG8YVZgdE9Y9LA7Xy7jCj0HVByp4TY/zLRBM4kUuPxLGHu oQ/7i5jUYWKrn89NyrBpZg2n67czpoCjEQgOBj5k5iS7+3gGj/yHoPWe23Ikpx/GBQOZ zurQ/r2njf6WY0aiNgwEY0Vc2cMb32F+b0IEuOryxi97m6ymft6ZKdK6KVaQwdfx15PO 41vQ== 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=S1Wbe703KgwRjRnGYT1UQwDcnhEdqY3xQGpBo/iRxEg=; b=BhfKt6er4ny4Ft7vr/6UzAX4Gxquib+NBUu9iswF5r9Ji8ePDipE9VFDZjM4hCmE6Y 2fo6KEmcWM6MMDtEc8NNBMmiGeiqNa9NT1cOKex7r4kLE74rVQ8qXbD896zXMYKQWlnY 8RlL+hrNxq5IT5+zp1ntLV4mAWRes3dpzPIjcs8K3zV5fueYfsoZOkgjGDJQhK4pahjP PQXKNsb9Ik7xCCSls8WyadEj9eEoeMgDyQXMYQVRuo36rCQrwjYuktAfPyC7gDKBw/tV 2s3b2XLYSeYGQH6RBDOlu1kcVhZ6geC36UPtdedi/J1XQ3spn/YlXyHFf6DE8dL9m1Vh ptMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=e5cCay4S; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r30-20020a63205e000000b00460b9d08d7bsi24975002pgm.868.2022.10.21.09.59.44; Fri, 21 Oct 2022 09:59:58 -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=e5cCay4S; 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 S231171AbiJUQx1 (ORCPT + 99 others); Fri, 21 Oct 2022 12:53:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229923AbiJUQxT (ORCPT ); Fri, 21 Oct 2022 12:53:19 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B39A728B1DB for ; Fri, 21 Oct 2022 09:53:08 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id bh7-20020a05600c3d0700b003c6fb3b2052so2447416wmb.2 for ; Fri, 21 Oct 2022 09:53:08 -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=S1Wbe703KgwRjRnGYT1UQwDcnhEdqY3xQGpBo/iRxEg=; b=e5cCay4SFUrpxbbt6ZxM5tOq2iPJacFUiZ6rBvOTWdwCsnj2o12Egu9+sXict2iThJ ARwmWdHIKdw0ja2J5x+9MdEl7cs4f2r0tnXfx+0bwPQmKYfzWEViMmx0gVwa6LpxgoIL WMkC12dSMmOSXd4nAN+yjqm4NVbfNmSnJx9z3hxtta+lpbDkYftEQBwblf01wD10mSH2 WrkQnRZcl9eFD80EwYKR0mOxVxbJ4CyOJKkd1bHnSdF0yPHTns9OfXoqRkulvslnEm8x 0EACz0O1lrr40AYC+zOnZ6F82clKqRStr2Cy39R+iQaZJxa/9ZSPLMYFKiz8QQvYO4vd C+mg== 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=S1Wbe703KgwRjRnGYT1UQwDcnhEdqY3xQGpBo/iRxEg=; b=L9Ly1+HL4pSiymKQoRRSMv3f+eoqB+mzt8xQALWidf5ie4ruGKh3Xbqk8RqjPQv54T DU6ImapcPTVPuDnT1WQGCICkdUeCXdv+l9oak6+MW2YCD69OOEU8LkYy3/TfpVqjElR1 MkiJDv+AEkzPU1ka/aFK5hcB4UO8CiV8JrpxN9RKFv0H3xLUvoj1D4P45SWVTlxateCb nPxZ4+WotI/G9hhmdSGvNWhgCGj49P8HNLpebPIqfP4ManJRFOnFbjURqWtco8RFWArX 8AOULnpnN4feHRqnM4uImDcOntl7+KdxjZwyvNCy32WqhWYVe0ZSP+xg5iK+fKOqEWPj C2+A== X-Gm-Message-State: ACrzQf0POOD1K0qD5vRMrFBowoM8Bvu7kGo7wsFearkVdMSAFaNR/g30 EKGECG+U9kikdXHQxgYF+D0VjA== X-Received: by 2002:a05:600c:1e2a:b0:3c3:d770:1756 with SMTP id ay42-20020a05600c1e2a00b003c3d7701756mr14158424wmb.134.1666371183770; Fri, 21 Oct 2022 09:53:03 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id n14-20020a5d400e000000b0022ae401e9e0sm19541773wrp.78.2022.10.21.09.53.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Oct 2022 09:53:02 -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 v2 1/9] ASoC: qdsp6: audioreach: topology use idr_alloc_u32 Date: Fri, 21 Oct 2022 17:51:59 +0100 Message-Id: <20221021165207.13220-2-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20221021165207.13220-1-srinivas.kandagatla@linaro.org> References: <20221021165207.13220-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 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,URIBL_BLOCKED autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747317265497996350?= X-GMAIL-MSGID: =?utf-8?q?1747317265497996350?= SubGraph and Module Instance ids take 32 bits, so use idr_alloc_u32 instead of idr_alloc to able to accomdate 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;