Changeset 2b61945 in mainline for uspace/lib/usbhost/src


Ignore:
Timestamp:
2017-10-22T03:47:41Z (8 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2e5aea1
Parents:
766043c
Message:

xhci: use device_t for bookkeeping

This started as a little refactoring to move active transfer batch to endpoint. Finding the EP in handler needs devices indexed by slot id. Then I found out we do not use the device_t extendable mechanism. Then there were a lot of errors found while doing all this…

Location:
uspace/lib/usbhost/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbhost/src/hcd.c

    r766043c r2b61945  
    4141#include <errno.h>
    4242#include <usb_iface.h>
     43#include <str_error.h>
    4344
    4445#include "hcd.h"
     
    128129
    129130        const int ret = hcd->ops.schedule(hcd, batch);
    130         if (ret != EOK)
     131        if (ret != EOK) {
     132                usb_log_warning("Batch %p failed to schedule: %s", batch, str_error(ret));
    131133                usb_transfer_batch_destroy(batch);
     134        }
    132135
    133136        /* Drop our own reference to ep. */
  • uspace/lib/usbhost/src/usb_transfer_batch.c

    r766043c r2b61945  
    4040#include <assert.h>
    4141#include <errno.h>
     42#include <str_error.h>
    4243
    4344
     
    6263void usb_transfer_batch_init(usb_transfer_batch_t *batch, endpoint_t *ep)
    6364{
     65        endpoint_use(ep);
     66
    6467        memset(batch, 0, sizeof(*batch));
    65 
    6668        batch->ep = ep;
    67 
    68         endpoint_use(ep);
    6969}
    7070
     
    103103        assert(batch->ep->bus);
    104104
    105         usb_log_debug2("batch %p " USB_TRANSFER_BATCH_FMT " disposing.\n",
    106             batch, USB_TRANSFER_BATCH_ARGS(*batch));
    107 
    108105        bus_t *bus = batch->ep->bus;
    109         if (bus->ops.destroy_batch)
     106        if (bus->ops.destroy_batch) {
     107                usb_log_debug2("Batch %p " USB_TRANSFER_BATCH_FMT " destroying.\n",
     108                    batch, USB_TRANSFER_BATCH_ARGS(*batch));
    110109                bus->ops.destroy_batch(batch);
    111         else
     110        }
     111        else {
     112                usb_log_debug2("Batch %p " USB_TRANSFER_BATCH_FMT " disposing.\n",
     113                    batch, USB_TRANSFER_BATCH_ARGS(*batch));
    112114                free(batch);
     115        }
    113116
    114117        endpoint_release(batch->ep);
     
    123126void usb_transfer_batch_finish(usb_transfer_batch_t *batch)
    124127{
    125         if (!batch_complete(batch))
    126                 usb_log_warning("failed to complete batch %p!", batch);
     128        const int err = batch_complete(batch);
     129        if (err)
     130                usb_log_warning("batch %p failed to complete: %s", batch, str_error(err));
    127131
    128132        usb_transfer_batch_destroy(batch);
     
    159163        struct old_handler_wrapper_data *data = malloc(sizeof(*data));
    160164
     165        assert((!in_callback) != (!out_callback));
     166
    161167        data->in_callback = in_callback;
    162168        data->out_callback = out_callback;
Note: See TracChangeset for help on using the changeset viewer.