| 191 | } |
| 192 | |
| 193 | static device_t |
| 194 | nexus_add_child(device_t bus, u_int order, const char *name, int unit) |
| 195 | { |
| 196 | device_t child; |
| 197 | struct nexus_device *ndev; |
| 198 | |
| 199 | ndev = malloc(sizeof(struct nexus_device), M_NEXUSDEV, M_NOWAIT|M_ZERO); |
| 200 | if (!ndev) |
| 201 | return (0); |
| 202 | resource_list_init(&ndev->nx_resources); |
| 203 | |
| 204 | child = device_add_child_ordered(bus, order, name, unit); |
| 205 | |
| 206 | /* should we free this in nexus_child_detached? */ |
| 207 | device_set_ivars(child, ndev); |
| 208 | |
| 209 | return (child); |
| 210 | } |
| 211 | |
| 212 | /* |
| 213 | * Allocate a resource on behalf of child. NB: child is usually going to be a |
no test coverage detected