bus.c (d2623129a7dec1d3041ad1221dda1ca49c667532) | bus.c (b69c3c21a5d11075d42100d5cfe0a736593fae6b) |
---|---|
1/* 2 * Dynamic device configuration and creation -- buses. 3 * 4 * Copyright (c) 2009 CodeSourcery 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either --- 162 unchanged lines hidden (view full) --- 171 return bus->realized; 172} 173 174static void bus_set_realized(Object *obj, bool value, Error **errp) 175{ 176 BusState *bus = BUS(obj); 177 BusClass *bc = BUS_GET_CLASS(bus); 178 BusChild *kid; | 1/* 2 * Dynamic device configuration and creation -- buses. 3 * 4 * Copyright (c) 2009 CodeSourcery 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either --- 162 unchanged lines hidden (view full) --- 171 return bus->realized; 172} 173 174static void bus_set_realized(Object *obj, bool value, Error **errp) 175{ 176 BusState *bus = BUS(obj); 177 BusClass *bc = BUS_GET_CLASS(bus); 178 BusChild *kid; |
179 Error *local_err = NULL; | |
180 181 if (value && !bus->realized) { 182 if (bc->realize) { | 179 180 if (value && !bus->realized) { 181 if (bc->realize) { |
183 bc->realize(bus, &local_err); | 182 bc->realize(bus, errp); |
184 } 185 186 /* TODO: recursive realization */ 187 } else if (!value && bus->realized) { 188 QTAILQ_FOREACH(kid, &bus->children, sibling) { 189 DeviceState *dev = kid->child; 190 object_property_set_bool(OBJECT(dev), false, "realized", | 183 } 184 185 /* TODO: recursive realization */ 186 } else if (!value && bus->realized) { 187 QTAILQ_FOREACH(kid, &bus->children, sibling) { 188 DeviceState *dev = kid->child; 189 object_property_set_bool(OBJECT(dev), false, "realized", |
191 &local_err); 192 if (local_err != NULL) { 193 break; 194 } | 190 &error_abort); |
195 } | 191 } |
196 if (bc->unrealize && local_err == NULL) { 197 bc->unrealize(bus, &local_err); | 192 if (bc->unrealize) { 193 bc->unrealize(bus); |
198 } 199 } 200 | 194 } 195 } 196 |
201 if (local_err != NULL) { 202 error_propagate(errp, local_err); 203 return; 204 } 205 | |
206 bus->realized = value; 207} 208 209static void qbus_initfn(Object *obj) 210{ 211 BusState *bus = BUS(obj); 212 213 QTAILQ_INIT(&bus->children); --- 121 unchanged lines hidden --- | 197 bus->realized = value; 198} 199 200static void qbus_initfn(Object *obj) 201{ 202 BusState *bus = BUS(obj); 203 204 QTAILQ_INIT(&bus->children); --- 121 unchanged lines hidden --- |