Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2392972ioo; Sat, 28 May 2022 12:13:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzXA9bYhol+zdYo0jUirGju4wXI2FWu/zIUuZPgeVbkTOgf5PGa2YH1EXqj0zLJIcK7yWKK X-Received: by 2002:a17:90b:4ac9:b0:1e0:ce14:20dd with SMTP id mh9-20020a17090b4ac900b001e0ce1420ddmr14894518pjb.198.1653765184717; Sat, 28 May 2022 12:13:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653765184; cv=none; d=google.com; s=arc-20160816; b=O9Jo6DO7XgL0OqwHl+L0Kme/0Bf19FBoNqo4UQv8qJa9e5omkKeKUCmxkJsyIq7Pyf qJf2h4D2xg7Qw7x3RK0WKDuYwqETt6h65di0N8ffarGcXAynyzqA7yl7x2XyVsRpC7iR HXQ/fuuMWj3nnhhNLJo3ii5duuELXyql6Z/Mx1Uzl1MigRZQ1ZAaXj2s5FKNP2GUyQIe mfMGfltpCr3Jw02khrZt9EzZcMfJ8xweFSrs1HjkEjSEaw50zsFELT/nDwaiw1FdcVG+ H74Y1sgmTd9SSs4kWbJiJKqFwo4EUKk0bg+deqlA5Su3+9m5MXXwxLHfFjck5wCo7wK0 c5+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=bPzJnABJnYBEykQeQ1JfG9H4YQIJYbiXATIKu1oXOuk=; b=XhloHg+IPAT6riGMe8X3JoVmWfcsyegGSQNLGDfFVPcgc4xJ0c2ZNaN5UXBsP7WSms ww4ohDcaNkkaMnBDbWDTtStXTWxBBIwnmRFzot1A7JkmV/mwe6RJm8KyeclRtmOcpkPT DXA16wy7wgTjndK39soJ7NC3sEhWH/UKJlV7B8vI/k09AC7E96ndWFhFoTtu38C6xHP7 990H2TbCEl0pn9yE0MCQg8qSXoDshNUK/JNzr4at5CBRKZLNENU6L2A+iB6kM89PwU8f A95YDNcNuKrMfFyg4PshUsvUIrN+EdUpGKsTCzqAor1yJk2WFmV5Xwrkq1B37yh299Jd 4Kjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=dzM+wr1T; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id j14-20020a170903024e00b0016229a39343si11144683plh.115.2022.05.28.12.13.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 May 2022 12:13:04 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=dzM+wr1T; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 11F44434B9; Sat, 28 May 2022 11:49:05 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238088AbiE1Pvo (ORCPT + 99 others); Sat, 28 May 2022 11:51:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238043AbiE1Pvm (ORCPT ); Sat, 28 May 2022 11:51:42 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 472F3F6A; Sat, 28 May 2022 08:51:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1653753101; x=1685289101; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=CFrbHpnVeSUfFa9hJ0kyjcpJ28gU4L6TqI/eG/r0hJA=; b=dzM+wr1ThCWZtYmmVslzboWTvpDpZQprAz4VGSwl5N50fwQd7hmpV3gR NcZ5CYFu23xY+Yyx3+CnHgAEaCvrxX8tJiLSEUfq71g0NbIZ8SybeDQKL l3DXcLn9h9jTFHf90mNy9IzRtOOFZDBDYDnlPsoBWqIwfPV0yClYnGMA4 3GodGzLwAPHLMU93xYhEh0LEfC0p1b9+R+JfThjMy1L3jt9RrEE7Vk59G uChjsL5hhayFSt6keShktRBQLQHW3uSD3EmAkQYlWCtk+Meb2Uh48y/JA TCEgyVJ1i6PaJTswC5JY8t59VB35IdgPE8YBGpw/0xJIU6keNUQhcsFLz w==; X-IronPort-AV: E=McAfee;i="6400,9594,10361"; a="272257542" X-IronPort-AV: E=Sophos;i="5.91,258,1647327600"; d="scan'208";a="272257542" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 May 2022 08:51:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,258,1647327600"; d="scan'208";a="604441656" Received: from yilunxu-optiplex-7050.sh.intel.com (HELO localhost) ([10.239.159.135]) by orsmga008.jf.intel.com with ESMTP; 28 May 2022 08:51:38 -0700 Date: Sat, 28 May 2022 23:43:55 +0800 From: Xu Yilun To: keliu Cc: hao.wu@intel.com, trix@redhat.com, mdf@kernel.org, linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] fpga: Directly use ida_alloc()/free() Message-ID: <20220528154355.GA183426@yilunxu-OptiPlex-7050> References: <20220527085915.2798928-1-liuke94@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220527085915.2798928-1-liuke94@huawei.com> X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 On Fri, May 27, 2022 at 08:59:15AM +0000, keliu wrote: > Use ida_alloc()/ida_free() instead of deprecated > ida_simple_get()/ida_simple_remove() . > > Signed-off-by: keliu Acked-by: Xu Yilun > --- > drivers/fpga/dfl.c | 4 ++-- > drivers/fpga/fpga-bridge.c | 6 +++--- > drivers/fpga/fpga-mgr.c | 6 +++--- > drivers/fpga/fpga-region.c | 6 +++--- > 4 files changed, 11 insertions(+), 11 deletions(-) > > diff --git a/drivers/fpga/dfl.c b/drivers/fpga/dfl.c > index 599bb21d86af..2dff0c626cc6 100644 > --- a/drivers/fpga/dfl.c > +++ b/drivers/fpga/dfl.c > @@ -342,7 +342,7 @@ static void release_dfl_dev(struct device *dev) > if (ddev->mmio_res.parent) > release_resource(&ddev->mmio_res); > > - ida_simple_remove(&dfl_device_ida, ddev->id); > + ida_free(&dfl_device_ida, ddev->id); > kfree(ddev->irqs); > kfree(ddev); > } > @@ -360,7 +360,7 @@ dfl_dev_add(struct dfl_feature_platform_data *pdata, > if (!ddev) > return ERR_PTR(-ENOMEM); > > - id = ida_simple_get(&dfl_device_ida, 0, 0, GFP_KERNEL); > + id = ida_alloc(&dfl_device_ida, GFP_KERNEL); > if (id < 0) { > dev_err(&pdev->dev, "unable to get id\n"); > kfree(ddev); > diff --git a/drivers/fpga/fpga-bridge.c b/drivers/fpga/fpga-bridge.c > index 16f2b164a178..727704431f61 100644 > --- a/drivers/fpga/fpga-bridge.c > +++ b/drivers/fpga/fpga-bridge.c > @@ -342,7 +342,7 @@ fpga_bridge_register(struct device *parent, const char *name, > if (!bridge) > return ERR_PTR(-ENOMEM); > > - id = ida_simple_get(&fpga_bridge_ida, 0, 0, GFP_KERNEL); > + id = ida_alloc(&fpga_bridge_ida, GFP_KERNEL); > if (id < 0) { > ret = id; > goto error_kfree; > @@ -375,7 +375,7 @@ fpga_bridge_register(struct device *parent, const char *name, > return bridge; > > error_device: > - ida_simple_remove(&fpga_bridge_ida, id); > + ida_free(&fpga_bridge_ida, id); > error_kfree: > kfree(bridge); > > @@ -407,7 +407,7 @@ static void fpga_bridge_dev_release(struct device *dev) > { > struct fpga_bridge *bridge = to_fpga_bridge(dev); > > - ida_simple_remove(&fpga_bridge_ida, bridge->dev.id); > + ida_free(&fpga_bridge_ida, bridge->dev.id); > kfree(bridge); > } > > diff --git a/drivers/fpga/fpga-mgr.c b/drivers/fpga/fpga-mgr.c > index d49a9ce34568..2955a21beebe 100644 > --- a/drivers/fpga/fpga-mgr.c > +++ b/drivers/fpga/fpga-mgr.c > @@ -622,7 +622,7 @@ fpga_mgr_register_full(struct device *parent, const struct fpga_manager_info *in > if (!mgr) > return ERR_PTR(-ENOMEM); > > - id = ida_simple_get(&fpga_mgr_ida, 0, 0, GFP_KERNEL); > + id = ida_alloc(&fpga_mgr_ida, GFP_KERNEL); > if (id < 0) { > ret = id; > goto error_kfree; > @@ -661,7 +661,7 @@ fpga_mgr_register_full(struct device *parent, const struct fpga_manager_info *in > return mgr; > > error_device: > - ida_simple_remove(&fpga_mgr_ida, id); > + ida_free(&fpga_mgr_ida, id); > error_kfree: > kfree(mgr); > > @@ -785,7 +785,7 @@ static void fpga_mgr_dev_release(struct device *dev) > { > struct fpga_manager *mgr = to_fpga_manager(dev); > > - ida_simple_remove(&fpga_mgr_ida, mgr->dev.id); > + ida_free(&fpga_mgr_ida, mgr->dev.id); > kfree(mgr); > } > > diff --git a/drivers/fpga/fpga-region.c b/drivers/fpga/fpga-region.c > index b0ac18de4885..18bcaa1926dd 100644 > --- a/drivers/fpga/fpga-region.c > +++ b/drivers/fpga/fpga-region.c > @@ -202,7 +202,7 @@ fpga_region_register_full(struct device *parent, const struct fpga_region_info * > if (!region) > return ERR_PTR(-ENOMEM); > > - id = ida_simple_get(&fpga_region_ida, 0, 0, GFP_KERNEL); > + id = ida_alloc(&fpga_region_ida, GFP_KERNEL); > if (id < 0) { > ret = id; > goto err_free; > @@ -234,7 +234,7 @@ fpga_region_register_full(struct device *parent, const struct fpga_region_info * > return region; > > err_remove: > - ida_simple_remove(&fpga_region_ida, id); > + ida_free(&fpga_region_ida, id); > err_free: > kfree(region); > > @@ -283,7 +283,7 @@ static void fpga_region_dev_release(struct device *dev) > { > struct fpga_region *region = to_fpga_region(dev); > > - ida_simple_remove(&fpga_region_ida, region->dev.id); > + ida_free(&fpga_region_ida, region->dev.id); > kfree(region); > } > > -- > 2.25.1