Changes in uspace/drv/root/root.c [7e752b2:f0da4eb2] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/root/root.c
r7e752b2 rf0da4eb2 45 45 #include <ctype.h> 46 46 #include <macros.h> 47 #include <inttypes.h>48 47 49 48 #include <driver.h> … … 120 119 } 121 120 121 /** Create virtual USB host controller device. 122 * Note that the virtual HC is actually device and driver in one 123 * task. 124 * 125 * @param parent Parent device. 126 * @return Error code. 127 */ 128 static int add_virtual_usb_host_controller(device_t *parent) 129 { 130 printf(NAME ": adding virtual host contoller.\n"); 131 132 int rc; 133 device_t *vhc = NULL; 134 match_id_t *match_id = NULL; 135 136 vhc = create_device(); 137 if (vhc == NULL) { 138 rc = ENOMEM; 139 goto failure; 140 } 141 142 vhc->name = "vhc"; 143 printf(NAME ": the new device's name is %s.\n", vhc->name); 144 145 /* Initialize match id list. */ 146 match_id = create_match_id(); 147 if (match_id == NULL) { 148 rc = ENOMEM; 149 goto failure; 150 } 151 152 match_id->id = "usb&hc=vhc"; 153 match_id->score = 100; 154 add_match_id(&vhc->match_ids, match_id); 155 156 /* Register child device. */ 157 rc = child_device_register(vhc, parent); 158 if (rc != EOK) 159 goto failure; 160 161 return EOK; 162 163 failure: 164 if (match_id != NULL) 165 match_id->id = NULL; 166 167 if (vhc != NULL) { 168 vhc->name = NULL; 169 delete_device(vhc); 170 } 171 172 return rc; 173 } 174 122 175 /** Get the root device. 123 176 * … … 127 180 static int root_add_device(device_t *dev) 128 181 { 129 printf(NAME ": root_add_device, device handle=%" PRIun "\n", 130 dev->handle); 182 printf(NAME ": root_add_device, device handle = %d\n", dev->handle); 131 183 132 184 /* Register root device's children. */ … … 135 187 printf(NAME ": failed to add child device for platform.\n"); 136 188 189 /* Register virtual USB host controller. */ 190 int rc = add_virtual_usb_host_controller(dev); 191 if (EOK != rc) { 192 printf(NAME ": failed to add child device - virtual USB HC.\n"); 193 } 194 137 195 return res; 138 196 }
Note:
See TracChangeset
for help on using the changeset viewer.