Revision 3f84865a hw/pci-hotplug.c

b/hw/pci-hotplug.c
185 185
        monitor_printf(mon, "invalid type: %s\n", type);
186 186

  
187 187
    if (dev) {
188
        qemu_system_device_hot_add(pci_bus_num(dev->bus),
189
                                   PCI_SLOT(dev->devfn), 1);
190 188
        monitor_printf(mon, "OK domain %d, bus %d, slot %d, function %d\n",
191 189
                       0, pci_bus_num(dev->bus), PCI_SLOT(dev->devfn),
192 190
                       PCI_FUNC(dev->devfn));
......
210 208
        monitor_printf(mon, "slot %d empty\n", slot);
211 209
        return;
212 210
    }
213

  
214
    qemu_system_device_hot_add(bus, slot, 0);
211
    qdev_unplug(&d->qdev);
215 212
}
216 213

  
217 214
void do_pci_device_hot_remove(Monitor *mon, const QDict *qdict)
......
230 227
/*
231 228
 * OS has executed _EJ0 method, we now can remove the device
232 229
 */
233
void pci_device_hot_remove_success(int pcibus, int slot)
230
void pci_device_hot_remove_success(PCIDevice *d)
234 231
{
235
    PCIDevice *d = pci_find_device(pcibus, slot, 0);
236 232
    int class_code;
237 233

  
238
    if (!d) {
239
        monitor_printf(cur_mon, "invalid slot %d\n", slot);
240
        return;
241
    }
242

  
243 234
    class_code = d->config_read(d, PCI_CLASS_DEVICE+1, 1);
244 235

  
245 236
    switch(class_code) {
......
250 241
        destroy_nic(pci_match_fn, d);
251 242
        break;
252 243
    }
253

  
254
    qdev_free(&d->qdev);
255 244
}
256 245

  

Also available in: Unified diff