Changeset 540abef in mainline


Ignore:
Timestamp:
2011-04-14T07:51:13Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c0cea918
Parents:
27205841
Message:

Root hub driver code cleanup

Location:
uspace/drv/uhci-rhd
Files:
4 edited

Legend:

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

    r27205841 r540abef  
    6868 * @return Error code. (Always EOK)
    6969 */
    70 static inline void uhci_port_write_status(
    71     uhci_port_t *port, port_status_t value)
    72 {
    73         assert(port);
    74         pio_write_16(port->address, value);
     70static inline void uhci_port_write_status(uhci_port_t *port, port_status_t val)
     71{
     72        assert(port);
     73        pio_write_16(port->address, val);
    7574}
    7675/*----------------------------------------------------------------------------*/
     
    101100        port->rh = rh;
    102101
    103         int rc = usb_hc_connection_initialize_from_device(
    104             &port->hc_connection, rh);
    105         if (rc != EOK) {
     102        int ret =
     103            usb_hc_connection_initialize_from_device(&port->hc_connection, rh);
     104        if (ret != EOK) {
    106105                usb_log_error("Failed to initialize connection to HC.");
    107                 return rc;
     106                return ret;
    108107        }
    109108
     
    238237        /* Enable the port. */
    239238        uhci_port_set_enabled(port, true);
    240 
    241239        return EOK;
    242240}
     
    271269        usb_log_info("New device at port %u, address %d (handle %llu).\n",
    272270            port->number, dev_addr, port->attached_device);
    273 
    274271        return EOK;
    275272}
  • uspace/drv/uhci-rhd/port.h

    r27205841 r540abef  
    5454#define STATUS_SUSPEND   (1 << 12)
    5555
     56/** UHCI port structure */
    5657typedef struct uhci_port
    5758{
  • uspace/drv/uhci-rhd/root_hub.c

    r27205841 r540abef  
    3333 */
    3434#include <errno.h>
     35#include <str_error.h>
    3536#include <ddi.h>
    3637#include <usb/debug.h>
     
    4344 * @param[in] addr Address of I/O registers.
    4445 * @param[in] size Size of available I/O space.
    45  * @param[in] rh Pointer to ddf instance of the root hub driver.
     46 * @param[in] rh Pointer to DDF instance of the root hub driver.
    4647 * @return Error code.
    4748 */
     
    5859        if (ret < 0) {
    5960                usb_log_error(
    60                     "Failed(%d) to gain access to port registers at %p\n",
    61                     ret, regs);
     61                    "Failed(%d) to gain access to port registers at %p: %s.\n",
     62                    ret, regs, str_error(ret));
    6263                return ret;
    6364        }
     
    6667        unsigned i = 0;
    6768        for (; i < UHCI_ROOT_HUB_PORT_COUNT; ++i) {
    68                 /* NOTE: mind pointer arithmetics here */
    6969                ret = uhci_port_init(
    70                     &instance->ports[i], regs + i, i, ROOT_HUB_WAIT_USEC, rh);
     70                    &instance->ports[i], &regs[i], i, ROOT_HUB_WAIT_USEC, rh);
    7171                if (ret != EOK) {
    7272                        unsigned j = 0;
  • uspace/drv/uhci-rhd/root_hub.h

    r27205841 r540abef  
    4242#define ROOT_HUB_WAIT_USEC 250000 /* 250 miliseconds */
    4343
     44/** UHCI root hub drvier structure */
    4445typedef struct root_hub {
     46        /** Ports provided by the hub */
    4547        uhci_port_t ports[UHCI_ROOT_HUB_PORT_COUNT];
    46         devman_handle_t hc_handle;
    4748} uhci_root_hub_t;
    4849
    4950int uhci_root_hub_init(
    50   uhci_root_hub_t *instance, void *addr, size_t size, ddf_dev_t *rh);
     51    uhci_root_hub_t *instance, void *addr, size_t size, ddf_dev_t *rh);
    5152
    5253void uhci_root_hub_fini(uhci_root_hub_t *instance);
Note: See TracChangeset for help on using the changeset viewer.