Changeset b8cab5c in mainline for uspace/drv/uhci-rhd/port.c


Ignore:
Timestamp:
2011-05-27T07:10:12Z (13 years ago)
Author:
Matus Dekanek <smekideki@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ffca03c
Parents:
8bb61e6 (diff), 1889786 (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:

merge with usb/development

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/uhci-rhd/port.c

    r8bb61e6 rb8cab5c  
    3636#include <errno.h>
    3737#include <str_error.h>
    38 #include <time.h>
    3938#include <async.h>
    4039
     
    8281 * @param[in] number Port number.
    8382 * @param[in] usec Polling interval.
    84  * @param[in] rh Pointer to ddf instance fo the root hub driver.
     83 * @param[in] rh Pointer to ddf instance of the root hub driver.
    8584 * @return Error code.
    8685 *
     
    9190{
    9291        assert(port);
    93         asprintf(&port->id_string, "Port (%p - %u)", port, number);
    94         if (port->id_string == NULL) {
     92        char *id_string;
     93        asprintf(&id_string, "Port (%p - %u)", port, number);
     94        if (id_string == NULL) {
    9595                return ENOMEM;
    9696        }
    9797
     98        port->id_string = id_string;
    9899        port->address = address;
    99100        port->number = number;
     
    105106            usb_hc_connection_initialize_from_device(&port->hc_connection, rh);
    106107        if (ret != EOK) {
    107                 usb_log_error("Failed to initialize connection to HC.");
     108                usb_log_error("%s: failed to initialize connection to HC.",
     109                    port->id_string);
     110                free(id_string);
    108111                return ret;
    109112        }
     
    113116                usb_log_error("%s: failed to create polling fibril.",
    114117                    port->id_string);
     118                free(id_string);
    115119                return ENOMEM;
    116120        }
     
    132136        assert(port);
    133137        free(port->id_string);
    134         /* TODO: Kill fibril here */
     138        // TODO: Kill fibril here
    135139        return;
    136140}
     
    150154
    151155                /* Read register value */
    152                 port_status_t port_status = uhci_port_read_status(instance);
     156                const port_status_t port_status =
     157                    uhci_port_read_status(instance);
    153158
    154159                /* Print the value if it's interesting */
     
    161166                usb_log_debug("%s: Connected change detected: %x.\n",
    162167                    instance->id_string, port_status);
    163 
    164                 int rc =
    165                     usb_hc_connection_open(&instance->hc_connection);
    166                 if (rc != EOK) {
    167                         usb_log_error("%s: Failed to connect to HC.",
    168                             instance->id_string);
    169                         continue;
    170                 }
    171168
    172169                /* Remove any old device */
     
    175172                            instance->id_string);
    176173                        uhci_port_remove_device(instance);
     174                }
     175
     176                int ret =
     177                    usb_hc_connection_open(&instance->hc_connection);
     178                if (ret != EOK) {
     179                        usb_log_error("%s: Failed to connect to HC.",
     180                            instance->id_string);
     181                        continue;
    177182                }
    178183
     
    190195                }
    191196
    192                 rc = usb_hc_connection_close(&instance->hc_connection);
    193                 if (rc != EOK) {
     197                ret = usb_hc_connection_close(&instance->hc_connection);
     198                if (ret != EOK) {
    194199                        usb_log_error("%s: Failed to disconnect.",
    195200                            instance->id_string);
     
    209214int uhci_port_reset_enable(int portno, void *arg)
    210215{
    211         uhci_port_t *port = (uhci_port_t *) arg;
     216        uhci_port_t *port = arg;
     217        assert(port);
    212218
    213219        usb_log_debug2("%s: new_device_enable_port.\n", port->id_string);
     
    283289        usb_log_error("%s: Don't know how to remove device %" PRIun ".\n",
    284290            port->id_string, port->attached_device);
     291        port->attached_device = 0;
    285292        return ENOTSUP;
    286293}
Note: See TracChangeset for help on using the changeset viewer.