Changeset 7dddd7b in mainline for uspace/drv/bus/usb/usbhub/usbhub.c


Ignore:
Timestamp:
2018-01-13T20:47:58Z (6 years ago)
Author:
Petr Manek <petr.manek@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
71f211f
Parents:
2489353
git-author:
Petr Manek <petr.manek@…> (2018-01-13 19:20:41)
git-committer:
Petr Manek <petr.manek@…> (2018-01-13 20:47:58)
Message:

usbdev: refactor polling

Until now, device polling had to be executed by calling one of four
proxy functions, which served as a syntax sugar and had no clear
distinction between each other (not to mention misleading names and high
number of arguments).

In this commit, the four mentioned functions are discarded in favor of
one main function, which was proxied by them either way. The number of
arguments have decreased in favor of named struct fields in the auto
polling config structure.

Drivers, which make use of polling, such as usbhid and usbhub were
updated to the latest API design.

File:
1 edited

Legend:

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

    r2489353 r7dddd7b  
    164164
    165165        /* Start hub operation. */
    166         opResult = usb_device_auto_poll_desc(hub_dev->usb_device,
    167             &hub_status_change_endpoint_description,
    168             hub_port_changes_callback, ((hub_dev->port_count + 1 + 7) / 8),
    169             -1, usb_hub_polling_error_callback,
    170             usb_hub_polling_terminated_callback, hub_dev);
     166        const usb_device_auto_polling_t auto_polling = {
     167                .debug = 1,
     168                .auto_clear_halt = true,
     169                .delay = -1,
     170                .max_failures = 3,
     171                .on_data = hub_port_changes_callback,
     172                .on_polling_end = usb_hub_polling_terminated_callback,
     173                .on_error = usb_hub_polling_error_callback,
     174                .arg = hub_dev,
     175        };
     176
     177        usb_endpoint_mapping_t *epm =
     178            usb_device_get_mapped_ep_desc(hub_dev->usb_device,
     179            &hub_status_change_endpoint_description);
     180        opResult = usb_device_auto_polling(hub_dev->usb_device, epm,
     181            &auto_polling, ((hub_dev->port_count + 1 + 7) / 8));
     182       
    171183        if (opResult != EOK) {
    172184                /* Function is already bound */
Note: See TracChangeset for help on using the changeset viewer.