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

Changeset 56fd7cf in mainline for uspace/drv/bus/usb/ohci/ohci.c


Ignore:
Timestamp:
2012-08-17T11:37:03Z (9 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master
Children:
1d5a540
Parents:
be2a38ad
Message:

Make ddf_dev_t and ddf_fun_t opaque. This further tighthens the DDF interface.

File:
1 edited

Legend:

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

    rbe2a38ad r56fd7cf  
    3333 * @brief OHCI driver
    3434 */
     35
     36/* XXX Fix this */
     37#define _DDF_DATA_IMPLANT
     38
    3539#include <errno.h>
    3640#include <str_error.h>
     
    5256} ohci_t;
    5357
    54 static inline ohci_t * dev_to_ohci(ddf_dev_t *dev)
    55 {
    56         assert(dev);
    57         return dev->driver_data;
     58static inline ohci_t *dev_to_ohci(ddf_dev_t *dev)
     59{
     60        return ddf_dev_data_get(dev);
    5861}
    5962/** IRQ handling callback, identifies device
     
    8790
    8891        if (address != NULL) {
    89                 *address = dev_to_ohci(fun->dev)->hc.rh.address;
     92                *address = dev_to_ohci(ddf_fun_get_dev(fun))->hc.rh.address;
    9093        }
    9194
     
    103106{
    104107        assert(fun);
    105         ddf_fun_t *hc_fun = dev_to_ohci(fun->dev)->hc_fun;
     108        ddf_fun_t *hc_fun = dev_to_ohci(ddf_fun_get_dev(fun))->hc_fun;
    106109        assert(hc_fun);
    107110
    108111        if (handle != NULL)
    109                 *handle = hc_fun->handle;
     112                *handle = ddf_fun_get_handle(hc_fun);
    110113        return EOK;
    111114}
     
    152155if (ret != EOK) { \
    153156        if (instance->hc_fun) { \
    154                 instance->hc_fun->driver_data = NULL; \
    155157                ddf_fun_destroy(instance->hc_fun); \
    156158        } \
    157159        if (instance->rh_fun) { \
    158                 instance->rh_fun->driver_data = NULL; \
    159160                ddf_fun_destroy(instance->rh_fun); \
    160161        } \
     
    167168        CHECK_RET_DEST_FREE_RETURN(ret,
    168169            "Failed to create OHCI HC function: %s.\n", str_error(ret));
    169         instance->hc_fun->ops = &hc_ops;
    170         instance->hc_fun->driver_data = &instance->hc;
     170        ddf_fun_set_ops(instance->hc_fun, &hc_ops);
     171        ddf_fun_data_implant(instance->hc_fun, &instance->hc);
    171172
    172173        instance->rh_fun = ddf_fun_create(device, fun_inner, "ohci_rh");
     
    174175        CHECK_RET_DEST_FREE_RETURN(ret,
    175176            "Failed to create OHCI RH function: %s.\n", str_error(ret));
    176         instance->rh_fun->ops = &rh_ops;
     177        ddf_fun_set_ops(instance->rh_fun, &rh_ops);
    177178
    178179        uintptr_t reg_base = 0;
     
    183184        CHECK_RET_DEST_FREE_RETURN(ret,
    184185            "Failed to get register memory addresses for %" PRIun ": %s.\n",
    185             device->handle, str_error(ret));
     186            ddf_dev_get_handle(device), str_error(ret));
    186187        usb_log_debug("Memory mapped regs at %p (size %zu), IRQ %d.\n",
    187188            (void *) reg_base, reg_size, irq);
Note: See TracChangeset for help on using the changeset viewer.