Changeset b72efe8 in mainline for uspace/drv/uhci


Ignore:
Timestamp:
2011-06-19T14:38:59Z (15 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
74464e8
Parents:
1d1bb0f
Message:

Separate list_t typedef from link_t (user-space part).

  • list_t represents lists
  • Use list_first(), list_last(), list_empty() where appropriate
  • Use list_foreach() where possible
  • assert_link_not_used()
  • usb_hid_report_path_free() shall not unlink the path, caller must do it
Location:
uspace/drv/uhci
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/uhci/hc.c

    r1d1bb0f rb72efe8  
    345345
    346346                while (!list_empty(&done)) {
    347                         link_t *item = done.next;
     347                        link_t *item = list_first(&done);
    348348                        list_remove(item);
    349349                        usb_transfer_batch_t *batch =
  • uspace/drv/uhci/transfer_list.c

    r1d1bb0f rb72efe8  
    121121        } else {
    122122                /* There is something scheduled */
    123                 usb_transfer_batch_t *last =
    124                     usb_transfer_batch_from_link(instance->batch_list.prev);
     123                usb_transfer_batch_t *last = usb_transfer_batch_from_link(
     124                    list_last(&instance->batch_list));
    125125                last_qh = batch_qh(last);
    126126        }
     
    146146}
    147147/*----------------------------------------------------------------------------*/
    148 /** Add completed bantches to the provided list.
     148/** Add completed batches to the provided list.
    149149 *
    150150 * @param[in] instance List to use.
    151151 * @param[in] done list to fill
    152152 */
    153 void transfer_list_remove_finished(transfer_list_t *instance, link_t *done)
     153void transfer_list_remove_finished(transfer_list_t *instance, list_t *done)
    154154{
    155155        assert(instance);
     
    157157
    158158        fibril_mutex_lock(&instance->guard);
    159         link_t *current = instance->batch_list.next;
    160         while (current != &instance->batch_list) {
     159        link_t *current = instance->batch_list.head.next;
     160        while (current != &instance->batch_list.head) {
    161161                link_t * const next = current->next;
    162162                usb_transfer_batch_t *batch =
     
    181181        fibril_mutex_lock(&instance->guard);
    182182        while (!list_empty(&instance->batch_list)) {
    183                 link_t * const current = instance->batch_list.next;
     183                link_t * const current = list_first(&instance->batch_list);
    184184                usb_transfer_batch_t *batch =
    185185                    usb_transfer_batch_from_link(current);
     
    212212        qh_t *prev_qh = NULL;
    213213        /* Remove from the hardware queue */
    214         if (instance->batch_list.next == &batch->link) {
     214        if (list_first(&instance->batch_list) == &batch->link) {
    215215                /* I'm the first one here */
    216216                prev_qh = instance->queue_head;
  • uspace/drv/uhci/transfer_list.h

    r1d1bb0f rb72efe8  
    5151        const char *name;
    5252        /** List of all batches in this list */
    53         link_t batch_list;
     53        list_t batch_list;
    5454} transfer_list_t;
    5555
     
    5959void transfer_list_add_batch(
    6060    transfer_list_t *instance, usb_transfer_batch_t *batch);
    61 void transfer_list_remove_finished(transfer_list_t *instance, link_t *done);
     61void transfer_list_remove_finished(transfer_list_t *instance, list_t *done);
    6262void transfer_list_abort_all(transfer_list_t *instance);
    6363#endif
Note: See TracChangeset for help on using the changeset viewer.