Changes in uspace/lib/usbhost/src/hcd.c [eadaeae8:ae3a941] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbhost/src/hcd.c
readaeae8 rae3a941 149 149 * If this method fails, a polling fibril is started instead. 150 150 * 151 * @param[in] hcdHost controller device.152 * @param[in] hw_resResources to be used.153 * @param[out] irq_handle Storage for the returned IRQ handle154 * 155 * @return Error code.151 * @param[in] hcd Host controller device. 152 * @param[in] hw_res Resources to be used. 153 * 154 * @return IRQ capability handle on success. 155 * @return Negative error code. 156 156 */ 157 157 static errno_t hcd_ddf_setup_interrupts(hc_device_t *hcd, 158 const hw_res_list_parsed_t *hw_res , cap_irq_handle_t *irq_handle)158 const hw_res_list_parsed_t *hw_res) 159 159 { 160 160 assert(hcd); … … 169 169 if (ret != EOK) { 170 170 usb_log_error("Failed to generate IRQ code: %s.", 171 str_error( ret));172 return ret;171 str_error(irq)); 172 return irq; 173 173 } 174 174 175 175 /* Register handler to avoid interrupt lockup */ 176 cap_irq_handle_t ihandle;176 int irq_cap; 177 177 ret = register_interrupt_handler(hcd->ddf_dev, irq, irq_handler, 178 &irq_code, &i handle);178 &irq_code, &irq_cap); 179 179 irq_code_clean(&irq_code); 180 180 if (ret != EOK) { 181 181 usb_log_error("Failed to register interrupt handler: %s.", 182 str_error( ret));183 return ret;182 str_error(irq_cap)); 183 return irq_cap; 184 184 } 185 185 … … 189 189 usb_log_error("Failed to enable interrupts: %s.", 190 190 str_error(ret)); 191 unregister_interrupt_handler(hcd->ddf_dev, i handle);191 unregister_interrupt_handler(hcd->ddf_dev, irq_cap); 192 192 return ret; 193 193 } 194 195 *irq_handle = ihandle; 196 return EOK; 194 return irq_cap; 197 195 } 198 196 … … 247 245 248 246 /* Setup interrupts */ 249 hcd->irq_handle = CAP_NIL; 250 errno_t irqerr = hcd_ddf_setup_interrupts(hcd, &hw_res, 251 &hcd->irq_handle); 252 if (irqerr == EOK) { 247 hcd->irq_cap = hcd_ddf_setup_interrupts(hcd, &hw_res); 248 if (hcd->irq_cap >= 0) { 253 249 usb_log_debug("Hw interrupts enabled."); 254 250 } … … 274 270 275 271 /* Need working irq replacement to setup root hub */ 276 if ( irqerr != EOK&& ops->status) {272 if (hcd->irq_cap < 0 && ops->status) { 277 273 hcd->polling_fibril = fibril_create(interrupt_polling, hcd->bus); 278 274 if (!hcd->polling_fibril) { … … 283 279 fibril_add_ready(hcd->polling_fibril); 284 280 usb_log_warning("Failed to enable interrupts: %s." 285 " Falling back to polling.", str_error( irqerr));281 " Falling back to polling.", str_error(hcd->irq_cap)); 286 282 } 287 283 … … 309 305 hc_driver->stop(hcd); 310 306 err_irq: 311 unregister_interrupt_handler(device, hcd->irq_ handle);307 unregister_interrupt_handler(device, hcd->irq_cap); 312 308 if (hc_driver->hc_remove) 313 309 hc_driver->hc_remove(hcd); … … 328 324 return err; 329 325 330 unregister_interrupt_handler(dev, hcd->irq_ handle);326 unregister_interrupt_handler(dev, hcd->irq_cap); 331 327 332 328 if (hc_driver->hc_remove)
Note:
See TracChangeset
for help on using the changeset viewer.