Revision 94afdadc
b/hw/intel-hda.c | ||
---|---|---|
1116 | 1116 |
/* reset codecs */ |
1117 | 1117 |
QTAILQ_FOREACH(qdev, &d->codecs.qbus.children, sibling) { |
1118 | 1118 |
cdev = DO_UPCAST(HDACodecDevice, qdev, qdev); |
1119 |
if (qdev_get_info(qdev)->reset) { |
|
1120 |
qdev_get_info(qdev)->reset(qdev); |
|
1121 |
} |
|
1119 |
device_reset(DEVICE(cdev)); |
|
1122 | 1120 |
d->state_sts |= (1 << cdev->cad); |
1123 | 1121 |
} |
1124 | 1122 |
intel_hda_update_irq(d); |
b/hw/lsi53c895a.c | ||
---|---|---|
1681 | 1681 |
DeviceState *dev; |
1682 | 1682 |
|
1683 | 1683 |
QTAILQ_FOREACH(dev, &s->bus.qbus.children, sibling) { |
1684 |
qdev_get_info(dev)->reset(dev);
|
|
1684 |
device_reset(dev);
|
|
1685 | 1685 |
} |
1686 | 1686 |
s->sstat0 |= LSI_SSTAT0_RST; |
1687 | 1687 |
lsi_script_scsi_interrupt(s, LSI_SIST0_RST, 0); |
b/hw/qdev.c | ||
---|---|---|
48 | 48 |
static void qdev_subclass_init(ObjectClass *klass, void *data) |
49 | 49 |
{ |
50 | 50 |
DeviceClass *dc = DEVICE_CLASS(klass); |
51 |
|
|
51 | 52 |
dc->info = data; |
53 |
dc->reset = dc->info->reset; |
|
54 |
|
|
55 |
/* Poison to try to detect future uses */ |
|
56 |
dc->info->reset = NULL; |
|
52 | 57 |
} |
53 | 58 |
|
54 | 59 |
DeviceInfo *qdev_get_info(DeviceState *dev) |
... | ... | |
378 | 383 |
dev->alias_required_for_version); |
379 | 384 |
} |
380 | 385 |
dev->state = DEV_STATE_INITIALIZED; |
381 |
if (dev->hotplugged && qdev_get_info(dev)->reset) {
|
|
382 |
qdev_get_info(dev)->reset(dev);
|
|
386 |
if (dev->hotplugged) { |
|
387 |
device_reset(dev);
|
|
383 | 388 |
} |
384 | 389 |
return 0; |
385 | 390 |
} |
... | ... | |
407 | 412 |
|
408 | 413 |
static int qdev_reset_one(DeviceState *dev, void *opaque) |
409 | 414 |
{ |
410 |
if (qdev_get_info(dev)->reset) { |
|
411 |
qdev_get_info(dev)->reset(dev); |
|
412 |
} |
|
415 |
device_reset(dev); |
|
413 | 416 |
|
414 | 417 |
return 0; |
415 | 418 |
} |
... | ... | |
1593 | 1596 |
qdev_get_peripheral(); |
1594 | 1597 |
} |
1595 | 1598 |
|
1599 |
void device_reset(DeviceState *dev) |
|
1600 |
{ |
|
1601 |
DeviceClass *klass = DEVICE_GET_CLASS(dev); |
|
1602 |
|
|
1603 |
if (klass->reset) { |
|
1604 |
klass->reset(dev); |
|
1605 |
} |
|
1606 |
} |
|
1607 |
|
|
1596 | 1608 |
static TypeInfo device_type_info = { |
1597 | 1609 |
.name = TYPE_DEVICE, |
1598 | 1610 |
.parent = TYPE_OBJECT, |
b/hw/qdev.h | ||
---|---|---|
75 | 75 |
typedef struct DeviceClass { |
76 | 76 |
ObjectClass parent_class; |
77 | 77 |
DeviceInfo *info; |
78 |
void (*reset)(DeviceState *dev); |
|
78 | 79 |
} DeviceClass; |
79 | 80 |
|
80 | 81 |
/* This structure should not be accessed directly. We declare it here |
... | ... | |
647 | 648 |
*/ |
648 | 649 |
void qdev_machine_init(void); |
649 | 650 |
|
651 |
/** |
|
652 |
* @device_reset |
|
653 |
* |
|
654 |
* Reset a single device (by calling the reset method). |
|
655 |
*/ |
|
656 |
void device_reset(DeviceState *dev); |
|
657 |
|
|
650 | 658 |
#endif |
Also available in: Unified diff