Changeset f974519 in mainline for uspace/drv/bus/usb/ohci/hc.c


Ignore:
Timestamp:
2011-08-25T16:14:58Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0815000
Parents:
09ace19
Message:

ohci: Fix double enqueue issue, refactoring

File:
1 edited

Legend:

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

    r09ace19 rf974519  
    139139            &instance->generic.dev_manager, hub_address, hub_fun->handle);
    140140
    141 #define CHECK_RET_RELEASE(ret, message...) \
     141#define CHECK_RET_DESTROY(ret, message...) \
    142142if (ret != EOK) { \
    143143        usb_log_error(message); \
     144        endpoint_destroy(ep); \
     145        usb_endpoint_manager_unregister_ep(&instance->generic.ep_manager, \
     146            hub_address, 0, USB_DIRECTION_BOTH); \
    144147        return ret; \
    145148} else (void)0
     
    151154
    152155        int ret = ohci_endpoint_init(&instance->generic, ep);
    153         if (ret != EOK) {
    154                 endpoint_destroy(ep);
    155                 return ret;
    156         }
    157 
    158         ret = usb_endpoint_manager_register_ep(&instance->generic.ep_manager, ep, 0);
    159         if (ret != EOK) {
    160                 endpoint_destroy(ep);
    161                 return ret;
    162         }
    163         hc_enqueue_endpoint(instance, ep);
    164 
    165 
    166 //      int ret = hc_add_endpoint(instance, hub_address, 0, USB_SPEED_FULL,
    167 //          USB_TRANSFER_CONTROL, USB_DIRECTION_BOTH, 64, 0, 0);
    168 //      CHECK_RET_RELEASE(ret,
    169 //          "Failed to add OHCI root hub endpoint 0: %s.\n", str_error(ret));
     156        CHECK_RET_DESTROY(ret, "Failed to initialize rh OHCI ep structures.\n");
     157
     158        ret = usb_endpoint_manager_register_ep(
     159            &instance->generic.ep_manager, ep, 0);
     160        CHECK_RET_DESTROY(ret, "Failed to initialize rh control ep.\n");
     161        ep = NULL;
    170162
    171163        ret = ddf_fun_add_match_id(hub_fun, "usb&class=hub", 100);
    172         CHECK_RET_RELEASE(ret,
     164        CHECK_RET_DESTROY(ret,
    173165            "Failed to add root hub match-id: %s.\n", str_error(ret));
    174166
    175167        ret = ddf_fun_bind(hub_fun);
    176         CHECK_RET_RELEASE(ret,
     168        CHECK_RET_DESTROY(ret,
    177169            "Failed to bind root hub function: %s.\n", str_error(ret));
    178170
     
    248240        case USB_TRANSFER_BULK:
    249241                instance->registers->control &= ~C_BLE;
    250                 endpoint_list_add_ep(
    251                     &instance->lists[ep->transfer_type], ohci_endpoint_get(ep));
     242                endpoint_list_add_ep(list, ohci_ep);
    252243                instance->registers->control |= C_BLE;
    253244                break;
     
    255246        case USB_TRANSFER_INTERRUPT:
    256247                instance->registers->control &= (~C_PLE & ~C_IE);
    257                 endpoint_list_add_ep(
    258                     &instance->lists[ep->transfer_type], ohci_endpoint_get(ep));
     248                endpoint_list_add_ep(list, ohci_ep);
    259249                instance->registers->control |= C_PLE | C_IE;
    260250                break;
     
    368358
    369359        if (status & I_UE) {
     360                usb_log_fatal("Error like no other!\n");
    370361                hc_start(instance);
    371362        }
Note: See TracChangeset for help on using the changeset viewer.