* [Qemu-devel] [PATCH] pci hotplug: make pci hotplug return value to caller.
@ 2010-06-15 3:47 Isaku Yamahata
2010-06-15 8:55 ` [Qemu-devel] " Gerd Hoffmann
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Isaku Yamahata @ 2010-06-15 3:47 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann, Michael S. Tsirkin
Make pci hotplug callback return value to caller.
There is no reason to discard return value.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
hw/pci.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/hw/pci.c b/hw/pci.c
index 7787005..3777c1c 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -1623,8 +1623,12 @@ static int pci_qdev_init(DeviceState *qdev, DeviceInfo *base)
pci_dev->romfile = qemu_strdup(info->romfile);
pci_add_option_rom(pci_dev);
- if (qdev->hotplugged)
- bus->hotplug(bus->hotplug_qdev, pci_dev, 1);
+ if (qdev->hotplugged) {
+ rc = bus->hotplug(bus->hotplug_qdev, pci_dev, 1);
+ if (rc != 0) {
+ return rc;
+ }
+ }
return 0;
}
@@ -1632,8 +1636,7 @@ static int pci_unplug_device(DeviceState *qdev)
{
PCIDevice *dev = DO_UPCAST(PCIDevice, qdev, qdev);
- dev->bus->hotplug(dev->bus->hotplug_qdev, dev, 0);
- return 0;
+ return dev->bus->hotplug(dev->bus->hotplug_qdev, dev, 0);
}
void pci_qdev_register(PCIDeviceInfo *info)
--
1.6.6.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Qemu-devel] Re: [PATCH] pci hotplug: make pci hotplug return value to caller.
2010-06-15 3:47 [Qemu-devel] [PATCH] pci hotplug: make pci hotplug return value to caller Isaku Yamahata
@ 2010-06-15 8:55 ` Gerd Hoffmann
2010-06-21 9:53 ` [Qemu-devel] " Isaku Yamahata
2010-06-21 11:40 ` [Qemu-devel] " Michael S. Tsirkin
2 siblings, 0 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2010-06-15 8:55 UTC (permalink / raw)
To: Isaku Yamahata; +Cc: qemu-devel, Michael S. Tsirkin
On 06/15/10 05:47, Isaku Yamahata wrote:
> Make pci hotplug callback return value to caller.
> There is no reason to discard return value.
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
cheers,
Gerd
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] pci hotplug: make pci hotplug return value to caller.
2010-06-15 3:47 [Qemu-devel] [PATCH] pci hotplug: make pci hotplug return value to caller Isaku Yamahata
2010-06-15 8:55 ` [Qemu-devel] " Gerd Hoffmann
@ 2010-06-21 9:53 ` Isaku Yamahata
2010-06-21 11:40 ` [Qemu-devel] " Michael S. Tsirkin
2 siblings, 0 replies; 5+ messages in thread
From: Isaku Yamahata @ 2010-06-21 9:53 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann, Michael S. Tsirkin
Ping.
Michael, is there any issues to address?
On Tue, Jun 15, 2010 at 12:47:27PM +0900, Isaku Yamahata wrote:
> Make pci hotplug callback return value to caller.
> There is no reason to discard return value.
>
> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
> ---
> hw/pci.c | 11 +++++++----
> 1 files changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/hw/pci.c b/hw/pci.c
> index 7787005..3777c1c 100644
> --- a/hw/pci.c
> +++ b/hw/pci.c
> @@ -1623,8 +1623,12 @@ static int pci_qdev_init(DeviceState *qdev, DeviceInfo *base)
> pci_dev->romfile = qemu_strdup(info->romfile);
> pci_add_option_rom(pci_dev);
>
> - if (qdev->hotplugged)
> - bus->hotplug(bus->hotplug_qdev, pci_dev, 1);
> + if (qdev->hotplugged) {
> + rc = bus->hotplug(bus->hotplug_qdev, pci_dev, 1);
> + if (rc != 0) {
> + return rc;
> + }
> + }
> return 0;
> }
>
> @@ -1632,8 +1636,7 @@ static int pci_unplug_device(DeviceState *qdev)
> {
> PCIDevice *dev = DO_UPCAST(PCIDevice, qdev, qdev);
>
> - dev->bus->hotplug(dev->bus->hotplug_qdev, dev, 0);
> - return 0;
> + return dev->bus->hotplug(dev->bus->hotplug_qdev, dev, 0);
> }
>
> void pci_qdev_register(PCIDeviceInfo *info)
> --
> 1.6.6.1
>
>
>
--
yamahata
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Qemu-devel] Re: [PATCH] pci hotplug: make pci hotplug return value to caller.
2010-06-15 3:47 [Qemu-devel] [PATCH] pci hotplug: make pci hotplug return value to caller Isaku Yamahata
2010-06-15 8:55 ` [Qemu-devel] " Gerd Hoffmann
2010-06-21 9:53 ` [Qemu-devel] " Isaku Yamahata
@ 2010-06-21 11:40 ` Michael S. Tsirkin
2010-06-21 12:31 ` Isaku Yamahata
2 siblings, 1 reply; 5+ messages in thread
From: Michael S. Tsirkin @ 2010-06-21 11:40 UTC (permalink / raw)
To: Isaku Yamahata; +Cc: qemu-devel, Gerd Hoffmann
On Tue, Jun 15, 2010 at 12:47:27PM +0900, Isaku Yamahata wrote:
> Make pci hotplug callback return value to caller.
> There is no reason to discard return value.
>
> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
> ---
> hw/pci.c | 11 +++++++----
> 1 files changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/hw/pci.c b/hw/pci.c
> index 7787005..3777c1c 100644
> --- a/hw/pci.c
> +++ b/hw/pci.c
> @@ -1623,8 +1623,12 @@ static int pci_qdev_init(DeviceState *qdev, DeviceInfo *base)
> pci_dev->romfile = qemu_strdup(info->romfile);
> pci_add_option_rom(pci_dev);
>
> - if (qdev->hotplugged)
> - bus->hotplug(bus->hotplug_qdev, pci_dev, 1);
> + if (qdev->hotplugged) {
> + rc = bus->hotplug(bus->hotplug_qdev, pci_dev, 1);
> + if (rc != 0) {
> + return rc;
I think we need to unregister the device (and remove option rom?),
otherwise there's a resource leak here.
Can it really fail? If not we can just make it void.
> + }
> + }
> return 0;
> }
>
> @@ -1632,8 +1636,7 @@ static int pci_unplug_device(DeviceState *qdev)
> {
> PCIDevice *dev = DO_UPCAST(PCIDevice, qdev, qdev);
>
> - dev->bus->hotplug(dev->bus->hotplug_qdev, dev, 0);
> - return 0;
> + return dev->bus->hotplug(dev->bus->hotplug_qdev, dev, 0);
> }
>
> void pci_qdev_register(PCIDeviceInfo *info)
> --
> 1.6.6.1
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Qemu-devel] Re: [PATCH] pci hotplug: make pci hotplug return value to caller.
2010-06-21 11:40 ` [Qemu-devel] " Michael S. Tsirkin
@ 2010-06-21 12:31 ` Isaku Yamahata
0 siblings, 0 replies; 5+ messages in thread
From: Isaku Yamahata @ 2010-06-21 12:31 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: qemu-devel, Gerd Hoffmann
On Mon, Jun 21, 2010 at 02:40:06PM +0300, Michael S. Tsirkin wrote:
> On Tue, Jun 15, 2010 at 12:47:27PM +0900, Isaku Yamahata wrote:
> > Make pci hotplug callback return value to caller.
> > There is no reason to discard return value.
> >
> > Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
> > ---
> > hw/pci.c | 11 +++++++----
> > 1 files changed, 7 insertions(+), 4 deletions(-)
> >
> > diff --git a/hw/pci.c b/hw/pci.c
> > index 7787005..3777c1c 100644
> > --- a/hw/pci.c
> > +++ b/hw/pci.c
> > @@ -1623,8 +1623,12 @@ static int pci_qdev_init(DeviceState *qdev, DeviceInfo *base)
> > pci_dev->romfile = qemu_strdup(info->romfile);
> > pci_add_option_rom(pci_dev);
> >
> > - if (qdev->hotplugged)
> > - bus->hotplug(bus->hotplug_qdev, pci_dev, 1);
> > + if (qdev->hotplugged) {
> > + rc = bus->hotplug(bus->hotplug_qdev, pci_dev, 1);
> > + if (rc != 0) {
> > + return rc;
>
> I think we need to unregister the device (and remove option rom?),
> otherwise there's a resource leak here.
Okay. I'll look into it.
> Can it really fail? If not we can just make it void.
The current pci hot plug(acpi_piix4.c) always successes.
But in the pcie native hot plug case it can fail because
a slot can have a electromechanical lock.
If the slot is locked, a card can't be inserted/removed.
There are also other pci hot plug controllers which have a lock.
Hot plug can fail with such a controller.
>
>
> > + }
> > + }
> > return 0;
> > }
> >
> > @@ -1632,8 +1636,7 @@ static int pci_unplug_device(DeviceState *qdev)
> > {
> > PCIDevice *dev = DO_UPCAST(PCIDevice, qdev, qdev);
> >
> > - dev->bus->hotplug(dev->bus->hotplug_qdev, dev, 0);
> > - return 0;
> > + return dev->bus->hotplug(dev->bus->hotplug_qdev, dev, 0);
> > }
> >
> > void pci_qdev_register(PCIDeviceInfo *info)
> > --
> > 1.6.6.1
> >
>
--
yamahata
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-06-21 12:35 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-15 3:47 [Qemu-devel] [PATCH] pci hotplug: make pci hotplug return value to caller Isaku Yamahata
2010-06-15 8:55 ` [Qemu-devel] " Gerd Hoffmann
2010-06-21 9:53 ` [Qemu-devel] " Isaku Yamahata
2010-06-21 11:40 ` [Qemu-devel] " Michael S. Tsirkin
2010-06-21 12:31 ` Isaku Yamahata
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).