From patchwork Sun Jan 14 15:15:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 13519161 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 88D23C47077 for ; Sun, 14 Jan 2024 15:23:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 03E8F10E193; Sun, 14 Jan 2024 15:23:12 +0000 (UTC) X-Greylist: delayed 450 seconds by postgrey-1.36 at gabe; Sun, 14 Jan 2024 15:23:10 UTC Received: from smtp.smtpout.orange.fr (smtp-20.smtpout.orange.fr [80.12.242.20]) by gabe.freedesktop.org (Postfix) with ESMTP id BC48710E193 for ; Sun, 14 Jan 2024 15:23:10 +0000 (UTC) Received: from fedora.home ([92.140.202.140]) by smtp.orange.fr with ESMTPA id P2D2rpeDvx8edP2D2ruurW; Sun, 14 Jan 2024 16:15:39 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1705245339; bh=gGvgGoM0e1dEjbodoGgiPLnqIqDMOOhcBuBKmJRpc0g=; h=From:To:Cc:Subject:Date; b=BtgUzr6PiLEDrT5U7hh+Jo3YWfcnNrYPzC3/04dcm9p4EHAa9TcvqKQ27kwu4TTql Ol4tDykXmDjWOXTK6OH3AbkkQ2j/8QVv1zsYOcOntfb3BZQw97Y//wzeWOeSWkVHFT g9KyBM5JsNeU/wMxd/IpUtc0lcYLS0wntGq8wrHXwLu98r+ZdA0M/MIcEjGLk8chV9 Uj18E1i+0gWvdYH+lSQ4TB2snhTdGsg9fnsgdmAYm3yyJaUtmTxkCxHEmT2W3Jspja SR3DQdevSDv+pir+9kftCvA/RpF+w6MKEVKOp43eus0qVfRr3qtHZvlDg8K4utfFlE KTdg05vxZI/TQ== X-ME-Helo: fedora.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 14 Jan 2024 16:15:39 +0100 X-ME-IP: 92.140.202.140 From: Christophe JAILLET To: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Daniel Vetter Subject: [PATCH] drm/i915/guc: Remove usage of the deprecated ida_simple_xx() API Date: Sun, 14 Jan 2024 16:15:34 +0100 Message-ID: <7108c1871c6cb08d403c4fa6534bc7e6de4cb23d.1705245316.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Christophe JAILLET , intel-gfx@lists.freedesktop.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" ida_alloc() and ida_free() should be preferred to the deprecated ida_simple_get() and ida_simple_remove(). Note that the upper limit of ida_simple_get() is exclusive, but the one of ida_alloc_range() is inclusive. So a -1 has been added when needed. Signed-off-by: Christophe JAILLET Reviewed-by: Matthew Brost --- drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c index a259f1118c5a..73ce21ddf682 100644 --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c @@ -2156,11 +2156,10 @@ static int new_guc_id(struct intel_guc *guc, struct intel_context *ce) order_base_2(ce->parallel.number_children + 1)); else - ret = ida_simple_get(&guc->submission_state.guc_ids, - NUMBER_MULTI_LRC_GUC_ID(guc), - guc->submission_state.num_guc_ids, - GFP_KERNEL | __GFP_RETRY_MAYFAIL | - __GFP_NOWARN); + ret = ida_alloc_range(&guc->submission_state.guc_ids, + NUMBER_MULTI_LRC_GUC_ID(guc), + guc->submission_state.num_guc_ids - 1, + GFP_KERNEL | __GFP_RETRY_MAYFAIL | __GFP_NOWARN); if (unlikely(ret < 0)) return ret; @@ -2183,8 +2182,8 @@ static void __release_guc_id(struct intel_guc *guc, struct intel_context *ce) + 1)); } else { --guc->submission_state.guc_ids_in_use; - ida_simple_remove(&guc->submission_state.guc_ids, - ce->guc_id.id); + ida_free(&guc->submission_state.guc_ids, + ce->guc_id.id); } clr_ctx_id_mapping(guc, ce->guc_id.id); set_context_guc_id_invalid(ce);