]> git.itanic.dy.fi Git - linux-stable/commit
PCI/DOE: Allow mailbox creation without devres management
authorLukas Wunner <lukas@wunner.de>
Sat, 11 Mar 2023 14:40:11 +0000 (15:40 +0100)
committerDan Williams <dan.j.williams@intel.com>
Tue, 18 Apr 2023 17:36:58 +0000 (10:36 -0700)
commit022b66f38195f6760c193ceee18e0b676d9c9070
treeba11e36f81f6cd24ba5d9ae45fc48c4fd5571ba1
parentc8fc07abeba5cd14e88a2d77f4c4fed670da9492
PCI/DOE: Allow mailbox creation without devres management

DOE mailbox creation is currently only possible through a devres-managed
API.  The lifetime of mailboxes thus ends with driver unbinding.

An upcoming commit will create DOE mailboxes upon device enumeration by
the PCI core.  Their lifetime shall not be limited by a driver.

Therefore rework pcim_doe_create_mb() into the non-devres-managed
pci_doe_create_mb().  Add pci_doe_destroy_mb() for mailbox destruction
on device removal.

Provide a devres-managed wrapper under the existing pcim_doe_create_mb()
name.

The error path of pcim_doe_create_mb() previously called xa_destroy() if
alloc_ordered_workqueue() failed.  That's unnecessary because the xarray
is still empty at that point.  It doesn't need to be destroyed until
it's been populated by pci_doe_cache_protocols().  Arrange the error
path of the new pci_doe_create_mb() accordingly.

pci_doe_cancel_tasks() is no longer used as callback for
devm_add_action(), so refactor it to accept a struct pci_doe_mb pointer
instead of a generic void pointer.

Tested-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Reviewed-by: Ming Li <ming4.li@intel.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://lore.kernel.org/r/7c9a63867d70233c5e9d26cd8bf956742cd6d650.1678543498.git.lukas@wunner.de
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/pci/doe.c