Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3921346imw; Thu, 7 Jul 2022 09:37:30 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tbT4nRpj7MYPcfaiUv4boYy+qUVMd2tVpJGHVoIBIbaE/6KCwt2PPpiOKkn/UscfLWIEqP X-Received: by 2002:a17:906:9be4:b0:72b:cf9:99d8 with SMTP id de36-20020a1709069be400b0072b0cf999d8mr4455048ejc.747.1657211850755; Thu, 07 Jul 2022 09:37:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657211850; cv=none; d=google.com; s=arc-20160816; b=W+N3dEucwRBToFzmY8Ronmq8kqFkdCGMcs4iBYG7HTjER1dXQjamAoNbezmtzp+J65 IhifXl1iDUw5o5ZYg6Jh7MSTR1yRql1JoWbq9tAZod5vSpVzuJ795x7sfgd5AkG1j28Y 5sENNg++eInYMPMW0THtnqG2Qco0m1qhyaHXX2ZhLUFflzcyqQf2GpsC+N7HqYvhsJQq wUWSoDDLP2cAkUXcENc3RST1BSMkeOpEv7BJ45GiQ8KNJs6vlkoLuDvFe0BA8Ig56GWF 6bQcgY0PzV7/iDH44bOgdxrjFAvcceze1SXi80t9EIil3D43dx7dSycxiMW2ZlaYXZ/S vTsw== 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=cUQOcdlQaoIVUMaZkmHSEJ/cCFQqM2vU8gxKuYgJFRQ=; b=HKXRQilDpL6qr52Tr5Bf+TlqlBp8EMsof1aCrDi1b/pKk4EsG8t3+zps01ypr6pAvG /DeySKVNmu6E0cZBtOp+nDj9RN44fmHW/UHFzQCu9rDLJCZxjze7LqtHSViMdQZRnFxG 7UkU0n9Lt2mP6JamqwkJUVxKw5dEirqwZY28HQgKyBLPt4kAvEmsjtCBeOPk6FCYF4Lo /g7alS93Wlhuz5fHa7FANTpw92NuA+SystGCiFz+8/WRWFQNHe0LQk+/VGgXw0VqJlt0 wWb4DPE/x2sWpNytHWSepmybR8yTI5zzZo45rz6aBPbtyYfR+1yuqQStbxv+zlloZtO0 rmQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SH4PvLTc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i11-20020a05640242cb00b0043aa1a7abf9si147528edc.133.2022.07.07.09.37.06; Thu, 07 Jul 2022 09:37:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SH4PvLTc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235585AbiGGQGw (ORCPT + 99 others); Thu, 7 Jul 2022 12:06:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235526AbiGGQGv (ORCPT ); Thu, 7 Jul 2022 12:06:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC4F5313AA; Thu, 7 Jul 2022 09:06:50 -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 9595BB8229B; Thu, 7 Jul 2022 16:06:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F89FC3411E; Thu, 7 Jul 2022 16:06:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1657210008; bh=oPBwVTVUTBS4gk+6cwOddlL8JaBrmv0EYfh3pizuiGg=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=SH4PvLTcKL4XlgKChSv8Bjzcl7z3/oPrHT5tHUJ1nCC54KKrGZfuY9cGH3OnRXc+a CfPv5ZpHFxJEITwjSndmKooeT6IU1Msw7FaqlBHtM7V5r8tx9l5wAhRby/JnJTFhum SEkdiXlCWeaMYqL1LeNlCFIZVJhx9pTsA0nMP59mVzr9hfGNGD+KwELdmeAJsXL7up xVskuo8JR++AKNy57oqAlE4+qf6CqRfnSryxFmlysFWhwXkjv1w1uQKCjYVBz3H1Za p4CaSap5Q2PmFjnGwFky5oNdcBcgNC61SVL7BMBLEF2Jza3phKLakrO93NlpivhIBL 5o6Vh/nJWAkqQ== Date: Thu, 7 Jul 2022 11:06:46 -0500 From: Bjorn Helgaas To: ira.weiny@intel.com Cc: Dan Williams , Matthew Wilcox , Greg Kroah-Hartman , "Rafael J. Wysocki" , Alison Schofield , Vishal Verma , linux-kernel@vger.kernel.org, linux-cxl@vger.kernel.org, linux-pci@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [RFC PATCH 2/3] pci/doe: Use devm_xa_init() Message-ID: <20220707160646.GA306751@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220705232159.2218958-3-ira.weiny@intel.com> X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Tue, Jul 05, 2022 at 04:21:58PM -0700, ira.weiny@intel.com wrote: > From: Ira Weiny > > The XArray being used to store the protocols does not even store > allocated objects. I guess the point is that the doe_mb->prots XArray doesn't reference any other objects that would need to be freed when destroying doe_mb->prots? A few more words here would make the commit log more useful to non-XArray experts. s|pci/doe|PCI/DOE| in subject to match the drivers/pci convention. > Use devm_xa_init() to automatically destroy the XArray when the PCI > device goes away. > > Signed-off-by: Ira Weiny > --- > drivers/pci/doe.c | 14 ++------------ > 1 file changed, 2 insertions(+), 12 deletions(-) > > diff --git a/drivers/pci/doe.c b/drivers/pci/doe.c > index 0b02f33ef994..aa36f459d375 100644 > --- a/drivers/pci/doe.c > +++ b/drivers/pci/doe.c > @@ -386,13 +386,6 @@ static int pci_doe_cache_protocols(struct pci_doe_mb *doe_mb) > return 0; > } > > -static void pci_doe_xa_destroy(void *mb) > -{ > - struct pci_doe_mb *doe_mb = mb; > - > - xa_destroy(&doe_mb->prots); > -} > - > static void pci_doe_destroy_workqueue(void *mb) > { > struct pci_doe_mb *doe_mb = mb; > @@ -440,11 +433,8 @@ struct pci_doe_mb *pcim_doe_create_mb(struct pci_dev *pdev, u16 cap_offset) > doe_mb->pdev = pdev; > doe_mb->cap_offset = cap_offset; > init_waitqueue_head(&doe_mb->wq); > - > - xa_init(&doe_mb->prots); > - rc = devm_add_action(dev, pci_doe_xa_destroy, doe_mb); > - if (rc) > - return ERR_PTR(rc); > + if (devm_xa_init(dev, &doe_mb->prots)) > + return ERR_PTR(-ENOMEM); > > doe_mb->work_queue = alloc_ordered_workqueue("DOE: [%x]", 0, > doe_mb->cap_offset); > -- > 2.35.3 >