Received: by 2002:ac2:464d:0:0:0:0:0 with SMTP id s13csp1994594lfo; Sat, 28 May 2022 13:04:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxsOZjurq2k4qOrQ6VF9O35HUDJR1QO8nokFElVyWA74pTiBMzwLFkHJAcPYsP5CPHc2Qs X-Received: by 2002:a17:90a:4fc7:b0:1df:9b7b:e610 with SMTP id q65-20020a17090a4fc700b001df9b7be610mr14956764pjh.177.1653768257394; Sat, 28 May 2022 13:04:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653768257; cv=none; d=google.com; s=arc-20160816; b=BHIi7PWsjcGpU0RApTr69sfuqjt2aZ/yMJKaKvxuHDt0bBOw/axBQ7EQWWgqglnsDY jt0ClrW8vMe6Rk4m7vgTmKCUiqwwmWsWPPjo1jKBj4LrhaD3zoNeu2EWU8QZxHSbwx4B 1TEJXeJfAfKCh67/pSb+8BeNqnVDEX7sWY5kcbmplN5rJCuUlfip5MMT9VPM9pPcb503 NYAAEGw0driqxMzvg4o7TIYylhp+1kfb/hQujkiFO+li52XQPssrhzinqpLG4w6e7xrc uktnQNt5UQCBNU9I+OV6271Gpl++wF2/NDW9B3nXINGTpry/f1Qku9HypsPyTZEBszfx T8Ew== 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=xfCE533n8ZgZ3Pcmc2Gw2+tCicO4j5htlRhuCHNuxQM=; b=m3LEE0KSRYPHPXcpe38+eh9KTCqBaJA61xpqUiMUYtMFXntaRfBH2Kso20upSqw4RM LsgHRoBszBK8fDs9q6PFzM+oUTFV3BLAajdgADm0JNqa0x5iuKeXaUviSCFuOWaTCOOC DBKbAzsSX/g4FCe56RZM4mPSwqErPvcPG//veUzN9Nl4b4YeimUNMEAw9pxBalQQ6HVa 8L7UbL9R5qZkqFlLY9hpqUPV59u+dw2o75v1posHyk9lubnF2Qs3lwrBmdymw61mzujC 8aNG9ERPKZgiLwEiiIwCwahQLl/7O2M5+ho1FtaOAvEZgFBbxUvOhQlq+vaUmjMK82uZ M7ZA== 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:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id s10-20020a6550ca000000b003c1dc83e6b6si10678428pgp.317.2022.05.28.13.04.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 May 2022 13:04:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B0A041078B9; Sat, 28 May 2022 12:21:10 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241086AbiE0HN0 (ORCPT + 99 others); Fri, 27 May 2022 03:13:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232415AbiE0HNW (ORCPT ); Fri, 27 May 2022 03:13:22 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 090B0B7ED; Fri, 27 May 2022 00:13:21 -0700 (PDT) Received: from dggpemm500023.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4L8bZm75p1zbc2f; Fri, 27 May 2022 15:11:44 +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 15:13:18 +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 15:13:17 +0800 From: keliu To: , , , , , CC: keliu Subject: [PATCH] thermal: Directly use ida_alloc()/free() Date: Fri, 27 May 2022 07:34:45 +0000 Message-ID: <20220527073445.2474380-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: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm500018.china.huawei.com (7.185.36.111) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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/thermal/thermal_core.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 82654dc8382b..b36c348a110b 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -667,7 +667,7 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz, dev->target = THERMAL_NO_TARGET; dev->weight = weight; - result = ida_simple_get(&tz->ida, 0, 0, GFP_KERNEL); + result = ida_alloc(&tz->ida, GFP_KERNEL); if (result < 0) goto free_mem; @@ -721,7 +721,7 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz, remove_symbol_link: sysfs_remove_link(&tz->device.kobj, dev->name); release_ida: - ida_simple_remove(&tz->ida, dev->id); + ida_free(&tz->ida, dev->id); free_mem: kfree(dev); return result; @@ -768,7 +768,7 @@ int thermal_zone_unbind_cooling_device(struct thermal_zone_device *tz, device_remove_file(&tz->device, &pos->weight_attr); device_remove_file(&tz->device, &pos->attr); sysfs_remove_link(&tz->device.kobj, pos->name); - ida_simple_remove(&tz->ida, pos->id); + ida_free(&tz->ida, pos->id); kfree(pos); return 0; } @@ -901,7 +901,7 @@ __thermal_cooling_device_register(struct device_node *np, if (!cdev) return ERR_PTR(-ENOMEM); - ret = ida_simple_get(&thermal_cdev_ida, 0, 0, GFP_KERNEL); + ret = ida_alloc(&thermal_cdev_ida, GFP_KERNEL); if (ret < 0) goto out_kfree_cdev; cdev->id = ret; @@ -951,7 +951,7 @@ __thermal_cooling_device_register(struct device_node *np, put_device(&cdev->device); cdev = NULL; out_ida_remove: - ida_simple_remove(&thermal_cdev_ida, id); + ida_free(&thermal_cdev_ida, id); out_kfree_cdev: kfree(cdev); return ERR_PTR(ret); @@ -1110,7 +1110,7 @@ void thermal_cooling_device_unregister(struct thermal_cooling_device *cdev) mutex_unlock(&thermal_list_lock); - ida_simple_remove(&thermal_cdev_ida, cdev->id); + ida_free(&thermal_cdev_ida, cdev->id); device_del(&cdev->device); thermal_cooling_device_destroy_sysfs(cdev); kfree(cdev->type); @@ -1227,7 +1227,7 @@ thermal_zone_device_register(const char *type, int trips, int mask, INIT_LIST_HEAD(&tz->thermal_instances); ida_init(&tz->ida); mutex_init(&tz->lock); - id = ida_simple_get(&thermal_tz_ida, 0, 0, GFP_KERNEL); + id = ida_alloc(&thermal_tz_ida, GFP_KERNEL); if (id < 0) { result = id; goto free_tz; @@ -1318,7 +1318,7 @@ thermal_zone_device_register(const char *type, int trips, int mask, put_device(&tz->device); tz = NULL; remove_id: - ida_simple_remove(&thermal_tz_ida, id); + ida_free(&thermal_tz_ida, id); free_tz: kfree(tz); return ERR_PTR(result); @@ -1378,7 +1378,7 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz) thermal_set_governor(tz, NULL); thermal_remove_hwmon_sysfs(tz); - ida_simple_remove(&thermal_tz_ida, tz->id); + ida_free(&thermal_tz_ida, tz->id); ida_destroy(&tz->ida); mutex_destroy(&tz->lock); device_unregister(&tz->device); -- 2.25.1