Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/ohci/ohci.c

    r56fd7cf r44c1a48  
    3333 * @brief OHCI driver
    3434 */
    35 
    36 /* XXX Fix this */
    37 #define _DDF_DATA_IMPLANT
    38 
    3935#include <errno.h>
    4036#include <str_error.h>
     
    5652} ohci_t;
    5753
    58 static inline ohci_t *dev_to_ohci(ddf_dev_t *dev)
    59 {
    60         return ddf_dev_data_get(dev);
     54static inline ohci_t * dev_to_ohci(ddf_dev_t *dev)
     55{
     56        assert(dev);
     57        return dev->driver_data;
    6158}
    6259/** IRQ handling callback, identifies device
     
    7875        hc_interrupt(&ohci->hc, status);
    7976}
    80 
     77/*----------------------------------------------------------------------------*/
    8178/** Get USB address assigned to root hub.
    8279 *
     
    9087
    9188        if (address != NULL) {
    92                 *address = dev_to_ohci(ddf_fun_get_dev(fun))->hc.rh.address;
     89                *address = dev_to_ohci(fun->dev)->hc.rh.address;
    9390        }
    9491
    9592        return EOK;
    9693}
    97 
     94/*----------------------------------------------------------------------------*/
    9895/** Gets handle of the respective hc (this device, hc function).
    9996 *
     
    106103{
    107104        assert(fun);
    108         ddf_fun_t *hc_fun = dev_to_ohci(ddf_fun_get_dev(fun))->hc_fun;
     105        ddf_fun_t *hc_fun = dev_to_ohci(fun->dev)->hc_fun;
    109106        assert(hc_fun);
    110107
    111108        if (handle != NULL)
    112                 *handle = ddf_fun_get_handle(hc_fun);
     109                *handle = hc_fun->handle;
    113110        return EOK;
    114111}
    115 
     112/*----------------------------------------------------------------------------*/
    116113/** Root hub USB interface */
    117114static usb_iface_t usb_iface = {
     
    119116        .get_my_address = rh_get_my_address,
    120117};
    121 
     118/*----------------------------------------------------------------------------*/
    122119/** Standard USB HC options (HC interface) */
    123120static ddf_dev_ops_t hc_ops = {
    124121        .interfaces[USBHC_DEV_IFACE] = &hcd_iface,
    125122};
    126 
     123/*----------------------------------------------------------------------------*/
    127124/** Standard USB RH options (RH interface) */
    128125static ddf_dev_ops_t rh_ops = {
    129126        .interfaces[USB_DEV_IFACE] = &usb_iface,
    130127};
    131 
     128/*----------------------------------------------------------------------------*/
    132129/** Initialize hc and rh ddf structures and their respective drivers.
    133130 *
     
    155152if (ret != EOK) { \
    156153        if (instance->hc_fun) { \
     154                instance->hc_fun->driver_data = NULL; \
    157155                ddf_fun_destroy(instance->hc_fun); \
    158156        } \
    159157        if (instance->rh_fun) { \
     158                instance->rh_fun->driver_data = NULL; \
    160159                ddf_fun_destroy(instance->rh_fun); \
    161160        } \
     
    168167        CHECK_RET_DEST_FREE_RETURN(ret,
    169168            "Failed to create OHCI HC function: %s.\n", str_error(ret));
    170         ddf_fun_set_ops(instance->hc_fun, &hc_ops);
    171         ddf_fun_data_implant(instance->hc_fun, &instance->hc);
     169        instance->hc_fun->ops = &hc_ops;
     170        instance->hc_fun->driver_data = &instance->hc;
    172171
    173172        instance->rh_fun = ddf_fun_create(device, fun_inner, "ohci_rh");
     
    175174        CHECK_RET_DEST_FREE_RETURN(ret,
    176175            "Failed to create OHCI RH function: %s.\n", str_error(ret));
    177         ddf_fun_set_ops(instance->rh_fun, &rh_ops);
     176        instance->rh_fun->ops = &rh_ops;
    178177
    179178        uintptr_t reg_base = 0;
     
    184183        CHECK_RET_DEST_FREE_RETURN(ret,
    185184            "Failed to get register memory addresses for %" PRIun ": %s.\n",
    186             ddf_dev_get_handle(device), str_error(ret));
     185            device->handle, str_error(ret));
    187186        usb_log_debug("Memory mapped regs at %p (size %zu), IRQ %d.\n",
    188187            (void *) reg_base, reg_size, irq);
Note: See TracChangeset for help on using the changeset viewer.