Changeset e27c2476 in mainline
- Timestamp:
- 2011-10-29T20:37:48Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 96ec0a9
- Parents:
- c44a5f1
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbhub/usbhub.c
rc44a5f1 re27c2476 68 68 69 69 static int usb_set_first_configuration(usb_device_t *usb_device); 70 static usb_hub_dev_t * usb_hub_dev_create(usb_device_t *usb_dev);71 70 static int usb_hub_process_hub_specific_info(usb_hub_dev_t *hub_dev); 72 71 static void usb_hub_over_current(const usb_hub_dev_t *hub_dev, … … 133 132 assert(usb_dev); 134 133 /* Create driver soft-state structure */ 135 usb_hub_dev_t *hub_dev = usb_hub_dev_create(usb_dev); 134 usb_hub_dev_t *hub_dev = 135 usb_device_data_alloc(usb_dev, sizeof(usb_hub_dev_t)); 136 136 if (hub_dev == NULL) { 137 137 usb_log_error("Failed to create hun driver structure.\n"); 138 138 return ENOMEM; 139 139 } 140 hub_dev->usb_device = usb_dev; 141 hub_dev->pending_ops_count = 0; 142 hub_dev->running = false; 143 fibril_mutex_initialize(&hub_dev->pending_ops_mutex); 144 fibril_condvar_initialize(&hub_dev->pending_ops_cv); 140 145 141 146 /* Create hc connection */ … … 146 151 usb_log_error("Could not initialize connection to device: %s\n", 147 152 str_error(opResult)); 148 free(hub_dev);149 153 return opResult; 150 154 } … … 155 159 usb_log_error("Could not set hub configuration: %s\n", 156 160 str_error(opResult)); 157 free(hub_dev);158 161 return opResult; 159 162 } … … 164 167 usb_log_error("Could process hub specific info, %s\n", 165 168 str_error(opResult)); 166 free(hub_dev);167 169 return opResult; 168 170 } … … 173 175 if (hub_dev->hub_fun == NULL) { 174 176 usb_log_error("Failed to create hub function.\n"); 175 free(hub_dev);176 177 return ENOMEM; 177 178 } … … 181 182 usb_log_error("Failed to bind hub function: %s.\n", 182 183 str_error(opResult)); 183 free(hub_dev);184 184 ddf_fun_destroy(hub_dev->hub_fun); 185 185 return opResult; … … 193 193 ddf_fun_unbind(hub_dev->hub_fun); 194 194 ddf_fun_destroy(hub_dev->hub_fun); 195 free(hub_dev);196 195 usb_log_error("Failed to create polling fibril: %s.\n", 197 196 str_error(opResult)); … … 240 239 } 241 240 return true; 242 }243 /*----------------------------------------------------------------------------*/244 /**245 * create usb_hub_dev_t structure246 *247 * Does only basic copying of known information into new structure.248 * @param usb_dev usb device structure249 * @return basic usb_hub_dev_t structure250 */251 static usb_hub_dev_t * usb_hub_dev_create(usb_device_t *usb_dev)252 {253 assert(usb_dev);254 usb_hub_dev_t *hub_dev =255 usb_device_data_alloc(usb_dev, sizeof(usb_hub_dev_t));256 if (!hub_dev)257 return NULL;258 259 hub_dev->usb_device = usb_dev;260 hub_dev->ports = NULL;261 hub_dev->port_count = 0;262 hub_dev->pending_ops_count = 0;263 hub_dev->running = false;264 fibril_mutex_initialize(&hub_dev->pending_ops_mutex);265 fibril_condvar_initialize(&hub_dev->pending_ops_cv);266 267 return hub_dev;268 241 } 269 242 /*----------------------------------------------------------------------------*/
Note:
See TracChangeset
for help on using the changeset viewer.