Ignore:
Timestamp:
2016-08-03T11:12:24Z (9 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
96ef672
Parents:
e657635
Message:

Reference-count endpoint_t structures

Track explicit references to USB endpoints. Call endpoint_destroy()
only after the last reference is destroyed. This prevents the scenario
in which removal was attempted on an endpoint while there was a transfer
in progress.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbhost/include/usb/host/endpoint.h

    re657635 rf527f58  
    4040#include <fibril_synch.h>
    4141#include <usb/usb.h>
     42#include <atomic.h>
    4243
    4344/** Host controller side endpoint structure. */
    4445typedef struct endpoint {
     46        /** Reference count. */
     47        atomic_t refcnt;       
    4548        /** Part of linked list. */
    4649        link_t link;
     
    9194void endpoint_destroy(endpoint_t *instance);
    9295
     96void endpoint_add_ref(endpoint_t *instance);
     97void endpoint_del_ref(endpoint_t *instance);
     98
    9399void endpoint_set_hc_data(endpoint_t *instance,
    94100    void *data, int (*toggle_get)(void *), void (*toggle_set)(void *, int));
Note: See TracChangeset for help on using the changeset viewer.