From: Bjorn Helgaas <helgaas@kernel.org>
To: ira.weiny@intel.com
Cc: Dan Williams <dan.j.williams@intel.com>,
Matthew Wilcox <willy@infradead.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Alison Schofield <alison.schofield@intel.com>,
Vishal Verma <vishal.l.verma@intel.com>,
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()
Date: Thu, 7 Jul 2022 11:06:46 -0500 [thread overview]
Message-ID: <20220707160646.GA306751@bhelgaas> (raw)
In-Reply-To: <20220705232159.2218958-3-ira.weiny@intel.com>
On Tue, Jul 05, 2022 at 04:21:58PM -0700, ira.weiny@intel.com wrote:
> From: Ira Weiny <ira.weiny@intel.com>
>
> 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 <ira.weiny@intel.com>
> ---
> 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
>
next prev parent reply other threads:[~2022-07-07 16:06 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-05 23:21 [RFC PATCH 0/3] Introduce devm_xa_init ira.weiny
2022-07-05 23:21 ` [RFC PATCH 1/3] xarray: Introduce devm_xa_init() ira.weiny
2022-07-07 16:10 ` Bjorn Helgaas
2022-07-08 14:51 ` Ira Weiny
2022-07-08 14:53 ` Matthew Wilcox
2022-07-08 14:59 ` Ira Weiny
2022-07-08 15:21 ` Matthew Wilcox
2022-07-14 15:44 ` Dan Williams
2022-07-14 16:02 ` Ira Weiny
2022-07-05 23:21 ` [RFC PATCH 2/3] pci/doe: Use devm_xa_init() ira.weiny
2022-07-07 16:06 ` Bjorn Helgaas [this message]
2022-07-08 14:45 ` Ira Weiny
2022-07-08 14:49 ` Matthew Wilcox
2022-07-08 14:57 ` Ira Weiny
2022-07-08 15:04 ` Matthew Wilcox
2022-07-08 15:49 ` Ira Weiny
2022-07-05 23:21 ` [RFC PATCH 3/3] CXL/doe: " ira.weiny
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220707160646.GA306751@bhelgaas \
--to=helgaas@kernel.org \
--cc=alison.schofield@intel.com \
--cc=dan.j.williams@intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=ira.weiny@intel.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=vishal.l.verma@intel.com \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).