Received: by 2002:ac2:464d:0:0:0:0:0 with SMTP id s13csp1992888lfo; Sat, 28 May 2022 13:01:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxQ2z+NSYaDCti6Eth6YJqarhjGWwkFjY6LznejP0CU3jdnQZu6OsQ34Qm1z4h9a5orDp/O X-Received: by 2002:a05:6a00:1307:b0:50d:b02e:11df with SMTP id j7-20020a056a00130700b0050db02e11dfmr49998866pfu.4.1653768062185; Sat, 28 May 2022 13:01:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653768062; cv=none; d=google.com; s=arc-20160816; b=H9Bh7VKgc+aWW3DegVkj3DoGrp0f5iitdrxSVSU+Xyr3w0E6AV7F+lsw6JuLIuhTWd ry8AwJUYdf8GBqG0/JlBc9xFxXhRMxRQulHnUs8t+N6fn0TBy9pX6FJsTPzU1SQCeCpM va7zAs0jGHV/ho2TA3VXAy4JOkWkm97YF0SH2VlX17xgRHIWH0GAdyHSxGnnxKeh5snI 6xqm3AoOEMY1crYRp5stSvY7NU99JGD/D3ZsweQMAM2DJqonZvmqRRRoMydHLEra6lrd zlT2S6QJK/fq4DRHVfjuhMkZ2TZWfAHPftwrTVzy/eEX/+f3FmJ+ShAL3DUQm9PGzJye DOPQ== 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=dsa2LC7ErVgbLzEAduCGYkfkAxj5Cf+zOxbMJAsmsG8=; b=CpntrRX2dEu7tWpJkAPRt6KrgC+++WJT8WXEdD2YmX95NigDi2eOj3cYjIqF2vavMK Ou7XXY4uPuEZxP1TO4lQLIWe+pWPXeyHenb6VbrJ/12TxtwPmmP+jitxeRjkwLsbWUV+ qMseEvmeUSX4sjK3BJk9h8s+unBA0cIzBnlZYqjOIyQAV/ILWOrTbUqGf5aHPGQxTzxA GLOMw4jJ4qW3/2dY3oHLMVYTSBh54z1XEoJY5RC24ieX768BW2VZ5l1RTCL1w0KnPLj5 XebnzfiaqzUfmAj6Zh50M+cd37hHuwa5LYk1PVMMWG22Crp+zxxnOmy8tDHtPVsXOVcV l/0A== 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 b19-20020a056a000a9300b00505b758c8d8si11080081pfl.12.2022.05.28.13.01.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 May 2022 13:01:02 -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 EF96BDFF4F; Sat, 28 May 2022 12:18:57 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344839AbiE0HPv (ORCPT + 99 others); Fri, 27 May 2022 03:15:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346442AbiE0HPL (ORCPT ); Fri, 27 May 2022 03:15:11 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 593C340A1D; Fri, 27 May 2022 00:15:10 -0700 (PDT) Received: from dggpemm500020.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4L8bcv2V0rzbbtL; Fri, 27 May 2022 15:13:35 +0800 (CST) Received: from dggpemm500018.china.huawei.com (7.185.36.111) by dggpemm500020.china.huawei.com (7.185.36.49) 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:15:08 +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:15:08 +0800 From: keliu To: , , , CC: keliu Subject: [PATCH] rtc: Directly use ida_alloc()/free() Date: Fri, 27 May 2022 07:36:36 +0000 Message-ID: <20220527073636.2474546-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: dggems703-chm.china.huawei.com (10.3.19.180) 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/rtc/class.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c index 3c8eec2218df..e48223c00c67 100644 --- a/drivers/rtc/class.c +++ b/drivers/rtc/class.c @@ -36,7 +36,7 @@ static void rtc_device_release(struct device *dev) cancel_work_sync(&rtc->irqwork); - ida_simple_remove(&rtc_ida, rtc->id); + ida_free(&rtc_ida, rtc->id); mutex_destroy(&rtc->ops_lock); kfree(rtc); } @@ -262,7 +262,7 @@ static int rtc_device_get_id(struct device *dev) } if (id < 0) - id = ida_simple_get(&rtc_ida, 0, 0, GFP_KERNEL); + id = ida_alloc(&rtc_ida, GFP_KERNEL); return id; } @@ -368,7 +368,7 @@ struct rtc_device *devm_rtc_allocate_device(struct device *dev) rtc = rtc_allocate_device(); if (!rtc) { - ida_simple_remove(&rtc_ida, id); + ida_free(&rtc_ida, id); return ERR_PTR(-ENOMEM); } -- 2.25.1