Commit 23dac55c authored by Zhu Lingshan's avatar Zhu Lingshan Committed by Michael S. Tsirkin

vDPA/ifcvf: decouple config IRQ releaser from the adapter

This commit decouples config IRQ releaser from the adapter,
so that it could be invoked once probe or in err handlers.
ifcvf_free_irq() works on ifcvf_hw in this commit
Signed-off-by: default avatarZhu Lingshan <lingshan.zhu@intel.com>
Cc: stable@vger.kernel.org
Message-Id: <20221125145724.1129962-6-lingshan.zhu@intel.com>
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
parent 004cbcab
...@@ -101,10 +101,9 @@ static void ifcvf_free_vq_irq(struct ifcvf_hw *vf) ...@@ -101,10 +101,9 @@ static void ifcvf_free_vq_irq(struct ifcvf_hw *vf)
ifcvf_free_vqs_reused_irq(vf); ifcvf_free_vqs_reused_irq(vf);
} }
static void ifcvf_free_config_irq(struct ifcvf_adapter *adapter) static void ifcvf_free_config_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->config_irq == -EINVAL) if (vf->config_irq == -EINVAL)
return; return;
...@@ -119,13 +118,12 @@ static void ifcvf_free_config_irq(struct ifcvf_adapter *adapter) ...@@ -119,13 +118,12 @@ 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_hw *vf)
{ {
struct pci_dev *pdev = adapter->pdev; struct pci_dev *pdev = vf->pdev;
struct ifcvf_hw *vf = &adapter->vf;
ifcvf_free_vq_irq(vf); ifcvf_free_vq_irq(vf);
ifcvf_free_config_irq(adapter); ifcvf_free_config_irq(vf);
ifcvf_free_irq_vectors(pdev); ifcvf_free_irq_vectors(pdev);
} }
...@@ -187,7 +185,7 @@ static int ifcvf_request_per_vq_irq(struct ifcvf_adapter *adapter) ...@@ -187,7 +185,7 @@ static int ifcvf_request_per_vq_irq(struct ifcvf_adapter *adapter)
return 0; return 0;
err: err:
ifcvf_free_irq(adapter); ifcvf_free_irq(vf);
return -EFAULT; return -EFAULT;
} }
...@@ -221,7 +219,7 @@ static int ifcvf_request_vqs_reused_irq(struct ifcvf_adapter *adapter) ...@@ -221,7 +219,7 @@ static int ifcvf_request_vqs_reused_irq(struct ifcvf_adapter *adapter)
return 0; return 0;
err: err:
ifcvf_free_irq(adapter); ifcvf_free_irq(vf);
return -EFAULT; return -EFAULT;
} }
...@@ -262,7 +260,7 @@ static int ifcvf_request_dev_irq(struct ifcvf_adapter *adapter) ...@@ -262,7 +260,7 @@ static int ifcvf_request_dev_irq(struct ifcvf_adapter *adapter)
return 0; return 0;
err: err:
ifcvf_free_irq(adapter); ifcvf_free_irq(vf);
return -EFAULT; return -EFAULT;
...@@ -317,7 +315,7 @@ static int ifcvf_request_config_irq(struct ifcvf_adapter *adapter) ...@@ -317,7 +315,7 @@ static int ifcvf_request_config_irq(struct ifcvf_adapter *adapter)
return 0; return 0;
err: err:
ifcvf_free_irq(adapter); ifcvf_free_irq(vf);
return -EFAULT; return -EFAULT;
} }
...@@ -508,7 +506,7 @@ static int ifcvf_vdpa_reset(struct vdpa_device *vdpa_dev) ...@@ -508,7 +506,7 @@ static int ifcvf_vdpa_reset(struct vdpa_device *vdpa_dev)
if (status_old & VIRTIO_CONFIG_S_DRIVER_OK) { if (status_old & VIRTIO_CONFIG_S_DRIVER_OK) {
ifcvf_stop_datapath(adapter); ifcvf_stop_datapath(adapter);
ifcvf_free_irq(adapter); ifcvf_free_irq(vf);
} }
ifcvf_reset_vring(adapter); ifcvf_reset_vring(adapter);
......
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