Commit 004cbcab authored by Zhu Lingshan's avatar Zhu Lingshan Committed by Michael S. Tsirkin

vDPA/ifcvf: decouple vq IRQ releasers from the adapter

This commit decouples the IRQ releasers from the
adapter, so that these functions could be
safely invoked once probe
Signed-off-by: default avatarZhu Lingshan <lingshan.zhu@intel.com>
Cc: stable@vger.kernel.org
Message-Id: <20221125145724.1129962-5-lingshan.zhu@intel.com>
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
parent 66e3970b
...@@ -69,10 +69,9 @@ static void ifcvf_free_irq_vectors(void *data) ...@@ -69,10 +69,9 @@ static void ifcvf_free_irq_vectors(void *data)
pci_free_irq_vectors(data); pci_free_irq_vectors(data);
} }
static void ifcvf_free_per_vq_irq(struct ifcvf_adapter *adapter) static void ifcvf_free_per_vq_irq(struct ifcvf_hw *vf)
{ {
struct pci_dev *pdev = adapter->pdev; struct pci_dev *pdev = vf->pdev;
struct ifcvf_hw *vf = &adapter->vf;
int i; int i;
for (i = 0; i < vf->nr_vring; i++) { for (i = 0; i < vf->nr_vring; i++) {
...@@ -83,10 +82,9 @@ static void ifcvf_free_per_vq_irq(struct ifcvf_adapter *adapter) ...@@ -83,10 +82,9 @@ static void ifcvf_free_per_vq_irq(struct ifcvf_adapter *adapter)
} }
} }
static void ifcvf_free_vqs_reused_irq(struct ifcvf_adapter *adapter) static void ifcvf_free_vqs_reused_irq(struct ifcvf_hw *vf)
{ {
struct pci_dev *pdev = adapter->pdev; struct pci_dev *pdev = vf->pdev;
struct ifcvf_hw *vf = &adapter->vf;
if (vf->vqs_reused_irq != -EINVAL) { if (vf->vqs_reused_irq != -EINVAL) {
devm_free_irq(&pdev->dev, vf->vqs_reused_irq, vf); devm_free_irq(&pdev->dev, vf->vqs_reused_irq, vf);
...@@ -95,14 +93,12 @@ static void ifcvf_free_vqs_reused_irq(struct ifcvf_adapter *adapter) ...@@ -95,14 +93,12 @@ static void ifcvf_free_vqs_reused_irq(struct ifcvf_adapter *adapter)
} }
static void ifcvf_free_vq_irq(struct ifcvf_adapter *adapter) static void ifcvf_free_vq_irq(struct ifcvf_hw *vf)
{ {
struct ifcvf_hw *vf = &adapter->vf;
if (vf->msix_vector_status == MSIX_VECTOR_PER_VQ_AND_CONFIG) if (vf->msix_vector_status == MSIX_VECTOR_PER_VQ_AND_CONFIG)
ifcvf_free_per_vq_irq(adapter); ifcvf_free_per_vq_irq(vf);
else else
ifcvf_free_vqs_reused_irq(adapter); ifcvf_free_vqs_reused_irq(vf);
} }
static void ifcvf_free_config_irq(struct ifcvf_adapter *adapter) static void ifcvf_free_config_irq(struct ifcvf_adapter *adapter)
...@@ -126,8 +122,9 @@ static void ifcvf_free_config_irq(struct ifcvf_adapter *adapter) ...@@ -126,8 +122,9 @@ static void ifcvf_free_config_irq(struct ifcvf_adapter *adapter)
static void ifcvf_free_irq(struct ifcvf_adapter *adapter) static void ifcvf_free_irq(struct ifcvf_adapter *adapter)
{ {
struct pci_dev *pdev = adapter->pdev; struct pci_dev *pdev = adapter->pdev;
struct ifcvf_hw *vf = &adapter->vf;
ifcvf_free_vq_irq(adapter); ifcvf_free_vq_irq(vf);
ifcvf_free_config_irq(adapter); ifcvf_free_config_irq(adapter);
ifcvf_free_irq_vectors(pdev); ifcvf_free_irq_vectors(pdev);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment