Changeset e3f7418 in mainline for uspace/drv/bus/usb/usbhub


Ignore:
Timestamp:
2011-10-15T13:06:28Z (15 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/fix-logger-deadlock, topic/msim-upgrade, topic/simplify-dev-export
Children:
a044f71
Parents:
3958e315 (diff), 065064e6 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

USB improvements.

USB unplug part2; Unplug support in all drivers (except for unused usbmouse driver).
Make descriptor paring work on const pointers.
Fixes several crashes and memory leaks.

Location:
uspace/drv/bus/usb/usbhub
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/usbhub/port.c

    r3958e315 re3f7418  
    288288        port->attached_device.fun = NULL;
    289289
    290         ret = usb_hc_unregister_device(&hub->connection,
    291             port->attached_device.address);
    292         if (ret != EOK) {
    293                 usb_log_warning("Failed to unregister address of the removed "
    294                     "device: %s.\n", str_error(ret));
    295         }
     290        ret = usb_hc_connection_open(&hub->connection);
     291        if (ret == EOK) {
     292                ret = usb_hc_unregister_device(&hub->connection,
     293                    port->attached_device.address);
     294                if (ret != EOK) {
     295                        usb_log_warning("Failed to unregister address of the "
     296                            "removed device: %s.\n", str_error(ret));
     297                }
     298                ret = usb_hc_connection_close(&hub->connection);
     299                if (ret != EOK) {
     300                        usb_log_warning("Failed to close hc connection %s.\n",
     301                            str_error(ret));
     302                }
     303
     304        } else {
     305                usb_log_warning("Failed to open hc connection %s.\n",
     306                    str_error(ret));
     307        }
     308
    296309        port->attached_device.address = -1;
    297310        fibril_mutex_unlock(&port->mutex);
  • uspace/drv/bus/usb/usbhub/usbhub.c

    r3958e315 re3f7418  
    117117        ddf_fun_destroy(hub->hub_fun);
    118118
    119         free(hub);
    120         usb_dev->driver_data = NULL;
    121119        usb_log_info("USB hub driver, stopped and cleaned.\n");
    122120        return EOK;
     
    254252{
    255253        assert(usb_dev);
    256         usb_hub_dev_t *hub_dev = malloc(sizeof(usb_hub_dev_t));
     254        usb_hub_dev_t *hub_dev =
     255            usb_device_data_alloc(usb_dev, sizeof(usb_hub_dev_t));
    257256        if (!hub_dev)
    258257            return NULL;
    259258
    260259        hub_dev->usb_device = usb_dev;
    261 
    262260        hub_dev->ports = NULL;
    263261        hub_dev->port_count = 0;
     
    266264        fibril_mutex_initialize(&hub_dev->pending_ops_mutex);
    267265        fibril_condvar_initialize(&hub_dev->pending_ops_cv);
    268         usb_dev->driver_data = hub_dev;
    269266
    270267        return hub_dev;
Note: See TracChangeset for help on using the changeset viewer.