Received: by 2002:ac2:464d:0:0:0:0:0 with SMTP id s13csp2002863lfo; Sat, 28 May 2022 13:29:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2kCpIQLtIxI3znbfk1YYOhaxf7ro1EBWwAxh9FJzSdTslHUHKwq32Mqm60OfQJrxOVJB2 X-Received: by 2002:a17:903:124a:b0:154:c7a4:9375 with SMTP id u10-20020a170903124a00b00154c7a49375mr48856515plh.0.1653769741323; Sat, 28 May 2022 13:29:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653769741; cv=none; d=google.com; s=arc-20160816; b=SYAaktdclTLMYnjhB5CxnqwrUx2WXZlG/b1azQ2GcF2nkiHmKupiGqTuEz4ZYb9AW7 xDVycrZBoyWGBAfsOTj6j1ggNkgKRwhhzd39ZVgfXgdmCH9ni7TAIG9ftSXstrhKDLze V/qJwrcVWzRKwzZ6MkRE7btOdZxnsOrYwWHo4DCG1/lZvSsy2Z/yz+/7rFQkJ0xyH6oq GfR1lXjcVZOZSZ1K8BxQBwhXxIMbqWNrG3kcRkEV5NlpbYdZvs/wANNUR95c91i6Cd9d U8IfOOfBKljEIm3j4YgSVT7ISof5fA1jdeQn5h3ItZHObIzMYflH+0lp9BmcftnQnbDZ nu1A== 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=MAGXlkPi0FJdYohBXUNy/fLEL7HdRcwC6Ermk0R+W6o=; b=dxH+U35hfeE4+FQFdnPwuF3vY2t/YEv+gdbSPqQfKH8kJeACR5uPdZBM0LpEnxkM4s zMs/kKIcYUNbG2aXggWwpR2u3ihbigLCLvihVvJ79Jokx3uNGLugpMxcnnuioGNdK25A 5s6QufRw9Z47+gqv8644XXKwF/D1iLn/Elb/2/AsA2NqNWjE6BTq+1ynyMHGvorV8kYA LjGYKyBe0WV55LApBVDzi8In4xpfq7AfM5QBryLpMNYrUdt5ZpN7MUmBLfF7PhhzLq/m f9rbZv12L0aMcoXHW7PFD5s113aepEdgJ4mN+SAKORaJxS5L6o4lf84Flftezt/eZZHa Vwag== 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 e4-20020a17090301c400b001635f934f1csi11108330plh.614.2022.05.28.13.29.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 May 2022 13:29:01 -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 455E81B1F7F; Sat, 28 May 2022 12:38:46 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350834AbiE0KI4 (ORCPT + 99 others); Fri, 27 May 2022 06:08:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350833AbiE0KIw (ORCPT ); Fri, 27 May 2022 06:08:52 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B3DC1271B6; Fri, 27 May 2022 03:08:51 -0700 (PDT) Received: from dggpemm500023.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4L8gTJ13c2zgYFH; Fri, 27 May 2022 18:07:16 +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 18:08:49 +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 18:08:49 +0800 From: keliu To: , , , CC: keliu Subject: [PATCH] media: rc: Directly use ida_free() Date: Fri, 27 May 2022 10:30:17 +0000 Message-ID: <20220527103017.3374446-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: dggems705-chm.china.huawei.com (10.3.19.182) 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/media/rc/lirc_dev.c | 6 +++--- drivers/media/rc/rc-main.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c index 765375bda0c6..6cc8c14cf855 100644 --- a/drivers/media/rc/lirc_dev.c +++ b/drivers/media/rc/lirc_dev.c @@ -715,7 +715,7 @@ int lirc_register(struct rc_dev *dev) const char *rx_type, *tx_type; int err, minor; - minor = ida_simple_get(&lirc_ida, 0, RC_DEV_MAX, GFP_KERNEL); + minor = ida_alloc_max(&lirc_ida, RC_DEV_MAX-1, GFP_KERNEL); if (minor < 0) return minor; @@ -760,7 +760,7 @@ int lirc_register(struct rc_dev *dev) return 0; out_ida: - ida_simple_remove(&lirc_ida, minor); + ida_free(&lirc_ida, minor); return err; } @@ -778,7 +778,7 @@ void lirc_unregister(struct rc_dev *dev) spin_unlock_irqrestore(&dev->lirc_fh_lock, flags); cdev_device_del(&dev->lirc_cdev, &dev->lirc_dev); - ida_simple_remove(&lirc_ida, MINOR(dev->lirc_dev.devt)); + ida_free(&lirc_ida, MINOR(dev->lirc_dev.devt)); } int __init lirc_dev_init(void) diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index b90438a71c80..aff7c8da1e2f 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c @@ -1897,7 +1897,7 @@ int rc_register_device(struct rc_dev *dev) if (!dev) return -EINVAL; - minor = ida_simple_get(&rc_ida, 0, RC_DEV_MAX, GFP_KERNEL); + minor = ida_alloc_max(&rc_ida, RC_DEV_MAX-1, GFP_KERNEL); if (minor < 0) return minor; @@ -1980,7 +1980,7 @@ int rc_register_device(struct rc_dev *dev) out_raw: ir_raw_event_free(dev); out_minor: - ida_simple_remove(&rc_ida, minor); + ida_free(&rc_ida, minor); return rc; } EXPORT_SYMBOL_GPL(rc_register_device); @@ -2040,7 +2040,7 @@ void rc_unregister_device(struct rc_dev *dev) device_del(&dev->dev); - ida_simple_remove(&rc_ida, dev->minor); + ida_free(&rc_ida, dev->minor); if (!dev->managed_alloc) rc_free_device(dev); -- 2.25.1