Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset da2f1c9e in mainline


Ignore:
Timestamp:
2011-12-14T22:17:56Z (10 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master
Children:
8e3742f9
Parents:
66ee26a
Message:

lilbusb: Add function to clean usb_hc_connection and scream if it needs to do some cleanup.

The warning means that you are missing one of the call to close connection.

Location:
uspace/lib/usb
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usb/include/usb/hc.h

    r66ee26a rda2f1c9e  
    8080    const ddf_dev_t *);
    8181
     82void usb_hc_connection_deinitialize(usb_hc_connection_t *);
     83
    8284int usb_hc_connection_open(usb_hc_connection_t *);
    8385int usb_hc_connection_close(usb_hc_connection_t *);
  • uspace/lib/usb/src/hc.c

    r66ee26a rda2f1c9e  
    126126}
    127127/*----------------------------------------------------------------------------*/
     128void usb_hc_connection_deinitialize(usb_hc_connection_t *connection)
     129{
     130        assert(connection);
     131        fibril_mutex_lock(&connection->guard);
     132        if (connection->ref_count != 0) {
     133                usb_log_warning("%u stale reference(s) to HC connection.\n",
     134                    connection->ref_count);
     135                assert(connection->hc_sess);
     136                async_hangup(connection->hc_sess);
     137                connection->hc_sess = NULL;
     138                connection->ref_count = 0;
     139        }
     140        fibril_mutex_unlock(&connection->guard);
     141}
     142/*----------------------------------------------------------------------------*/
    128143/** Open connection to host controller.
    129144 *
Note: See TracChangeset for help on using the changeset viewer.