Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2384990ioo; Sat, 28 May 2022 12:00:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzB3PhZpdPUlWQSRDSjtlJCZYxWK3GPu/JVsobgGWRtP5gPM5UPPS2dYgEtDWBEDjFkDpS2 X-Received: by 2002:a63:85c3:0:b0:3fa:ad5e:815 with SMTP id u186-20020a6385c3000000b003faad5e0815mr20593273pgd.624.1653764419872; Sat, 28 May 2022 12:00:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653764419; cv=none; d=google.com; s=arc-20160816; b=c0y6SJ2XxId4dZyJdBVI0H21pf+0rBpkXtcb2E2C31Ud2BzEwscNl72kGfMNCfy+fb teIS6y8Ke7NuJC1swXI9zaIb2M4yq+iV/qW9MHQQqb+UnlrsChvvcvWQBiw7EhrmKHOF kaDOxNz2GZFYHEd2E7skkb4GM/hVu8swAk7ObGaWKoN2oYCdbb/pj5wVst1vpG7+597t P8sBIVJ5HOAlA23adkz2YIG3BuJz9ug32stPbnEKyNMAiKG9gwa2zgKeAvkjfNd1sHPy 3C96UhR/HLEVVPsR+mvJWriglkdPrAIakK1QBaAKyIjxcdvYMwFxrNGyG2ZfXYCgRHu+ nVFA== 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 :message-id:subject:cc:to:from:date:dkim-signature; bh=nTzCf/hH69JbUk5OQD09zRAMAo2EPQUEqmvNls+itlA=; b=A9H9LHRvDEGMqN+Y0ugoq16YCLLMX/TW1B/fsdAo8HV/+1tRQsS0or+ZKsvCxdIHd9 Y2p7GEUz3DgRviJOj+/XlxTJ3XIlYDX/r3pdV3Q+wEel1604MquAtnADfa/af+CwJMg4 ZLGoI6mw6XQ90u05xJY6LRhYqix4t0rpvIoKypDQuwop0xI7uKt8cAn7j5DflApwml0u fpWEZSN/+5uXrzdVaHCYvc6Wav+ssROwp+yYCJNzxfGRbe5sDo1KEXSr8dMI8VE2mxz0 fbSHnQT/MUVKhxyISWncOyOjH3CIvgIamo0W1nxI4G4LONS4vZWn+HTzGZn52Pj+2rh1 aRFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EUJTlgaE; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id l5-20020a654c45000000b003f60333a5dcsi11355500pgr.560.2022.05.28.12.00.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 May 2022 12:00:19 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EUJTlgaE; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 80D1D381AE; Sat, 28 May 2022 11:43:11 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348796AbiE0QmM (ORCPT + 99 others); Fri, 27 May 2022 12:42:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240018AbiE0QmL (ORCPT ); Fri, 27 May 2022 12:42:11 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4417640A23; Fri, 27 May 2022 09:42:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C1D9DB825AE; Fri, 27 May 2022 16:42:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1AD3DC385A9; Fri, 27 May 2022 16:42:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1653669726; bh=zglyA33t8Bhax6x2hK4aQE0hBcZgy78FCZh1HsYWP5k=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=EUJTlgaEE0bBgBJEX1j/V1QiUNB84hN62hWLTUgWBT/GgmTmH4ml4wmqQZ3+ntc2c zj9asOP0cokWrZSFx8ZpFaW+DmK5c19p2/gv3FM4pvCGbGOlSJVXuFARwx+sscy3MF LtFIMeQ0tg2OqnHm181tlZSHBYvZJOq+k8Fae/3TMPi+G8T1h0BbPVW4j+PgcUmgur 5D/Sht8IQ+szcKsdce+wLh7oi90TxpjRwjQscR2tYDbMQlL1LxAncrbyyQAUYJRyrL MXA4XyDDu90ZMgkDKY2CsYDiTQQzkX0qd9vHQI+EtI1JCaUlTj+u0TOjDCyq7MRyUI ti7hwsBE1I92A== Date: Fri, 27 May 2022 11:42:04 -0500 From: Bjorn Helgaas To: keliu Cc: nirmal.patel@linux.intel.com, jonathan.derrick@linux.dev, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, bhelgaas@google.com, kurt.schwemmer@microsemi.com, logang@deltatee.com, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] drivers: pci: Directly use ida_alloc()/free() Message-ID: <20220527164204.GA481720@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220527072005.2360176-1-liuke94@huawei.com> X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 07:20:05AM +0000, keliu wrote: > Use ida_alloc()/ida_free() instead of deprecated > ida_simple_get()/ida_simple_remove() . > > Signed-off-by: keliu I see you got some feedback about a full name already (here's a reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=v5.17#n407) so I'll wait for the update. When you do, please also update the subject line to match previous drivers/pci/ history (use "git log --oneline drivers/pci/" to see it). The patch itself looks good to me. Thanks for doing this! > --- > drivers/pci/controller/vmd.c | 6 +++--- > drivers/pci/switch/switchtec.c | 7 +++---- > 2 files changed, 6 insertions(+), 7 deletions(-) > > diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c > index eb05cceab964..efcb3a3ca65e 100644 > --- a/drivers/pci/controller/vmd.c > +++ b/drivers/pci/controller/vmd.c > @@ -893,7 +893,7 @@ static int vmd_probe(struct pci_dev *dev, const struct pci_device_id *id) > return -ENOMEM; > > vmd->dev = dev; > - vmd->instance = ida_simple_get(&vmd_instance_ida, 0, 0, GFP_KERNEL); > + vmd->instance = ida_alloc(&vmd_instance_ida, GFP_KERNEL); > if (vmd->instance < 0) > return vmd->instance; > > @@ -934,7 +934,7 @@ static int vmd_probe(struct pci_dev *dev, const struct pci_device_id *id) > return 0; > > out_release_instance: > - ida_simple_remove(&vmd_instance_ida, vmd->instance); > + ida_free(&vmd_instance_ida, vmd->instance); > kfree(vmd->name); > return err; > } > @@ -957,7 +957,7 @@ static void vmd_remove(struct pci_dev *dev) > vmd_cleanup_srcu(vmd); > vmd_detach_resources(vmd); > vmd_remove_irq_domain(vmd); > - ida_simple_remove(&vmd_instance_ida, vmd->instance); > + ida_free(&vmd_instance_ida, vmd->instance); > kfree(vmd->name); > } > > diff --git a/drivers/pci/switch/switchtec.c b/drivers/pci/switch/switchtec.c > index c36c1238c604..75be4fe22509 100644 > --- a/drivers/pci/switch/switchtec.c > +++ b/drivers/pci/switch/switchtec.c > @@ -1376,8 +1376,7 @@ static struct switchtec_dev *stdev_create(struct pci_dev *pdev) > dev->groups = switchtec_device_groups; > dev->release = stdev_release; > > - minor = ida_simple_get(&switchtec_minor_ida, 0, 0, > - GFP_KERNEL); > + minor = ida_alloc(&switchtec_minor_ida, GFP_KERNEL); > if (minor < 0) { > rc = minor; > goto err_put; > @@ -1692,7 +1691,7 @@ static int switchtec_pci_probe(struct pci_dev *pdev, > err_devadd: > stdev_kill(stdev); > err_put: > - ida_simple_remove(&switchtec_minor_ida, MINOR(stdev->dev.devt)); > + ida_free(&switchtec_minor_ida, MINOR(stdev->dev.devt)); > put_device(&stdev->dev); > return rc; > } > @@ -1704,7 +1703,7 @@ static void switchtec_pci_remove(struct pci_dev *pdev) > pci_set_drvdata(pdev, NULL); > > cdev_device_del(&stdev->cdev, &stdev->dev); > - ida_simple_remove(&switchtec_minor_ida, MINOR(stdev->dev.devt)); > + ida_free(&switchtec_minor_ida, MINOR(stdev->dev.devt)); > dev_info(&stdev->dev, "unregistered.\n"); > stdev_kill(stdev); > put_device(&stdev->dev); > -- > 2.25.1 >