[PATCH v2 2/2] hw/pci/pcie: Replace PCI_DEVICE() casts with existing variable

Julia Suvorova posted 2 patches 5 years, 5 months ago
Maintainers: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, "Michael S. Tsirkin" <mst@redhat.com>
[PATCH v2 2/2] hw/pci/pcie: Replace PCI_DEVICE() casts with existing variable
Posted by Julia Suvorova 5 years, 5 months ago
A little cleanup is possible because of hotplug_pdev introduction.

Signed-off-by: Julia Suvorova <jusual@redhat.com>
---
 hw/pci/pcie.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c
index 6b48d04d2c..abc99b6eff 100644
--- a/hw/pci/pcie.c
+++ b/hw/pci/pcie.c
@@ -449,7 +449,7 @@ void pcie_cap_slot_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
             pci_word_test_and_set_mask(exp_cap + PCI_EXP_LNKSTA,
                                        PCI_EXP_LNKSTA_DLLLA);
         }
-        pcie_cap_slot_event(PCI_DEVICE(hotplug_dev),
+        pcie_cap_slot_event(hotplug_pdev,
                             PCI_EXP_HP_EV_PDC | PCI_EXP_HP_EV_ABP);
     }
 }
@@ -490,7 +490,7 @@ void pcie_cap_slot_unplug_request_cb(HotplugHandler *hotplug_dev,
         return;
     }
 
-    pcie_cap_slot_plug_common(PCI_DEVICE(hotplug_dev), dev, &local_err);
+    pcie_cap_slot_plug_common(hotplug_pdev, dev, &local_err);
     if (local_err) {
         error_propagate(errp, local_err);
         return;
@@ -509,7 +509,7 @@ void pcie_cap_slot_unplug_request_cb(HotplugHandler *hotplug_dev,
         return;
     }
 
-    pcie_cap_slot_push_attention_button(PCI_DEVICE(hotplug_dev));
+    pcie_cap_slot_push_attention_button(hotplug_pdev);
 }
 
 /* pci express slot for pci express root/downstream port
-- 
2.25.3


Re: [PATCH v2 2/2] hw/pci/pcie: Replace PCI_DEVICE() casts with existing variable
Posted by Marcel Apfelbaum 5 years, 4 months ago

On 4/27/20 9:24 PM, Julia Suvorova wrote:
> A little cleanup is possible because of hotplug_pdev introduction.
>
> Signed-off-by: Julia Suvorova <jusual@redhat.com>
> ---
>   hw/pci/pcie.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c
> index 6b48d04d2c..abc99b6eff 100644
> --- a/hw/pci/pcie.c
> +++ b/hw/pci/pcie.c
> @@ -449,7 +449,7 @@ void pcie_cap_slot_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
>               pci_word_test_and_set_mask(exp_cap + PCI_EXP_LNKSTA,
>                                          PCI_EXP_LNKSTA_DLLLA);
>           }
> -        pcie_cap_slot_event(PCI_DEVICE(hotplug_dev),
> +        pcie_cap_slot_event(hotplug_pdev,
>                               PCI_EXP_HP_EV_PDC | PCI_EXP_HP_EV_ABP);
>       }
>   }
> @@ -490,7 +490,7 @@ void pcie_cap_slot_unplug_request_cb(HotplugHandler *hotplug_dev,
>           return;
>       }
>   
> -    pcie_cap_slot_plug_common(PCI_DEVICE(hotplug_dev), dev, &local_err);
> +    pcie_cap_slot_plug_common(hotplug_pdev, dev, &local_err);
>       if (local_err) {
>           error_propagate(errp, local_err);
>           return;
> @@ -509,7 +509,7 @@ void pcie_cap_slot_unplug_request_cb(HotplugHandler *hotplug_dev,
>           return;
>       }
>   
> -    pcie_cap_slot_push_attention_button(PCI_DEVICE(hotplug_dev));
> +    pcie_cap_slot_push_attention_button(hotplug_pdev);
>   }
>   
>   /* pci express slot for pci express root/downstream port

Reviewed-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>

Thanks,
Marcel