| 248 | } |
| 249 | |
| 250 | static device_t |
| 251 | nexus_add_child(device_t bus, u_int order, const char *name, int unit) |
| 252 | { |
| 253 | device_t child; |
| 254 | struct nexus_device *ndev; |
| 255 | |
| 256 | ndev = malloc(sizeof(struct nexus_device), M_NEXUSDEV, M_NOWAIT|M_ZERO); |
| 257 | if (!ndev) |
| 258 | return (0); |
| 259 | resource_list_init(&ndev->nx_resources); |
| 260 | |
| 261 | child = device_add_child_ordered(bus, order, name, unit); |
| 262 | if (child == NULL) { |
| 263 | device_printf(bus, "failed to add child: %s%d\n", name, unit); |
| 264 | return (0); |
| 265 | } |
| 266 | |
| 267 | /* should we free this in nexus_child_detached? */ |
| 268 | device_set_ivars(child, ndev); |
| 269 | |
| 270 | return (child); |
| 271 | } |
| 272 | |
| 273 | /* |
| 274 | * Allocate a resource on behalf of child. NB: child is usually going to be a |
nothing calls this directly
no test coverage detected