Skip to content

Commit c8fc07a

Browse files
l1kdjbw
authored andcommitted
PCI/DOE: Deduplicate mailbox flushing
When a DOE mailbox is torn down, its workqueue is flushed once in pci_doe_flush_mb() through a call to flush_workqueue() and subsequently flushed once more in pci_doe_destroy_workqueue() through a call to destroy_workqueue(). Deduplicate by dropping flush_workqueue() from pci_doe_flush_mb(). Rename pci_doe_flush_mb() to pci_doe_cancel_tasks() to more aptly describe what it now does. 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/1f009f60b326d1c6d776641d4b20aff27de0c234.1678543498.git.lukas@wunner.de Signed-off-by: Dan Williams <dan.j.williams@intel.com>
1 parent 0821ff8 commit c8fc07a

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

drivers/pci/doe.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ static void pci_doe_destroy_workqueue(void *mb)
429429
destroy_workqueue(doe_mb->work_queue);
430430
}
431431

432-
static void pci_doe_flush_mb(void *mb)
432+
static void pci_doe_cancel_tasks(void *mb)
433433
{
434434
struct pci_doe_mb *doe_mb = mb;
435435

@@ -439,9 +439,6 @@ static void pci_doe_flush_mb(void *mb)
439439
/* Cancel an in progress work item, if necessary */
440440
set_bit(PCI_DOE_FLAG_CANCEL, &doe_mb->flags);
441441
wake_up(&doe_mb->wq);
442-
443-
/* Flush all work items */
444-
flush_workqueue(doe_mb->work_queue);
445442
}
446443

447444
/**
@@ -498,9 +495,9 @@ struct pci_doe_mb *pcim_doe_create_mb(struct pci_dev *pdev, u16 cap_offset)
498495

499496
/*
500497
* The state machine and the mailbox should be in sync now;
501-
* Set up mailbox flush prior to using the mailbox to query protocols.
498+
* Set up cancel tasks prior to using the mailbox to query protocols.
502499
*/
503-
rc = devm_add_action_or_reset(dev, pci_doe_flush_mb, doe_mb);
500+
rc = devm_add_action_or_reset(dev, pci_doe_cancel_tasks, doe_mb);
504501
if (rc)
505502
return ERR_PTR(rc);
506503

0 commit comments

Comments
 (0)