Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp1634815ioo; Fri, 27 May 2022 12:57:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwYqB9f/FGMRaBzhJIjohTs+IJz65AWEnhKrZfaLzL2lH67c4aZqIl1RW1cxKmHLOvUGGix X-Received: by 2002:a05:6a00:114c:b0:518:c064:d47 with SMTP id b12-20020a056a00114c00b00518c0640d47mr21479104pfm.27.1653681434819; Fri, 27 May 2022 12:57:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653681434; cv=none; d=google.com; s=arc-20160816; b=EZai0OQJ+s1WHW8avVKKKbyUylnIOowfAlNwL8n2SBJcnq76NdfbnnmBtYEXZAZzvf 57QL6RBvZnDpfkdF4x/EVKd58z8/235IItSbskQ9gVoBoc7jp6q1B0eBqpniua3UeSCt FDQOro6uvDC3klukip1YRlKV2aiXqm2gWgpo5EO3WZDlIusYsALNplBaMTtk3O/jVUhN a0KPR5qOontGcD+AzkjYUn9X2WSf9u57VAZQlChG/joHTgTaMKXGyZzyXvVn+wch0x9K lSt3djTvHivu/8vgDpkEr8lZSNh45N+TB08kQuvh6lzmTNFWHt+fqFRmItioaTTe/TX9 moTg== 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 :message-id:date:subject:cc:to:from; bh=f1Uzwq/60bCAo0ke0HpQUjNkrOcCw0TyW2CmgdhNJSw=; b=HWJh+lNkPe5UE34V4YA/piEPpOOoU1132FJ88ESJQAlU1GVHsORYzjaoc5TknOISy+ NVAX2xyDl4nluaLI4keocK5HQ2AJfZHMXPA4dGHNzU5wG2S8eGLSzXu9Av96/osv+QVF k7ePfg4dtaMZJJRrQIZhX6QsE5VG6csh4agE5y32LVIMtoI2b7L91R1kMAgLjtTO+BGz suYQpgsMkumEoUr0rhP9B5hdznp8MsObzd7lVI4FgtiFkwm6Lx2wLI1ZaYui13tU2PmN auODUy0WHqad/Jfnqb9eAahoS1QYZTF+m31NFxmi7bb/Mk0UkLx9Abj8jDn9NLzRZktW Yzgw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i9-20020a170902cf0900b0015823058edasi6439592plg.464.2022.05.27.12.56.54; Fri, 27 May 2022 12:57:14 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240258AbiE0ILo (ORCPT + 99 others); Fri, 27 May 2022 04:11:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229513AbiE0ILn (ORCPT ); Fri, 27 May 2022 04:11:43 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0961CFD34E for ; Fri, 27 May 2022 01:11:42 -0700 (PDT) Received: from dggpemm500023.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4L8ct70rR3zbbhg; Fri, 27 May 2022 16:10:07 +0800 (CST) Received: from dggpemm500018.china.huawei.com (7.185.36.111) by dggpemm500023.china.huawei.com (7.185.36.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 27 May 2022 16:11:40 +0800 Received: from localhost.localdomain (10.175.112.125) by dggpemm500018.china.huawei.com (7.185.36.111) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 27 May 2022 16:11:40 +0800 From: keliu To: , , , CC: keliu Subject: [PATCH] most: Directly use ida_alloc()/free() Date: Fri, 27 May 2022 08:33:09 +0000 Message-ID: <20220527083309.2553087-1-liuke94@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemm500018.china.huawei.com (7.185.36.111) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Use ida_alloc()/ida_free() instead of deprecated ida_simple_get()/ida_simple_remove() . Signed-off-by: keliu --- drivers/most/core.c | 10 +++++----- drivers/most/most_cdev.c | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/most/core.c b/drivers/most/core.c index e4412c7d25b0..81d60d4ee8c2 100644 --- a/drivers/most/core.c +++ b/drivers/most/core.c @@ -1286,7 +1286,7 @@ int most_register_interface(struct most_interface *iface) !iface->poison_channel || (iface->num_channels > MAX_CHANNELS)) return -EINVAL; - id = ida_simple_get(&mdev_id, 0, 0, GFP_KERNEL); + id = ida_alloc(&mdev_id, GFP_KERNEL); if (id < 0) { dev_err(iface->dev, "Failed to allocate device ID\n"); return id; @@ -1294,7 +1294,7 @@ int most_register_interface(struct most_interface *iface) iface->p = kzalloc(sizeof(*iface->p), GFP_KERNEL); if (!iface->p) { - ida_simple_remove(&mdev_id, id); + ida_free(&mdev_id, id); return -ENOMEM; } @@ -1308,7 +1308,7 @@ int most_register_interface(struct most_interface *iface) dev_err(iface->dev, "Failed to register interface device\n"); kfree(iface->p); put_device(iface->dev); - ida_simple_remove(&mdev_id, id); + ida_free(&mdev_id, id); return -ENOMEM; } @@ -1366,7 +1366,7 @@ int most_register_interface(struct most_interface *iface) } kfree(iface->p); device_unregister(iface->dev); - ida_simple_remove(&mdev_id, id); + ida_free(&mdev_id, id); return -ENOMEM; } EXPORT_SYMBOL_GPL(most_register_interface); @@ -1397,7 +1397,7 @@ void most_deregister_interface(struct most_interface *iface) device_unregister(&c->dev); } - ida_simple_remove(&mdev_id, iface->p->dev_id); + ida_free(&mdev_id, iface->p->dev_id); kfree(iface->p); device_unregister(iface->dev); } diff --git a/drivers/most/most_cdev.c b/drivers/most/most_cdev.c index 3722f9abd7b9..27913b1c8128 100644 --- a/drivers/most/most_cdev.c +++ b/drivers/most/most_cdev.c @@ -100,7 +100,7 @@ static void destroy_cdev(struct comp_channel *c) static void destroy_channel(struct comp_channel *c) { - ida_simple_remove(&comp.minor_id, MINOR(c->devno)); + ida_free(&comp.minor_id, MINOR(c->devno)); kfifo_free(&c->fifo); kfree(c); } @@ -424,7 +424,7 @@ static int comp_probe(struct most_interface *iface, int channel_id, if (c) return -EEXIST; - current_minor = ida_simple_get(&comp.minor_id, 0, 0, GFP_KERNEL); + current_minor = ida_alloc(&comp.minor_id, GFP_KERNEL); if (current_minor < 0) return current_minor; @@ -471,7 +471,7 @@ static int comp_probe(struct most_interface *iface, int channel_id, err_free_c: kfree(c); err_remove_ida: - ida_simple_remove(&comp.minor_id, current_minor); + ida_free(&comp.minor_id, current_minor); return retval; } -- 2.25.1