Patchwork [2/3] pci: export pci_unplug_device

login
register
mail settings
Submitter Stefano Stabellini
Date June 16, 2011, 4:05 p.m.
Message ID <1308240319-13949-2-git-send-email-stefano.stabellini@eu.citrix.com>
Download mbox | patch
Permalink /patch/100674/
State New
Headers show

Comments

Stefano Stabellini - June 16, 2011, 4:05 p.m.
From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

pci_unplug_device is needed by the xen_platform device to perfom dynamic
nic unplug.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 hw/pci.c |    2 +-
 hw/pci.h |    1 +
 2 files changed, 2 insertions(+), 1 deletions(-)
Michael S. Tsirkin - June 20, 2011, 8:48 a.m.
On Thu, Jun 16, 2011 at 05:05:18PM +0100, stefano.stabellini@eu.citrix.com wrote:
> From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> 
> pci_unplug_device is needed by the xen_platform device to perfom dynamic
> nic unplug.
> 
> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

I think it's better to go through qdev, pci_unplug_device
was intended as an internal API.

> ---
>  hw/pci.c |    2 +-
>  hw/pci.h |    1 +
>  2 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/hw/pci.c b/hw/pci.c
> index 1d297d6..679e976 100644
> --- a/hw/pci.c
> +++ b/hw/pci.c
> @@ -1692,7 +1692,7 @@ static int pci_qdev_init(DeviceState *qdev, DeviceInfo *base)
>      return 0;
>  }
>  
> -static int pci_unplug_device(DeviceState *qdev)
> +int pci_unplug_device(DeviceState *qdev)
>  {
>      PCIDevice *dev = DO_UPCAST(PCIDevice, qdev, qdev);
>      PCIDeviceInfo *info = container_of(qdev->info, PCIDeviceInfo, qdev);
> diff --git a/hw/pci.h b/hw/pci.h
> index 0d288ce..868f793 100644
> --- a/hw/pci.h
> +++ b/hw/pci.h
> @@ -452,6 +452,7 @@ typedef struct {
>  
>  void pci_qdev_register(PCIDeviceInfo *info);
>  void pci_qdev_register_many(PCIDeviceInfo *info);
> +int pci_unplug_device(DeviceState *qdev);
>  
>  PCIDevice *pci_create_multifunction(PCIBus *bus, int devfn, bool multifunction,
>                                      const char *name);
> -- 
> 1.7.2.3
>
Stefano Stabellini - June 23, 2011, 1:12 p.m.
On Mon, 20 Jun 2011, Michael S. Tsirkin wrote:
> On Thu, Jun 16, 2011 at 05:05:18PM +0100, stefano.stabellini@eu.citrix.com wrote:
> > From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> > 
> > pci_unplug_device is needed by the xen_platform device to perfom dynamic
> > nic unplug.
> > 
> > Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> 
> I think it's better to go through qdev, pci_unplug_device
> was intended as an internal API.

You mean qdev_unplug? Sure, I'll use that instead and drop this patch.

Patch

diff --git a/hw/pci.c b/hw/pci.c
index 1d297d6..679e976 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -1692,7 +1692,7 @@  static int pci_qdev_init(DeviceState *qdev, DeviceInfo *base)
     return 0;
 }
 
-static int pci_unplug_device(DeviceState *qdev)
+int pci_unplug_device(DeviceState *qdev)
 {
     PCIDevice *dev = DO_UPCAST(PCIDevice, qdev, qdev);
     PCIDeviceInfo *info = container_of(qdev->info, PCIDeviceInfo, qdev);
diff --git a/hw/pci.h b/hw/pci.h
index 0d288ce..868f793 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -452,6 +452,7 @@  typedef struct {
 
 void pci_qdev_register(PCIDeviceInfo *info);
 void pci_qdev_register_many(PCIDeviceInfo *info);
+int pci_unplug_device(DeviceState *qdev);
 
 PCIDevice *pci_create_multifunction(PCIBus *bus, int devfn, bool multifunction,
                                     const char *name);