On 2/11/2023 4:25 AM, Lukas Wunner wrote: > 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@xxxxxxxxx> > Signed-off-by: Lukas Wunner <lukas@xxxxxxxxx> Reviewed-by: Ming Li <ming4.li@xxxxxxxxx>