Changeset 772a172 in mainline for uspace/drv/bus/usb/ohci/ohci.c


Ignore:
Timestamp:
2013-09-21T05:22:43Z (11 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f65d9cc
Parents:
19d21728
Message:

ohci,uhci: Switch to library provided irq setup routine.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/ohci/ohci.c

    r19d21728 r772a172  
    103103        }
    104104
    105         ret = hc_register_irq_handler(device, &regs, irq, irq_handler);
    106         if (ret != EOK) {
    107                 usb_log_error("Failed to register interrupt handler: %s.\n",
    108                     str_error(ret));
     105        hc_t *hc = malloc(sizeof(hc_t));
     106        if (!hc) {
     107                usb_log_error("Failed to allocate driver structure.\n");
     108                ret = ENOMEM;
    109109                goto ddf_hc_clean;
    110110        }
     
    112112        /* Try to enable interrupts */
    113113        bool interrupts = false;
    114         ret = hcd_ddf_enable_interrupts(device);
     114        ret = hcd_ddf_setup_interrupts(device, &regs, irq, irq_handler,
     115            hc_gen_irq_code);
    115116        if (ret != EOK) {
    116117                usb_log_warning("Failed to enable interrupts: %s."
     
    123124        }
    124125
    125         hc_t *hc = malloc(sizeof(hc_t));
    126         if (!hc) {
    127                 usb_log_error("Failed to allocate driver structure.\n");
    128                 ret = ENOMEM;
    129                 goto unregister_irq;
    130         }
    131 
    132126        /* Initialize OHCI HC */
    133127        ret = hc_init(hc, &regs, interrupts);
    134128        if (ret != EOK) {
    135129                usb_log_error("Failed to init hc: %s.\n", str_error(ret));
    136                 goto hc_free;
     130                goto unregister_irq;
    137131        }
    138132
     
    147141                    str_error(ret));
    148142                hc_fini(hc);
    149 hc_free:
    150                 free(hc);
    151143unregister_irq:
    152144                unregister_interrupt_handler(device, irq);
     145                free(hc);
    153146ddf_hc_clean:
    154147                hcd_ddf_clean_hc(device);
Note: See TracChangeset for help on using the changeset viewer.