Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbhost/src/ddf_helpers.c

    rb7fd2a0 r4547f11  
    9191
    9292
    93 static errno_t hcd_ddf_new_device(ddf_dev_t *device, usb_dev_t *hub, unsigned port);
    94 static errno_t hcd_ddf_remove_device(ddf_dev_t *device, usb_dev_t *hub, unsigned port);
     93static int hcd_ddf_new_device(ddf_dev_t *device, usb_dev_t *hub, unsigned port);
     94static int hcd_ddf_remove_device(ddf_dev_t *device, usb_dev_t *hub, unsigned port);
    9595
    9696
     
    107107 * @return Error code.
    108108 */
    109 static errno_t register_endpoint(
     109static int register_endpoint(
    110110    ddf_fun_t *fun, usb_endpoint_t endpoint,
    111111    usb_transfer_type_t transfer_type, usb_direction_t direction,
     
    136136 * @return Error code.
    137137 */
    138 static errno_t unregister_endpoint(
     138static int unregister_endpoint(
    139139    ddf_fun_t *fun, usb_endpoint_t endpoint, usb_direction_t direction)
    140140{
     
    151151}
    152152
    153 static errno_t reserve_default_address(ddf_fun_t *fun, usb_speed_t speed)
     153static int reserve_default_address(ddf_fun_t *fun, usb_speed_t speed)
    154154{
    155155        assert(fun);
     
    164164}
    165165
    166 static errno_t release_default_address(ddf_fun_t *fun)
     166static int release_default_address(ddf_fun_t *fun)
    167167{
    168168        assert(fun);
     
    176176}
    177177
    178 static errno_t device_enumerate(ddf_fun_t *fun, unsigned port)
     178static int device_enumerate(ddf_fun_t *fun, unsigned port)
    179179{
    180180        assert(fun);
     
    188188}
    189189
    190 static errno_t device_remove(ddf_fun_t *fun, unsigned port)
     190static int device_remove(ddf_fun_t *fun, unsigned port)
    191191{
    192192        assert(fun);
     
    206206 * @return Error code.
    207207 */
    208 static errno_t get_my_device_handle(ddf_fun_t *fun, devman_handle_t *handle)
     208static int get_my_device_handle(ddf_fun_t *fun, devman_handle_t *handle)
    209209{
    210210        assert(fun);
     
    224224 * @return Error code.
    225225 */
    226 static errno_t dev_read(ddf_fun_t *fun, usb_endpoint_t endpoint,
     226static int dev_read(ddf_fun_t *fun, usb_endpoint_t endpoint,
    227227    uint64_t setup_data, uint8_t *data, size_t size,
    228228    usbhc_iface_transfer_in_callback_t callback, void *arg)
     
    250250 * @return Error code.
    251251 */
    252 static errno_t dev_write(ddf_fun_t *fun, usb_endpoint_t endpoint,
     252static int dev_write(ddf_fun_t *fun, usb_endpoint_t endpoint,
    253253    uint64_t setup_data, const uint8_t *data, size_t size,
    254254    usbhc_iface_transfer_out_callback_t callback, void *arg)
     
    313313};
    314314
    315 static errno_t hcd_ddf_add_device(ddf_dev_t *parent, usb_dev_t *hub_dev,
     315static int hcd_ddf_add_device(ddf_dev_t *parent, usb_dev_t *hub_dev,
    316316    unsigned port, usb_address_t address, usb_speed_t speed, const char *name,
    317317    const match_id_list_t *mids)
     
    351351        }
    352352
    353         errno_t ret = ddf_fun_bind(fun);
     353        int ret = ddf_fun_bind(fun);
    354354        if (ret != EOK) {
    355355                ddf_fun_destroy(fun);
     
    389389
    390390/* This is a copy of lib/usbdev/src/recognise.c */
    391 static errno_t create_match_ids(match_id_list_t *l,
     391static int create_match_ids(match_id_list_t *l,
    392392    usb_standard_device_descriptor_t *d)
    393393{
     
    418418}
    419419
    420 static errno_t hcd_ddf_remove_device(ddf_dev_t *device, usb_dev_t *hub,
     420static int hcd_ddf_remove_device(ddf_dev_t *device, usb_dev_t *hub,
    421421    unsigned port)
    422422{
     
    443443                list_remove(&victim->link);
    444444                fibril_mutex_unlock(&hub->guard);
    445                 const errno_t ret = ddf_fun_unbind(victim->fun);
     445                const int ret = ddf_fun_unbind(victim->fun);
    446446                if (ret == EOK) {
    447447                        usb_address_t address = victim->address;
     
    458458}
    459459
    460 static errno_t hcd_ddf_new_device(ddf_dev_t *device, usb_dev_t *hub, unsigned port)
     460static int hcd_ddf_new_device(ddf_dev_t *device, usb_dev_t *hub, unsigned port)
    461461{
    462462        assert(device);
     
    468468
    469469        /* This checks whether the default address is reserved and gets speed */
    470         errno_t ret = usb_bus_get_speed(&hcd->bus, USB_ADDRESS_DEFAULT, &speed);
     470        int ret = usb_bus_get_speed(&hcd->bus, USB_ADDRESS_DEFAULT, &speed);
    471471        if (ret != EOK) {
    472472                usb_log_error("Failed to verify speed: %s.", str_error(ret));
     
    621621 * @return Error code
    622622 */
    623 errno_t hcd_ddf_setup_root_hub(ddf_dev_t *device)
     623int hcd_ddf_setup_root_hub(ddf_dev_t *device)
    624624{
    625625        assert(device);
     
    628628
    629629        hcd_reserve_default_address(hcd, hcd->bus.max_speed);
    630         const errno_t ret = hcd_ddf_new_device(device, NULL, 0);
     630        const int ret = hcd_ddf_new_device(device, NULL, 0);
    631631        hcd_release_default_address(hcd);
    632632        return ret;
     
    643643 * This function does all the ddf work for hc driver.
    644644 */
    645 errno_t hcd_ddf_setup_hc(ddf_dev_t *device, usb_speed_t max_speed,
     645int hcd_ddf_setup_hc(ddf_dev_t *device, usb_speed_t max_speed,
    646646    size_t bw, bw_count_func_t bw_count)
    647647{
     
    656656        hcd_init(&instance->hcd, max_speed, bw, bw_count);
    657657
    658         errno_t ret = ENOMEM;
     658        int ret = ENOMEM;
    659659        instance->ctl_fun = ddf_fun_create(device, fun_exposed, "ctl");
    660660        if (!instance->ctl_fun) {
     
    691691        hc_dev_t *hc = dev_to_hc_dev(device);
    692692        assert(hc);
    693         const errno_t ret = ddf_fun_unbind(hc->ctl_fun);
     693        const int ret = ddf_fun_unbind(hc->ctl_fun);
    694694        if (ret == EOK)
    695695                ddf_fun_destroy(hc->ctl_fun);
     
    703703 * @return Error code.
    704704 */
    705 errno_t hcd_ddf_enable_interrupt(ddf_dev_t *device, int inum)
     705int hcd_ddf_enable_interrupt(ddf_dev_t *device, int inum)
    706706{
    707707        async_sess_t *parent_sess = ddf_dev_parent_sess_get(device);
     
    713713
    714714//TODO: Cache parent session in HCD
    715 errno_t hcd_ddf_get_registers(ddf_dev_t *device, hw_res_list_parsed_t *hw_res)
     715int hcd_ddf_get_registers(ddf_dev_t *device, hw_res_list_parsed_t *hw_res)
    716716{
    717717        async_sess_t *parent_sess = ddf_dev_parent_sess_get(device);
     
    720720
    721721        hw_res_list_parsed_init(hw_res);
    722         const errno_t ret = hw_res_get_list_parsed(parent_sess, hw_res, 0);
     722        const int ret = hw_res_get_list_parsed(parent_sess, hw_res, 0);
    723723        if (ret != EOK)
    724724                hw_res_list_parsed_clean(hw_res);
     
    751751 * @return Error code.
    752752 */
    753 errno_t hcd_ddf_setup_interrupts(ddf_dev_t *device,
     753int hcd_ddf_setup_interrupts(ddf_dev_t *device,
    754754    const hw_res_list_parsed_t *hw_res,
    755755    interrupt_handler_t handler,
    756     errno_t (*gen_irq_code)(irq_code_t *, const hw_res_list_parsed_t *, int *),
     756    int (*gen_irq_code)(irq_code_t *, const hw_res_list_parsed_t *, int *),
    757757    cap_handle_t *handle)
    758758{
     
    765765
    766766        int irq;
    767         errno_t ret = gen_irq_code(&irq_code, hw_res, &irq);
     767        int ret = gen_irq_code(&irq_code, hw_res, &irq);
    768768        if (ret != EOK) {
    769769                usb_log_error("Failed to generate IRQ code: %s.\n",
     
    809809}
    810810
    811 static errno_t interrupt_polling(void *arg)
     811static int interrupt_polling(void *arg)
    812812{
    813813        hcd_t *hcd = arg;
     
    847847 *  - registers root hub
    848848 */
    849 errno_t hcd_ddf_add_hc(ddf_dev_t *device, const ddf_hc_driver_t *driver)
     849int hcd_ddf_add_hc(ddf_dev_t *device, const ddf_hc_driver_t *driver)
    850850{
    851851        assert(driver);
     
    857857        };
    858858
    859         errno_t ret = EOK;
     859        int ret = EOK;
    860860        const usb_speed_t speed = driver->hc_speed;
    861861        if (speed >= ARRAY_SIZE(bw) || bw[speed].bw == 0) {
     
    884884            driver->irq_handler ? driver->irq_handler : ddf_hcd_gen_irq_handler;
    885885        int irq_cap;
    886         errno_t irq_ret = hcd_ddf_setup_interrupts(device, &hw_res,
     886        int irq_ret = hcd_ddf_setup_interrupts(device, &hw_res,
    887887            irq_handler, driver->irq_code_gen, &irq_cap);
    888888        bool irqs_enabled = (irq_ret == EOK);
Note: See TracChangeset for help on using the changeset viewer.